• Michael Hanselmann's avatar
    USB: serial: ch341: simulate break condition if not supported · 0580baa4
    Michael Hanselmann authored
    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: default avatarMichael 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: default avatarJohan Hovold <johan@kernel.org>
    0580baa4
ch341.c 22 KB