[LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio)
#1
This guide is a step-by-step manual how to make work remote controls with USB HID profile such as remote control from Hama or Auvisio. Although these remote controls work out of the box even with mouse functionality not all buttons can be used to control XBMC. That's why I am using Lirc to get as maximum as possible from this remote.

This guide follows Lirc configuration on Ubuntu, but the approach can be generalized to other Linux distribution, where hardware.conf and init script is not used.

1) Install Lirc

If Lirc is not installed, please do so with following:

Code:
sudo apt-get install lirc

2) Prepare lircd.conf

USB HID remotes don't behave as Infra devices. Each button is identified as a key press. So in order to recognize the keys by Lirc, save this file http://linux.bytesex.org/v4l2/linux-inpu...lircd.conf under /etc/lirc/lircd.conf.

3) Find Phys address of your remote

Almost all guides for Lirc configure remote devices as a path /dev/input/eventX, where X can stand for any number. But I had a problem that event number changed after the restart of the computer and my remote stopped working. So we will use a different approach - Phys address. Defining Phys address will force Lirc to go through all input devices and find the correct one with matching Phys field.

Please note that USB HID remotes are using two input devices (keyboard, mouse).

Run this command and find your two USB HID devices (generally field NAME should contain HID and some numbers while other has some clever names assigned):

Quote:cat /proc/bus/input/devices

I: Bus=0003 Vendor=05a4 Product=9881 Version=0110
N: Name="HID 05a4:9881"
P: Phys=usb-0000:00:04.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:04.0/usb2/2-4/2-4:1.0/input/input3
U: Uniq=
H: Handlers=kbd event3
B: EV=120013
B: KEY=e080ffdf 1cfffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=05a4 Product=9881 Version=0110
N: Name="HID 05a4:9881"
P: Phys=usb-0000:00:04.0-4/input1
S: Sysfs=/devices/pci0000:00/0000:00:04.0/usb2/2-4/2-4:1.1/input/input4
U: Uniq=
H: Handlers=kbd mouse1 event4
B: EV=17
B: KEY=1f0000 0 2020000 3878 d801d001 1e0000 0 0 0
B: REL=103
B: MSC=10

What will we need is the Phys address: usb-0000:00:04.0-4/input0, usb-0000:00:04.0-4/input1.

4) Configure Hardware.conf
If you are running on Ubuntu and you have installed the standard Lirc package, you should have hardware.conf in /etc/lirc. All you need to do is to put the Phys address for both devices to REMOTE_DEVICE and TRANSMITTER_DEVICE. Keep the quotes as in the example below. Also configure fields TRANSMITTER_LIRCD_CONF and REMOTE_LIRCD_CONF to /etc/lirc/lircd.conf where you stored the downloaded mapping file.

Hardware.conf should look like this:
Quote:# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="None"
REMOTE_MODULES=""
REMOTE_DRIVER="devinput"
REMOTE_DEVICE="phys="usb-0000:00:04.0-4/input0""
REMOTE_LIRCD_CONF="/etc/lirc/lircd.conf"
REMOTE_LIRCD_ARGS=""

#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER="devinput"
TRANSMITTER_DEVICE="phys="usb-0000:00:04.0-4/input1""
TRANSMITTER_LIRCD_CONF="/etc/lirc/lircd.conf"
TRANSMITTER_LIRCD_ARGS=""

#Enable lircd
START_LIRCD="true"

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"

#Try to load appropriate kernel modules
LOAD_MODULES="true"

# Default configuration files for your hardware if any
LIRCMD_CONF=""

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
START_LIRCMD=""

5) Join two devices to one Lirc device

The problem is that XBMC by defaults listen on /dev/lircd for Lirc commands. But using two input device will create also another lirc device. So we have to join them together to one Lirc device. This is a simple task if you are starting the lirc daemon manually from the terminal, but that's not a usual way. Ubuntu starts Lirc automatically by script /etc/init.d/lirc. The easiest way I found so far is to modify two lines in the script to join both input devices. The disadvantage is that after Lirc package update the init script might be modified again.

Modify /etc/init.d/lirc at line 66 to
Quote:REMOTE_ARGS="$REMOTE_ARGS --output=/dev/lircd --listen"

and at line 88 to
Quote:TRANSMITTER_ARGS="$TRANSMITTER_ARGS --output=/dev/lircd --connect=localhost:8765 --pidfile=/var/run/lircd1.pid"

6) Restart Lirc and verify the functionality
Restart Lirc by executing this command:
Quote:sudo /etc/init.d/lirc restart

Then you can verify the functionality by running:
Quote:irw
And you should see the assigned names when you press a button on the remote control.

7) Configure Lircmap.xml for XBMC

Now you can map the names of the keys from 'irw' to XBMC as you like. For completeness sake I present my current configuration of Lircmap.xml:

Quote:<lircmap>
<remote device="linux-input-layer">
<power>SLEEP</power>
<start>HOMEPAGE</start>
<myTV>T</myTV>
<mymusic>M</mymusic>
<mypictures>I</mypictures>
<myvideo>E</myvideo>
<pause>PLAYPAUSE</pause>
<stop>STOPCD</stop>
<reverse>B</reverse>
<forward>F</forward>
<skipplus>NEXTSONG</skipplus>
<skipminus>PREVIOUSSONG</skipminus>
<record>R</record>
<back>BACKSPACE</back>
<info>BTN_RIGHT</info>
<left>LEFT</left>
<right>RIGHT</right>
<up>UP</up>
<down>DOWN</down>
<select>ENTER</select>
<title>BTN_MOUSE</title>
<volumeplus>VOLUMEUP</volumeplus>
<volumeminus>VOLUMEDOWN</volumeminus>
<mute>MUTE</mute>
<pageplus>PAGEUP</pageplus>
<pageminus>PAGEDOWN</pageminus>
<one>KP1</one>
<two>KP2</two>
<three>KP3</three>
<four>KP4</four>
<five>KP5</five>
<six>KP6</six>
<seven>KP7</seven>
<eight>KP8</eight>
<nine>KP9</nine>
<zero>KP0</zero>
<display>KPASTERISK</display>
<clear>ESC</clear>
</remote>
</lircmap>

Hopefully now you can enjoy controlling your HTPC with XBMC remotely from your couch.
Reply


Messages In This Thread
[LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio) - by keny - 2009-12-06, 21:09
[No subject] - by mighty_bombero - 2009-12-13, 23:11
[No subject] - by Tito - 2009-12-14, 14:03
[No subject] - by jbernardo - 2009-12-15, 11:07
[No subject] - by Tito - 2009-12-15, 21:49
[No subject] - by thajacabela - 2009-12-16, 00:40
[No subject] - by jbernardo - 2009-12-16, 07:57
[No subject] - by thajacabela - 2009-12-16, 14:19
[No subject] - by thajacabela - 2009-12-16, 20:02
[No subject] - by jbernardo - 2009-12-17, 07:53
[No subject] - by Tito - 2009-12-19, 02:48
[No subject] - by jbernardo - 2009-12-19, 10:48
[No subject] - by mighty_bombero - 2009-12-25, 22:21
[No subject] - by wonko - 2009-12-26, 04:20
[No subject] - by Redsandro - 2010-03-19, 18:47
[No subject] - by Bobby Blixberg - 2010-05-19, 22:48
conceptronic - by redman5087 - 2010-07-21, 23:28
[No subject] - by redman5087 - 2010-07-24, 15:48
irw - by redman5087 - 2010-07-25, 01:04
lounge - by redman5087 - 2010-07-26, 21:22
linux-input-layer - by redman5087 - 2010-07-27, 22:19
keyboard.xml - by redman5087 - 2010-08-01, 22:46
[No subject] - by WBFT - 2010-08-11, 14:36
[No subject] - by Gujs - 2010-12-05, 23:38
[No subject] - by Redsandro - 2011-01-28, 09:02
[No subject] - by jbernardo - 2011-01-28, 17:06
[No subject] - by Redsandro - 2011-01-28, 17:13
Different solution - by keny - 2011-01-29, 11:48
[No subject] - by Redsandro - 2011-01-29, 12:47
[No subject] - by jbernardo - 2011-01-29, 14:27
[No subject] - by Redsandro - 2011-01-29, 14:33
[No subject] - by jbernardo - 2011-01-29, 14:39
[No subject] - by Redsandro - 2011-01-29, 14:42
[No subject] - by ukasz - 2011-02-27, 11:49
[No subject] - by Eoghlear - 2011-03-02, 00:39
[No subject] - by ReyYesRey - 2011-09-19, 16:40
Logout Mark Read Team Forum Stats Members Help
[LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio)1