You are not logged in.

#1 2019-01-02 02:37:51

chrabyrd
Member
Registered: 2018-10-09
Posts: 11

Simple udev RUN rule for ir-transceiver doesn't work

Hello all!

I have an ir-transceiver that I'm communicating with through ir-keytable, and for it to correctly recognize my remote keys, it needs to load a keymap. If I run:

sudo /bin/ir-keytable --clear --write /etc/rc_keymaps/samsung.toml

in-terminal, I get the correct output from `sudo ir-keytable -t` showing that keymap has been loaded:

Testing events. Please, press CTRL-C to abort.
179.465107: lirc protocol(nec): scancode = 0xd
179.465123: event type EV_MSC(0x04): scancode = 0x0d
179.465123: event type EV_KEY(0x01) key_down: KEY_RIGHT(0x006a)
179.465123: event type EV_SYN(0x00).

However, there doesn't seem to be any documentation on how to get these changes to persist across boots, so I've resorted to making a udev rule to run this command (I've also attempted making a systemd service but that didn't work unfortunately).

Here's the rule:

/etc/udev/rules.d/10-ir.rules

KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1934", ATTRS{idProduct}=="5168", SYMLINK+="ir-transceiver", RUN+="/bin/ir-keytable --clear --write /etc/rc_keymaps/samsung.toml"

and here's the output of

udevadm info -a -p $(udevadm info -q path -n /dev/lirc0)
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/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.0/rc/rc0/lirc0':
    KERNEL=="lirc0"
    SUBSYSTEM=="lirc"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.0/rc/rc0':
    KERNELS=="rc0"
    SUBSYSTEMS=="rc"
    DRIVERS==""
    ATTRS{protocols}=="rc-5 [nec] rc-6 jvc sony rc-5-sz sanyo sharp mce_kbd xmp imon [lirc]"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.0':
    KERNELS=="3-2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="mceusb"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{supports_autosuspend}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2':
    KERNELS=="3-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="16"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0001"
    ATTRS{bmAttributes}=="a0"
    ATTRS{busnum}=="3"
    ATTRS{configuration}==""
    ATTRS{devnum}=="2"
    ATTRS{devpath}=="2"
    ATTRS{devspec}=="          (null)"
    ATTRS{idProduct}=="5168"
    ATTRS{idVendor}=="1934"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="FINTEK"
    ATTRS{maxchild}=="0"
    ATTRS{product}=="eHome Infrared Transceiver"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="removable"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="88636562727801"
    ATTRS{speed}=="12"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="215"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3':
    KERNELS=="usb3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0420"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="3"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{devspec}=="          (null)"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 4.20.0-arch1-1-ARCH xhci-hcd"
    ATTRS{maxchild}=="4"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="0000:0d:00.3"
    ATTRS{speed}=="480"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="28"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:0d:00.3':
    KERNELS=="0000:0d:00.3"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{ari_enabled}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0330"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{current_link_speed}=="8 GT/s"
    ATTRS{current_link_width}=="16"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x15e0"
    ATTRS{devspec}==""
    ATTRS{dma_mask_bits}=="64"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="54"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{local_cpus}=="00ff"
    ATTRS{max_link_speed}=="8 GT/s"
    ATTRS{max_link_width}=="16"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x00"
    ATTRS{subsystem_device}=="0x876b"
    ATTRS{subsystem_vendor}=="0x1043"
    ATTRS{vendor}=="0x1022"

  looking at parent device '/devices/pci0000:00/0000:00:08.1':
    KERNELS=="0000:00:08.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{ari_enabled}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{current_link_speed}=="8 GT/s"
    ATTRS{current_link_width}=="16"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x15db"
    ATTRS{devspec}==""
    ATTRS{dma_mask_bits}=="32"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="2"
    ATTRS{irq}=="24"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{local_cpus}=="00ff"
    ATTRS{max_link_speed}=="8 GT/s"
    ATTRS{max_link_width}=="16"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x00"
    ATTRS{secondary_bus_number}=="13"
    ATTRS{subordinate_bus_number}=="13"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{subsystem_vendor}=="0x1022"
    ATTRS{vendor}=="0x1022"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Unfortunately, on restart it appears the keymap has not been loaded. Here's the output of `sudo ir-keytable -t` without having run that command in-terminal:

Testing events. Please, press CTRL-C to abort.
18.677001: lirc protocol(nec): scancode = 0xd
18.677013: event type EV_MSC(0x04): scancode = 0x0d
18.677013: event type EV_SYN(0x00).

Notice the absence of `key_down: KEY_RIGHT(0x006a)`. Any point in the right direction on how to get this working is much appreciated!

Offline

#2 2019-01-02 02:53:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,464
Website

Re: Simple udev RUN rule for ir-transceiver doesn't work

chrabyrd wrote:

so I've resorted to making a udev rule to run this command (I've also attempted making a systemd service but that didn't work unfortunately)

If you want it to run on every boot, a systemd service would be the way to go.  Why did that not work?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

#3 2019-01-02 04:02:54

chrabyrd
Member
Registered: 2018-10-09
Posts: 11

Re: Simple udev RUN rule for ir-transceiver doesn't work

No idea, it runs successfully but the output of `sudo ir-keytable -t` still doesn't show the keymap. Here's the service:

/etc/systemd/system/ir-reset.service
[Unit]
Description=Set ir-keytable to correct values

[Service]
Type=oneshot
ExecStart=/bin/ir-keytable --clear --write /etc/rc_keymaps/samsung.toml

[Install]
WantedBy=multi-user.target

and the output of `systemctl status ir-reset`:

● ir-reset.service - Set ir-keytable to correct values
   Loaded: loaded (/etc/systemd/system/ir-reset.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Tue 2019-01-01 20:01:40 PST; 2min 51s ago
  Process: 493 ExecStart=/bin/ir-keytable --clear --write /etc/rc_keymaps/samsung.toml (code=exited, status=0/SUCCESS)
 Main PID: 493 (code=exited, status=0/SUCCESS)

Jan 01 20:01:40 homebox systemd[1]: Starting Set ir-keytable to correct values...
Jan 01 20:01:40 homebox ir-keytable[493]: Old keytable cleared
Jan 01 20:01:40 homebox ir-keytable[493]: Wrote 5 keycode(s) to driver
Jan 01 20:01:40 homebox ir-keytable[493]: Protocols changed to nec
Jan 01 20:01:40 homebox systemd[1]: Started Set ir-keytable to correct values.

Offline

Board footer

Powered by FluxBB