Shahbaz Shahbaz - 5 months ago 8x
Linux Question

Generic usb-serial device continuously gives 1`

I'm trying to communicate with a Di245 through its Virtual COM driver (VCD) in Linux (pdf) and I'm having a strange issue. Internally, an FTDI chipset is used by this device (FT232BL).

Attaching the device by itself isn't registered as a VCD, so I do the following:

sudo modprobe usbserial vendor=0x0683 product=0x2450

which results in the following

usbserial: USB Serial support registered for generic
usbserial_generic 3-3:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.
usbserial_generic 3-3:1.0: Tell to add your device to a proper driver.
usbserial_generic 3-3:1.0: generic converter detected
usb 3-3: generic converter now attached to ttyUSB0

and I get the
device as promised. So far, everything seems ok.

However, if I open the port in my code, I get a bunch of
from it (alternating
). Trying with

screen /dev/ttyUSB0 115200

I continuously receive
. This is definitely not something the device is sending and oddly enough, if I put a random baudrate, I keep getting the same thing.

Is this a way some error is being reported? What could be triggering this behavior and how can I address it?


The solution was the following:

# modprobe usbserial vendor=0x0683 product=0x2450
# modprobe ftdi_sio
# echo "0683 2450" >> /sys/bus/usb-serial/drivers/ftdi_sio/new_id

This way, the ftdi_sio driver knows which vendor/product to provide VCD for. The following udev rule (say, 99-di245.rules) can automate this:

ACTION=="add", ATTRS{idVendor}=="0683", ATTRS{idProduct}=="2450", RUN+="/sbin/modprobe ftdi_sio" RUN+="/sbin/modprobe usbserial vendor=0x0683 product=0x2450" RUN+="/bin/sh -c 'echo 0683 2450 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'"

It is installed with:

$ sudo cp 99-di245.rules /etc/udev/rules.d
$ sudo udevadm control --reload