Skip to content

Commit 45ff4f6

Browse files
committed
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
1 parent 3788128 commit 45ff4f6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: libraries/Bridge/src/Bridge.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ void BridgeClass::begin() {
8787
void BridgeClass::put(const char *key, const char *value) {
8888
// TODO: do it in a more efficient way
8989
String cmd = "D";
90+
uint8_t res[1];
9091
cmd += key;
9192
cmd += "\xFE";
9293
cmd += value;
93-
transfer((uint8_t*)cmd.c_str(), cmd.length());
94+
transfer((uint8_t*)cmd.c_str(), cmd.length(), res, 1);
9495
}
9596

9697
unsigned int BridgeClass::get(const char *key, uint8_t *value, unsigned int maxlen) {

Diff for: libraries/Bridge/src/FileIO.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ void File::close() {
175175
if (mode == 255)
176176
return;
177177
uint8_t cmd[] = {'f', handle};
178-
bridge.transfer(cmd, 2);
178+
uint8_t ret[1];
179+
bridge.transfer(cmd, 2, ret, 1);
179180
mode = 255;
180181
}
181182

0 commit comments

Comments
 (0)