USB: serial: ch341: simulate break condition if not supported
authorMichael Hanselmann <public@hansmi.ch>
Sat, 4 Jul 2020 18:25:03 +0000 (20:25 +0200)
committerJohan Hovold <johan@kernel.org>
Mon, 6 Jul 2020 09:25:07 +0000 (11:25 +0200)
commit0580baa46ef67069217bfeabd511ea036e58c1c0
tree601313691266c6c25a6a054b06c9740a0f024055
parentcabe0785ff14e944ab1d828bed64e796e8f96594
USB: serial: ch341: simulate break condition if not supported

A subset of all CH341 devices don't support a real break condition. This
fact is already used in the "ch341_detect_quirks" function. With this
change a quirk is implemented to simulate a break condition by
temporarily lowering the baud rate and sending a NUL byte.

The primary drawbacks of this approach are that the duration of the
break can't be controlled by userland and that data incoming during
a simulated break is corrupted.

The "TTY_DRIVER_HARDWARE_BREAK" serial driver flag was investigated as
an alternative. It's a driver-wide flag and would've required
significant changes to the serial and USB-serial driver frameworks to
expose it for individual USB-serial adapters.

Tested by sending a break condition and watching the TX pin using an
oscilloscope.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Link: https://lore.kernel.org/r/f34a9b6e-ec2a-0873-e97b-2d5b2170e2ff@msgid.hansmi.ch
[ johan: condense info message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ch341.c