/dev/input文件已创建,但不包含数据流 [英] /dev/input file created, but contains no data stream

查看:170
本文介绍了/dev/input文件已创建,但不包含数据流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试在全新安装的Linux Mint中读取USB设备.

So, I'm trying to read a USB device in a brand new installation of Linux Mint.

我之前做过的方法是读取在/dev/input/by-id中找到的原始流

The way I've done it before is to read the raw stream found in /dev/input/by-id

正在检测到该设备,并且正在生产预期的设备:

The device is being detected, and it is producing the expected device:

$ 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尝试过,我尝试过更改文件的权限.它基本上会在原地等待,保持不变.

No data is output to the terminal when I press some keys. I've tried it with sudo, I've tried changing the rights for the file. It basically waits where it is, unchanged.

关于设备未出现或读取文件时出现IO错误,存在很多问题,但是我找不到其他遇到相同问题的人.

There's a lot of questions about devices not appearing, or about IO errors when reading a file, but I can't find anyone else who's had the same problem.

为什么Linux Mint会检测到该设备,而不从中读取数据?

Why might Linux Mint be detecting the device, but not reading the data from it?

其他要求的信息:

# 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.结果相同.

I tried tail -f on /dev/input/event10, too. Same result.

另外,dmesg的最后几行

Also, the last few lines of 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.


I have found that it can be read using the evtest utility (https://wiki.ubuntu.com/DebuggingTouchpadDetection/evtest), but only as root, or using sudo.

我也不能以root或sudo的身份在上述路径中看到任何数据.

Also as root or sudo, I am unable to see any data in the path mentioned above.

P.S.我可以通过/sys/class/leds/

P.S. I am able to push control data to the lamps in these controllers via /sys/class/leds/

推荐答案

这里的问题出在tail程序上,而不是输入设备本身上. tail尝试读取数据直到文件结尾",然后才开始打印任何内容-但输入设备没有文件结尾",因此它将永远不会打印任何内容.另一方面,cat会在输入数据后立即将其写出,这样可以正常工作.我不知道为什么tail过去曾与其他输入设备一起为您工作.

The problem here is with the tail program, not with the input devices themselves. tail is trying to read data until "the end of the file" before it starts printing anything -- but an input device has no "end of the file", so it will never print anything. cat, on the other hand, writes out data immediately as it comes in, so that works correctly. I don't know why tail worked for you with other input devices in the past.

这篇关于/dev/input文件已创建,但不包含数据流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆