0

I have two different usb-to-serial adapters, a Keyspan USA-19HS and a Plugable usb serial converter. Plugging either in to my Ubuntu 20.10 Lenovo X1 laptop results in a /dev/ttyUSB0 being created that I can open and read from.

However, no combination of either flags in pyserial when reading the serial port via python, or parenb or cstopb arguments to stty when reading the port via hd seem to change the data I can read from the serial port. It's as if the driver is ignoring the parity/stop-bit parameters. I'm trying to read data from a serial source that uses even parity and 1 stop bit.

Somewhat suspiciously, in my console log, it looks like the keyspan driver isn't loading any firmware. Here's what I see in the console log after doing a dmesg -n 8 and plugging in the Keyspan converter:

Jan 11 16:40:20 X1-6th kernel: [ 8099.025705] usbcore: registered new interface driver keyspan
Jan 11 16:40:20 X1-6th kernel: [ 8099.025717] usbserial: USB Serial support registered for Keyspan - (without firmware)
Jan 11 16:40:20 X1-6th kernel: [ 8099.025724] usbserial: USB Serial support registered for Keyspan 1 port adapter
Jan 11 16:40:20 X1-6th kernel: [ 8099.025730] usbserial: USB Serial support registered for Keyspan 2 port adapter
Jan 11 16:40:20 X1-6th kernel: [ 8099.025736] usbserial: USB Serial support registered for Keyspan 4 port adapter
Jan 11 16:40:26 X1-6th kernel: [ 8105.207664] usb 1-2: new full-speed USB device number 9 using xhci_hcd
Jan 11 16:40:26 X1-6th kernel: [ 8105.376377] usb 1-2: New USB device found, idVendor=06cd, idProduct=0121, bcdDevice= 1.00
Jan 11 16:40:26 X1-6th kernel: [ 8105.376386] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jan 11 16:40:26 X1-6th kernel: [ 8105.376390] usb 1-2: Product: Keyspan USA-19H 
Jan 11 16:40:26 X1-6th kernel: [ 8105.376394] usb 1-2: Manufacturer: Keyspan, a division of InnoSys Inc.
Jan 11 16:40:26 X1-6th kernel: [ 8105.381746] keyspan 1-2:1.0: Keyspan 1 port adapter converter detected
Jan 11 16:40:26 X1-6th kernel: [ 8105.381952] usb 1-2: Keyspan 1 port adapter converter now attached to ttyUSB0

And I have various Keyspan firmware, including usa19.fw in /lib/firmware/keyspan, found from http://www.chrisdanielson.com/2012/04/10/linux-firmware-keyspan-usb-to-serial/.

There's some info on linux usb serial support at https://www.kernel.org/doc/html/latest/usb/usb-serial.html, but I didn't see a good solution there.

Has any figured out either how to effectively set partiy/stop bits with a keyspan adapater, or know of a usb-serial adapter that has linux support to do so?

1 Answers1

0

Turns out the driver was working fine. The source was using a non-standard baud rate. Pyserial supports custom baud rates, so once I knew what it was using, the data came through ok with Even parity.