]> sigrok.org Git - libsigrok.git/commit
serial: make failed flush() in open() non-fatal, CP2110 flush() return
authorGerhard Sittig <redacted>
Sat, 1 Aug 2020 12:55:20 +0000 (14:55 +0200)
committerGerhard Sittig <redacted>
Sat, 1 Aug 2020 12:55:20 +0000 (14:55 +0200)
commit0dc27cd1dbc961366d14607526e54992078e9d5c
treeac2e39a89a100ae4ac4fc2294fd1af436a0c265e
parent13726d30b29a07c42a8771e580b9edf78a198011
serial: make failed flush() in open() non-fatal, CP2110 flush() return

Commit cb828f1b3e00 introduced an unconditional flush() call in the
open() routine's body, and passed its return value in verbatim form to
open() callers. Some of the transports/cables for serial communication
yield the SR_ERR_NA return value. Consider this a non-fatal condition.

Unbreak the CP2110 HID chip's flush() implementation. Don't expect a
return value of 0 from HID write calls, instead expect to see the number
of written bytes for successful calls.

This was tested with ch9325 (UT-D04), cp2110 (UT-D09) and bu86x.
src/serial.c
src/serial_hid_cp2110.c