HomeFreeBSD

usb: serial: make more commands execute synchronously

Description

usb: serial: make more commands execute synchronously

The termios layer wants some level of guarantee that we've actually
submitted param changes to the hardware when our functions return, so we
need to do a little more waiting to avoid violating those guarantees.

This is especially important as some hardware has some minimum timing
specifications around this stuff, and without being less asynchronous
the software dealing with these devices can't reasonably operate the
hardware without more excessive delays than they should need.

More specifically, we make sure that:

  • The command to start transfers is finished before we toggle DTR/RTS
  • The status_change command finishes before we return, which may change some fields in the softc that we need for a subsequent call into usb_serial
  • cfg_param finishes before we re-enable transfers, and we ensure that RTS is appropriately toggled before we return to userland

This has been observed to fix some flakiness in connecting to some
ESP32 devices.

Tested by: kenrap from Libera
Reviewed by: imp, kib

(cherry picked from commit 36a80f4264350a2f4f0686eb91ae7f5943d40327)

Details

Provenance
kevansAuthored on Wed, Dec 11, 1:23 AM
Parents
rG2ba5217057bd: usb: serial: allow the open/close sleep to be interruptible
Branches
Unknown
Tags
Unknown