I have a kernel module that reads usb keyboard input specifically from /dev/input/event2 and /dev/input/event3.
On some devices the keyboard doesn't get assigned event2 and event3, it gets assigned /dev/input/event3 and /dev/input/event4 which of course causes the module to miss input.
I have pored over the udev rules and examples, but I cannot seem to find a way to force udev to assign a specific event# character device. I can get it to assign additional whatever else such as, /dev/input/mydevice, etc, but that doesn't help in this case. Is this possible?
As a further complication, the plugged in device isn't really a keyboard, it's a wireless presenter and it assigns a mouse to event2, the volume up/down button to event3, and the forward back buttons to event4. Like the following:
drwxr-xr-x 160 Apr 1 00:05 .
drwxr-xr-x 240 Apr 1 00:05 ..
*lrwxrwxrwxroot 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.0-event-mouse -> ../event2
lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.0-mouse -> ../mouse0
*lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.1-event-kbd -> ../event3
*lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.2-event-kbd -> ../event4
lrwxrwxrwx 9 Apr 1 00:00 platform-imx-i2c.0-platform-max77696-onkey.0-event -> ../event0
lrwxrwxrwx 9 Apr 1 00:00 platform-imx-i2c.1-event -> ../event1
And I need it to look like this:
drwxr-xr-x 160 Apr 1 00:05 .
drwxr-xr-x 240 Apr 1 00:05 ..
*lrwxrwxrwxroot 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.0-event-mouse -> ../event4
lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.0-mouse -> ../mouse0
*lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.1-event-kbd -> ../event3
*lrwxrwxrwx 9 Apr 1 00:05 platform-fsl-ehci.0-usb-0:1:1.2-event-kbd -> ../event2
lrwxrwxrwx 9 Apr 1 00:00 platform-imx-i2c.0-platform-max77696-onkey.0-event -> ../event0
lrwxrwxrwx 9 Apr 1 00:00 platform-imx-i2c.1-event -> ../event1
The value I think to need to change is the "KERNEL" value. Using udevadm info on the mouse device I get the following results.
[root@kin input]# udevadm info -a -p $(udevadm info -q path -n /dev/input/by-path/platform-fsl-ehci.0-usb-0\:1\:1.0-event-mouse)
looking at device '/devices/platform/fsl-ehci.0/usb1/1-1/1-1:1.0/input/input26/event2':
KERNEL=="event2"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/platform/fsl-ehci.0/usb1/1-1/1-1:1.0/input/input26':
KERNELS=="input26"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="Genius Wireless Mouse"
ATTRS{phys}=="usb-fsl-ehci.0-1/input0"
ATTRS{uniq}==""
ATTRS{modalias}=="input:b0003v0458p0189e0101-e0,1,2,4,k110,111,112,113,114,r0,1,6,8,am4,lsfw"
ATTRS{properties}=="0"
/dev. Instead, you create symlinks with known names to specific devices (like your kernel module), and then use the symlinks instead of/dev/input/event2etc. And no, it doesn't work the other way round (forcing specific numbers), even if you think it should.ddor a hexeditor to patch the kernel module to use some other paths instead, them create those paths as symlinks withudev.