简体   繁体   中英

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 dmesg message:

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 linux-usb@vger.kernel.org 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 /dev/ttyUSB0 device as promised. So far, everything seems ok.

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

screen /dev/ttyUSB0 115200

I continuously receive 1` . 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM