]> sigrok.org Git - libsigrok.git/commitdiff
serial: Only sleep when no characters are received.
authorDaniel Thompson <redacted>
Thu, 19 Sep 2013 15:39:24 +0000 (16:39 +0100)
committerBert Vermeulen <redacted>
Thu, 26 Sep 2013 12:57:37 +0000 (14:57 +0200)
g_usleep(XX) sleeps for *at least* XX microseconds but may sleep for
longers (on older kernels the sleep will typically be 10000us). Thus
byte receive loops containing an unconditional sleep will perform
very poorly (for example it causes the scan in agilent-dmm to timeout
prematurely).

Even on modern kernels serial_readline() has a 2ms sleep per byte which
means it will read at a maximum rate of half a character per millisecond
(~4800baud).

This is fixed by only sleeping when read() returns no data.

Signed-off-by: Daniel Thompson <redacted>

No differences found