User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Feature request: Entries in /dev/input/by-id

Mon Sep 14, 2015 8:54 pm

Can appropriate links be added to /dev/input/by-id for the touch screen device please ?

These entries are useful for finding a particular device by name, for example on my desk top machine:

Code: Select all

petero@HP /dev/input/by-id $ ls -l 
total 0
lrwxrwxrwx 1 root root 9 Sep 14 19:03 usb-CHICONY_HP_USB_Multimedia_Keyboard-event-if01 -> ../event3
lrwxrwxrwx 1 root root 9 Sep 14 19:03 usb-CHICONY_HP_USB_Multimedia_Keyboard-event-kbd -> ../event2
lrwxrwxrwx 1 root root 9 Sep 14 19:03 usb-Logitech_USB_Trackball-event-mouse -> ../event4
lrwxrwxrwx 1 root root 9 Sep 14 19:03 usb-Logitech_USB_Trackball-mouse -> ../mouse0
petero@HP /dev/input/by-id $ 
As you can see this means you can find the correct "event" or "mouse" entry to use to pick up events from a particualr device when more that one is present.

Currently on my PI I have entries in /dev/input for a USB keyboard, a USB tracker ball and the touch screen, but no matching entry in /dev/input/by-id for the touch screen.

Code: Select all

pi@raspberrypi /dev/input $ ls -l
total 0
drwxr-xr-x 2 root root     120 Sep 14 21:46 by-id
drwxr-xr-x 2 root root     120 Sep 14 21:46 by-path
crw-rw---T 1 root input 13, 64 Jan  1  1970 event0
crw-rw---T 1 root input 13, 65 Jan  1  1970 event1
crw-rw---T 1 root input 13, 66 Jan  1  1970 event2
crw-rw---T 1 root input 13, 67 Sep 14 21:46 event3
crw-rw---T 1 root input 13, 63 Jan  1  1970 mice
crw-rw---T 1 root input 13, 32 Jan  1  1970 mouse0
crw-rw---T 1 root input 13, 33 Sep 14 21:46 mouse1
pi@raspberrypi /dev/input $ cd by-id
pi@raspberrypi /dev/input/by-id $ ls -l
total 0
lrwxrwxrwx 1 root root 9 Jan  1  1970 usb-04f3_0103-event-if01 -> ../event1
lrwxrwxrwx 1 root root 9 Jan  1  1970 usb-04f3_0103-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Sep 14 21:46 usb-Logitech_USB_Trackball-event-mouse -> ../event3
lrwxrwxrwx 1 root root 9 Sep 14 21:46 usb-Logitech_USB_Trackball-mouse -> ../mouse1
pi@raspberrypi /dev/input/by-id $ 
THese are useful when developing openGL ES code that needs to get user input from a mouse,keyboard or touch screen :-)
I'm not sure where these entries get created.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: Feature request: Entries in /dev/input/by-id

Tue Sep 15, 2015 12:03 pm

A quick look google has shown me that this is a "udev rules" issue, and in fact it looks like suitable rules should already exist but I'll have to wait until I'm in front of a PI to check if they are present on the PI.
This looks helpful too : http://arakilab.media.eng.hokudai.ac.jp ... n-example/
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: Feature request: Entries in /dev/input/by-id

Sat Sep 26, 2015 2:41 pm

Code: Select all

pi@raspberrypi ~ $ udevadm info -a -p /devices/virtual/input/input2/event2

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/input/input2/event2':
    KERNEL=="event2"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/virtual/input/input2':
    KERNELS=="input2"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="FT5406 memory based driver"
    ATTRS{phys}==""
    ATTRS{uniq}==""
    ATTRS{properties}=="2"
Based on the above information, I'm not sure what a symlink for the touchscreen in /dev/input/by-id should be called.
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: Feature request: Entries in /dev/input/by-id

Fri Mar 04, 2016 1:16 pm

Having just been bitten by this problem again while getting demos ready for the PiParty this weekend I though I'd post the solution :D

Code: Select all

pi@2PiBP1 /etc/udev/rules.d $ cat 95-touch.rules 
SUBSYSTEM=="input", ATTRS{name}=="FT5406 memory based driver", ENV{DEVNAME}=="*event*", SYMLINK+="input/by-id/FT5406-events-touch" 
pi@2PiBP1 /etc/udev/rules.d $ 
pi@2PiBP1 /etc/udev/rules.d $ ls -l /dev/input/by-id
total 0
lrwxrwxrwx 1 root root 9 Mar  4 13:10 FT5406-events-touch -> ../event2
lrwxrwxrwx 1 root root 9 Mar  4 13:10 usb-CHICONY_HP_USB_Multimedia_Keyboard-event-if01 -> ../event1
lrwxrwxrwx 1 root root 9 Mar  4 13:10 usb-CHICONY_HP_USB_Multimedia_Keyboard-event-kbd -> ../event0
pi@2PiBP1 /etc/udev/rules.d $ 
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Official Foundation Display”