开发者

Reading USB input stream on linux

I'm working on an embedded linux machine and trying to read a USB devices input stream, but for some reason I don't have any such thing in my /dev directory. I would assume it would be something like /dev/ttyUSB01 or /dev/input/usb or something similar, but it's not there. dmesg returns the following

[ 195.8开发者_如何学Python63911] input: GIT GIT USB READER as /class/input/input2
[ 195.864259] generic-usb 0003:1234:5678.0001: input: USB HID v1.00 Keyboard [GIT GIT USB READER] on usb-0000:00:0f.4-1/input0

I've scanned through /sys/class/input/input2 and I am not really sure what I'm looking for. Maybe someone could point me in the right direction?


Had the same problem a few days ago and we discovered this workaround.

You could do the following command at the terminal:

cat /proc/bus/input/devices

This will list your devices connected, and your devices should be on the list. For instance, one item on there appears this way for me:

I: Bus=0011 Vendor=0002 Product=000a Version=0000
N: Name="TPPS/2 IBM TrackPoint"
P: Phys=synaptics-pt/serio0/input0
S: Sysfs=/devices/platform/i8042/serio4/serio5/input/input15
U: Uniq=
H: Handlers=mouse1 event15 
B: PROP=0
B: EV=7
B: KEY=70000 0 0 0 0
B: REL=3

Under Handlers, you'll notice that event15 shows up. You can access the data stream by referencing /dev/input/event15 in my case. You'll have to figure out what it is in your case


Check out /dev/input/by-path and look for your usb-0000:00:0f.4-1. On my Ubuntu box that's a symbolic link to the device.


Have you tried using mdev? It's a lightweight alternative to udev and it populates /dev. If hotplugging is not enabled you might need to run it manually.

To scan /sys and create devices, try:

mdev -s
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜