From 45ff4f60b36facd82440b1ab1318948351b1edd4 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 30 Mar 2015 15:37:06 +0200 Subject: [PATCH 1/2] Bridge: fix transfers which ignored host response Bridge.put() was broken by #2781 because it used transfer() 2-parameters overloaded version, which imply that rxlen == 0. But the Linux Bridge responded, so the check (i >= rxlen) was true and the function timed out after retrying 50 times. Every bridge command (python side) has been checked and now SHOULD strictly follow this rule and never ignore silently the received data --- libraries/Bridge/src/Bridge.cpp | 3 ++- libraries/Bridge/src/FileIO.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/Bridge/src/Bridge.cpp b/libraries/Bridge/src/Bridge.cpp index 677316e312a..4cf74661d4f 100644 --- a/libraries/Bridge/src/Bridge.cpp +++ b/libraries/Bridge/src/Bridge.cpp @@ -87,10 +87,11 @@ void BridgeClass::begin() { void BridgeClass::put(const char *key, const char *value) { // TODO: do it in a more efficient way String cmd = "D"; + uint8_t res[1]; cmd += key; cmd += "\xFE"; cmd += value; - transfer((uint8_t*)cmd.c_str(), cmd.length()); + transfer((uint8_t*)cmd.c_str(), cmd.length(), res, 1); } unsigned int BridgeClass::get(const char *key, uint8_t *value, unsigned int maxlen) { diff --git a/libraries/Bridge/src/FileIO.cpp b/libraries/Bridge/src/FileIO.cpp index 5f4a2e11645..603657239ad 100644 --- a/libraries/Bridge/src/FileIO.cpp +++ b/libraries/Bridge/src/FileIO.cpp @@ -175,7 +175,8 @@ void File::close() { if (mode == 255) return; uint8_t cmd[] = {'f', handle}; - bridge.transfer(cmd, 2); + uint8_t ret[1]; + bridge.transfer(cmd, 2, ret, 1); mode = 255; } From d6f9a6703cda424146b89fa2571384d61a82de38 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 31 Mar 2015 09:30:51 +0200 Subject: [PATCH 2/2] Bridge: increase version number --- libraries/Bridge/library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Bridge/library.properties b/libraries/Bridge/library.properties index fcc7a4c40ed..b454d08bf4a 100644 --- a/libraries/Bridge/library.properties +++ b/libraries/Bridge/library.properties @@ -1,5 +1,5 @@ name=Bridge -version=1.0.0 +version=1.0.1 author=Arduino maintainer=Arduino sentence=Enables the communication between the Linux processor and the AVR. For Arduino Yún and TRE only.