My name is Philipp C. Heckel and I write about nerdy things.

Restart LIRC if remote control is reconnected using a udev rule


  • Mar 24 / 2013
  • Comments Off on Restart LIRC if remote control is reconnected using a udev rule
Uncategorized

Restart LIRC if remote control is reconnected using a udev rule


I recently built myself a new HTPC. It’s controlled with a Medion X10 remote control using LIRC. For some reason, LIRC doesn’t realize when the USB dongle for my remote control is reconnected (unplug USB, plug it back in). This blog posts demonstrates how to easily fix this using a udev rule. I originally posted this on the XBMC forum.


Contents


1. Problem

When disconnecting the remote control USB dongle, LIRC removes the corresponding device. Unfortunately, it does not recognize when the device is reconnected to the computer. Only after LIRC is restarted with “/etc/init.d/lirc restart”, the remote works again. The syslog entry should look like this:

2. Quick and Dirty Fix

This fix simply restarts LIRC whenever the remote is (re-)connected. The software “udev” can be used to react on the USB dongle connection. Here’s how to do it:

2.1. Identify remote control

First, identify the identification numbers for your remote control. You can do that by looking for the device in /var/log/syslog. Simply look for a string like this (when USB dongle of remote is connected). Hit Ctrl+C to stop monitoring syslog.

2.2. Figure out idProduct and idVendor

Take the device listed in syslog, and check for idProduct and idVendor. These two numbers can then be used to create a rule in udev.

2.3. Create a udev rule for

The udev system allows creating rules that are interpreted when connecting/disconnecting devices. In this case, we’d like to create a rule to restart LIRC when the USB dongle of remote control is connected.

Create a file in /etc/udev/rules.d/ with the suffix “.rules” that contains the following line. Simply replace 0006 and 0bc7 with the idProduct/idVendor numbers you identified above.

Note that the contents of the file are just one line — so no line breaks.

3. That’s it

That’s it. If you reconnect, LIRC should be restarting.

It should now look like this:

Comments are closed.