Closed vjncenzo closed 10 years ago
I can't upload files, but you can find them here: http://forum.arduino.cc/index.php?topic=206494.msg1544904#msg1544904
@vjncenzo
may you look the content of the file /usr/bin/run-bridge
and check if the exec line contains the flag -u
? The whole file should look to something like:
#!/bin/sh
cd /usr/lib/python2.7/bridge
exec python -u bridge.py 2> /tmp/bridge.py-stderr.log
I looked in the file, and the '-u' wasn't there. I added it and now it works!
thanks, Vjncenzo
It seems that the File::doBuffer() function, for some files (?), returns wrong number of available characters. I think it's due to the bridge.transfer function that returns TRANSFER_TIMEOUT (0xFFFF), that is casted to an uint8_t, so it becomes 255, but BUFFER_SIZE is only 64, so we have inconsistent data: the File::Available() returns 254, and if you try to use read(), it reads outside the buffer.
I don't know if it depends on filesize or something else, but I tried with different files, all 101 bytes, they differs only on the \n position. in the attached file the \n is at position 21. with bigger values (f.i. if the first line is longer and the second one is shorter) I have no problem.
Attached you can find the sketch and the offending file.
thanks, Vjncenzo