User:Ned Scott/Sandbox: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
First you have to create an own udev rule to ensure, that your device nodes are always the same.
Now we write a new rules file for udev:


We get the vendor id and the product id from ''/proc/bus/input/devices'':
nano /etc/udev/rules.d/10-irremote.rules


cat /proc/bus/input/devices
and put the following content in:
<pre>
SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:68",SYMLINK="input/irremote0"
SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:69",SYMLINK="input/irremote1"
</pre>
 
'''Note the numbers for ''idVendor'' and ''idProduct'' are the numbers we got from /proc/bus/input/devices.'''


the output is something like this:
Alternatively, you can avoid relying on specific minor numbers with:
<pre>
<pre>
...
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",IMPORT{program}="input_id %p"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_KEYBOARD}=="1",SYMLINK="input/irremote0"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_MOUSE}=="1",SYMLINK="input/irremote1"
</pre>
 
Note that without the KERNEL match irremote1 is attached to a device sometimes which seems to be an inappropriate ioctl device (no event but only mouse).
 
Now restart udev and trigger a new discovery:
 
restart udev #notice for Gentoo: rc-service udev restart
udevadm trigger


I: Bus=0003 Vendor=05a4 Product=9881 Version=0110
(Restarting udev is optional at least as of Ubuntu lucid, and likely others.)
N: Name="HID 05a4:9881"
P: Phys=usb-0000:00:06.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:06.0/usb4/4-1/4-1:1.0/input/input4
U: Uniq=
H: Handlers=kbd event4
B: EV=120013
B: KEY=e080ffdf01cfffff fffffffffffffffe
B: MSC=10
B: LED=7


I: Bus=0003 Vendor=05a4 Product=9881 Version=0110
Under /dev/input should now be two more symlinks: irremote0 and irremote1:
N: Name="HID 05a4:9881"
P: Phys=usb-0000:00:06.0-1/input1
S: Sysfs=/devices/pci0000:00/0000:00:06.0/usb4/4-1/4-1:1.1/input/input5
U: Uniq=
H: Handlers=kbd mouse1 event5
B: EV=17
B: KEY=1f0000 2020000 3878d801d001 1e000000000000 0
B: REL=103
B: MSC=10


...
ls /dev/input
</pre>

Revision as of 23:33, 29 April 2016

Now we write a new rules file for udev:

nano /etc/udev/rules.d/10-irremote.rules

and put the following content in:

SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:68",SYMLINK="input/irremote0"
SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ATTR{dev}=="13:69",SYMLINK="input/irremote1"

Note the numbers for idVendor and idProduct are the numbers we got from /proc/bus/input/devices.

Alternatively, you can avoid relying on specific minor numbers with:

KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",IMPORT{program}="input_id %p"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_KEYBOARD}=="1",SYMLINK="input/irremote0"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_MOUSE}=="1",SYMLINK="input/irremote1"

Note that without the KERNEL match irremote1 is attached to a device sometimes which seems to be an inappropriate ioctl device (no event but only mouse).

Now restart udev and trigger a new discovery:

restart udev #notice for Gentoo: rc-service udev restart
udevadm trigger

(Restarting udev is optional at least as of Ubuntu lucid, and likely others.)

Under /dev/input should now be two more symlinks: irremote0 and irremote1:

ls /dev/input