我将红外线接收器连接到USB端口...(dmesg的最后一行告诉设备文件)
$ dmesg
[10496.596063] usb 7-2: new full-speed USB device number 2 using uhci_hcd
[10496.751112] usb 7-2: New USB device found, idVendor=0df7, idProduct=0620
[10496.751117] usb 7-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[10496.751120] usb 7-2: Product: USB-Serial Controller
[10496.751124] usb 7-2: Manufacturer: Prolific Technology Inc.
[10496.787441] usbcore: registered new interface driver usbserial
[10496.787467] usbcore: registered new interface driver usbserial_generic
[10496.787483] usbserial: USB Serial support registered for generic
[10496.795104] usbcore: registered new interface driver pl2303
[10496.795129] usbserial: USB Serial support registered for pl2303
[10496.795160] pl2303 7-2:1.0: pl2303 converter detected
[10496.807238] usb 7-2: pl2303 converter now attached to ttyUSB0
然后我继续尝试...
$ sudo cat /dev/ttyUSB0
但没有输出,只是挂起。即使,当我按遥控器上的任何按钮时,红外接收器设备的LED也会闪烁,这似乎可以正常工作。
为什么会这样呢?
笔记:
当我从USB端口移除设备并打印“ cat:ttyUSB0:No such device”时,以上命令退出,并且dmesg打印3行:
[13707.264086] usb 7-2: USB disconnect, device number 2 [13707.264894] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0 [13707.264915] pl2303 7-2:1.0: device disconnected)
使用键盘的设备文件可以正常工作,例如:
$ sudo cat /dev/input/by-id/usb-USB_USB_Keykoard-event-kbd
当我按键盘上的任意键时,会在控制台上产生许多奇怪的字符
- 其他USB端口也一样
stty raw -echo < /dev/ttyUSB0; cat -vte /dev/ttyUSB0
。