When I call sdReadTimeout, I expect it to timeout after the specified time, regardless of the incoming traffic pattern. So, given the following code, we would expect to return after at most 1sec:
Code: Select all
uint8_t buf[512];
sdReadTimeout(&SD1,buf,sizeof(buf),MS2ST(1000));
However, what I see is sdReadTimeout takes ~1min to timeout.
This seems to be because internally, qwait is called with the same 'time' value each time some data is received, without decrementing 'time' accordingly.
Code: Select all
// from chIQReadTimeout in chqueues.c
...
if (qwait((GenericQueue *)iqp, time) != Q_OK) {
...
Of course, there are workarounds, but I'm just wondering if this behavior is intentional. (?)