/dev/input 文件已创建,但不包含数据流
/dev/input file created, but contains no data stream
因此,我正在尝试在 Linux Mint 的全新安装中读取 USB 设备。
我之前的做法是读取在/dev/input/by-id
中找到的原始流
正在检测设备,它正在生成预期的设备:
$ ls /dev/input/by-id/
usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00
usb-Logitech_Logitech_Buzz_tm__Controller_V1-event-if00
但是当我使用
查看文件时
tail -f /dev/input/by-id/usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00
当我按下某些键时,没有数据输出到终端。我用 sudo 试过,我试过更改文件的权限。基本就在原地等待,没有变化。
有很多关于设备未出现或读取文件时 IO 错误的问题,但我找不到其他人有同样的问题。
为什么 Linux Mint 正在检测设备,但没有从中读取数据?
其他要求的信息:
# ls -lRa /dev/input/by-id
/dev/input/by-id:
total 0
drwxr-xr-x 2 root root 80 Jul 2 21:38 .
drwxr-xr-x 4 root root 360 Jul 2 21:38 ..
lrwxrwxrwx 1 root root 9 Jul 2 21:24 usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00 -> ../event9
lrwxrwxrwx 1 root root 10 Jul 2 21:38 usb-Logitech_Logitech_Buzz_tm__Controller_V1-event-if00 -> ../event10
我也在 /dev/input/event10 上尝试了 tail -f。相同的结果。
另外,dmesg的最后几行
[ 263.440421] usb 2-1.1: new low-speed USB device number 5 using ehci-pci
[ 263.538270] usb 2-1.1: New USB device found, idVendor=054c, idProduct=0002
[ 263.538280] usb 2-1.1: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 263.538285] usb 2-1.1: Product: Logitech Buzz(tm) Controller V1
[ 263.538290] usb 2-1.1: Manufacturer: Logitech
[ 263.585640] hidraw: raw HID events driver (C) Jiri Kosina
[ 263.597332] usbcore: registered new interface driver usbhid
[ 263.597338] usbhid: USB HID core driver
[ 263.615420] input: Logitech Logitech Buzz(tm) Controller V1 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:054C:0002.0001/input/input11
[ 263.668811] sony 0003:054C:0002.0001: input,hidraw0: USB HID v1.11 Joystick [Logitech Logitech Buzz(tm) Controller V1] on usb-0000:00:1d.0-1.1/input0
[ 811.582183] usb 2-1.1: USB disconnect, device number 5
[ 813.318275] usb 2-1.1: new low-speed USB device number 6 using ehci-pci
[ 813.416196] usb 2-1.1: New USB device found, idVendor=054c, idProduct=0002
[ 813.416207] usb 2-1.1: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 813.416213] usb 2-1.1: Product: Logitech Buzz(tm) Controller V1
[ 813.416218] usb 2-1.1: Manufacturer: Logitech
[ 813.422041] input: Logitech Logitech Buzz(tm) Controller V1 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:054C:0002.0002/input/input12
[ 813.422335] sony 0003:054C:0002.0002: input,hidraw0: USB HID v1.11 Joystick [Logitech Logitech Buzz(tm) Controller V1] on usb-0000:00:1d.0-1.1/input0
我发现可以使用 evtest 实用程序 (https://wiki.ubuntu.com/DebuggingTouchpadDetection/evtest) 读取它,但只能以 root 身份或使用 sudo 读取。
同样是 root 或 sudo,我在上述路径中看不到任何数据。
P.S。我可以通过 /sys/class/leds/
将控制数据推送到这些控制器中的灯
这里的问题出在 tail
程序上,而不是输入设备本身。 tail
正在尝试读取数据,直到 "the end of the file" 才开始打印任何内容 -- 但是输入设备 没有 "end of the file",因此它永远不会打印任何事物。另一方面,cat
在数据进入时立即写出数据,因此可以正常工作。我不知道为什么 tail
过去使用其他输入设备为您工作。
因此,我正在尝试在 Linux Mint 的全新安装中读取 USB 设备。
我之前的做法是读取在/dev/input/by-id
中找到的原始流正在检测设备,它正在生成预期的设备:
$ ls /dev/input/by-id/
usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00
usb-Logitech_Logitech_Buzz_tm__Controller_V1-event-if00
但是当我使用
查看文件时tail -f /dev/input/by-id/usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00
当我按下某些键时,没有数据输出到终端。我用 sudo 试过,我试过更改文件的权限。基本就在原地等待,没有变化。
有很多关于设备未出现或读取文件时 IO 错误的问题,但我找不到其他人有同样的问题。
为什么 Linux Mint 正在检测设备,但没有从中读取数据?
其他要求的信息:
# ls -lRa /dev/input/by-id
/dev/input/by-id:
total 0
drwxr-xr-x 2 root root 80 Jul 2 21:38 .
drwxr-xr-x 4 root root 360 Jul 2 21:38 ..
lrwxrwxrwx 1 root root 9 Jul 2 21:24 usb-Generic_WebCam_SC-13HDL11939N_200901010001-event-if00 -> ../event9
lrwxrwxrwx 1 root root 10 Jul 2 21:38 usb-Logitech_Logitech_Buzz_tm__Controller_V1-event-if00 -> ../event10
我也在 /dev/input/event10 上尝试了 tail -f。相同的结果。
另外,dmesg的最后几行
[ 263.440421] usb 2-1.1: new low-speed USB device number 5 using ehci-pci
[ 263.538270] usb 2-1.1: New USB device found, idVendor=054c, idProduct=0002
[ 263.538280] usb 2-1.1: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 263.538285] usb 2-1.1: Product: Logitech Buzz(tm) Controller V1
[ 263.538290] usb 2-1.1: Manufacturer: Logitech
[ 263.585640] hidraw: raw HID events driver (C) Jiri Kosina
[ 263.597332] usbcore: registered new interface driver usbhid
[ 263.597338] usbhid: USB HID core driver
[ 263.615420] input: Logitech Logitech Buzz(tm) Controller V1 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:054C:0002.0001/input/input11
[ 263.668811] sony 0003:054C:0002.0001: input,hidraw0: USB HID v1.11 Joystick [Logitech Logitech Buzz(tm) Controller V1] on usb-0000:00:1d.0-1.1/input0
[ 811.582183] usb 2-1.1: USB disconnect, device number 5
[ 813.318275] usb 2-1.1: new low-speed USB device number 6 using ehci-pci
[ 813.416196] usb 2-1.1: New USB device found, idVendor=054c, idProduct=0002
[ 813.416207] usb 2-1.1: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 813.416213] usb 2-1.1: Product: Logitech Buzz(tm) Controller V1
[ 813.416218] usb 2-1.1: Manufacturer: Logitech
[ 813.422041] input: Logitech Logitech Buzz(tm) Controller V1 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:054C:0002.0002/input/input12
[ 813.422335] sony 0003:054C:0002.0002: input,hidraw0: USB HID v1.11 Joystick [Logitech Logitech Buzz(tm) Controller V1] on usb-0000:00:1d.0-1.1/input0
我发现可以使用 evtest 实用程序 (https://wiki.ubuntu.com/DebuggingTouchpadDetection/evtest) 读取它,但只能以 root 身份或使用 sudo 读取。
同样是 root 或 sudo,我在上述路径中看不到任何数据。
P.S。我可以通过 /sys/class/leds/
将控制数据推送到这些控制器中的灯这里的问题出在 tail
程序上,而不是输入设备本身。 tail
正在尝试读取数据,直到 "the end of the file" 才开始打印任何内容 -- 但是输入设备 没有 "end of the file",因此它永远不会打印任何事物。另一方面,cat
在数据进入时立即写出数据,因此可以正常工作。我不知道为什么 tail
过去使用其他输入设备为您工作。