Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ttbl.device_mapper: make ttys_find_by_spec() find TTYs without USB in…
…terface When using ttbl.device_mapper.ttys_find_by_spec() to find TTYs associated to a USB device, we usually had to also specify a USB interface by appending #1.0 (the interface number), like: >>> device_spec = "usb,#123456,##:1.0" Which would map to /sys/devices/PATH/usbN/.../N-1.3/N-1.3:1.0 and find ttys under ttyUSBm or tty/ttyACMm using tty* or tty/tty*. In the case where the device has only one interface (and thus exposes one serial port), this is overkill and adds more unneeded verbosity. We want to be able to do just: >>> device_spec = "usb,#123456" So make the globs that tty_find_by_spec() be able to dig deeper into the device structure, so it will find the subdirectories representing the single TTY without having to specify a USB interface. The extra globs find /sys/devices/PATH/usbN/.../N-1.3/N-1.3:1.0/ttyUSB or /sys/devices/PATH/usbN/.../N-1.3/N-1.3:1.0/tty/ttyACM* since it adds an extra */ to catch the interface directories hanging under the main USB device directory. Like this, devices which expose multiple serial ports on different USB interfaces still can support them by specifying the interface, eg: >>> device_spec = "usb,#123456,#:1.0" >>> device_spec = "usb,#123456,#:2.0"
- Loading branch information