[英]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. 我正在尝试通过Linux( pdf )中的Di245通过其虚拟COM驱动程序(VCD)与Di245通信,但遇到了一个奇怪的问题。 Internally, an FTDI chipset is used by this device (FT232BL).
在内部,此设备(FT232BL)使用FTDI芯片组。
Attaching the device by itself isn't registered as a VCD, so I do the following: 单独附加设备不会注册为VCD,因此请执行以下操作:
sudo modprobe usbserial vendor=0x0683 product=0x2450
which results in the following dmesg
message: 这将导致以下
dmesg
消息:
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. 然后我按承诺得到了
/dev/ttyUSB0
设备。 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 `
). 但是,如果我在我的代码打开端口,我得到了一堆
1`
从它(交替的1
和`
)。 Trying with screen
: 尝试使用
screen
:
screen /dev/ttyUSB0 115200
I continuously receive 1`
. 我不断收到
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. 这样,
ftdi_sio
驱动程序便知道要为其提供VCD的供应商/产品。 The following udev rule (say, 99-di245.rules
) can automate this: 以下udev规则(例如
99-di245.rules
)可以自动执行此操作:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.