[LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52) +---- Thread: [LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio) (/showthread.php?tid=63484) |
[LINUX] HOW-TO set up Lirc with USB HID remote controls (Hama, Auvisio) - keny - 2009-12-06 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-input-layer-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 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 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:irwAnd 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> Hopefully now you can enjoy controlling your HTPC with XBMC remotely from your couch. - mighty_bombero - 2009-12-13 Hi, thanks for the guide. Used it with Karmic XBMC Live and a hama 52451 remote. Had to move to /dev/input/eventX for remote_device and and transmitter_device but otherwise it was very helpful. mighty_bombero - Tito - 2009-12-14 It doesnt work here, when i change /etc/init.d/lirc the rulenumbers dont match. When i change the lines i think the needed, i get when is restart lirc and want to try with irw, connection refused. Mighty, how did you change your /etc/init.d/lirc ? thx - jbernardo - 2009-12-15 Hi Tito, For the latest versions of lirc in ubuntu, don't change /etc/init.d/lirc, instead change /etc/lirc/hardware.conf, and both for the "REMOTE_SOCKET" and "TRANSMITTER_SOCKET" put /dev/lircd between the "", this is what I put in mine: Code: # /etc/lirc/hardware.conf This seems to work, but I am still unable to get anything out of the "mouse" wheel with irw. Everything else seems to work now. - Tito - 2009-12-15 i get connection refused Code: # /etc/lirc/hardware.conf Code: irw Its get wrong when i put, /dev/lircd in the config. - thajacabela - 2009-12-16 you can try Code: irw /dev/lircd It works for me, but also there is no code for some remote keys like the mouse buttons, or the power one, or the next/previous chapter. - jbernardo - 2009-12-16 Well, "irw /dev/lircd" works, but as thejacabela wrote, the mouse and the power button don't return anything. My problem now is that even though irw shows it is working, XBMC ignores the remote. I tried changing the name of the device from "linux-input-layer" to "devinput" in Lircmap.xml, but it still isn't working. Lircmap.xml is supposed to be in ~/.xbmc/userdata, right? - thajacabela - 2009-12-16 I think problem is /etc/init.d/lirc because it add "1" to the TRANSMITTER_SOCKET, then there is not the same device and some buttons don´t work in the /dev/lircd (TRANSMITTER_SOCKET will be /dev/lircd1 ) Solution could be change /etc/init.d/lirc, what I've done: Line 83 (more or less), it said: Code: #Now, if we ALSO have a remote defined, add some args change with Code: #Now, if we ALSO have a remote defined, add some args Line 157 (more or less), it said Code: #now if we additionally have a transmitter defined, it is secondary process change with Code: #now if we additionally have a transmitter defined, it is secondary process Line 203 (more or less), it said Code: if [ "$START_LIRCD" = "true" ]; then change with Code: if [ "$START_LIRCD" = "true" ]; then I haven´t test it yet but I think it must work, I will test later if I've time. In the other hand, Keny solution (thanks a lot, Keny) must work "as is" without changing hardware.conf PD-sorry my english - thajacabela - 2009-12-16 I've tested and doesn´t work. But I've solved, in your /etc/init.d/lirc : Line 83 (more or less), it said: Code: #Now, if we ALSO have a remote defined, add some args change with Code: #Now, if we ALSO have a remote defined, add some args And don't change any more in the file. Restart lirc "/etc/init.d/lirc restart" (or reboot the machine) and try Code: irw /dev/lircd I can see codes for all remote buttons - jbernardo - 2009-12-17 For me it still doesn't work. If I change line 83 and 84 in /etc/lircd, commenting them both, then the lirc instance for the "transmitter" won't start: Code: $ sudo /etc/init.d/lirc restart If I only remove the "1" at the end of line 83, lirc will restart, but "irw /dev/lircd" won't show any keypresses for the mouse or the power button. Also, the remote gets ignored by XBMC, seems like it doesn't see the Lircmap.xml in .xbmc/userdata. EDIT: My Lircmap was corrupted. Now all I need to do is fix the detection of mouse and power button - Tito - 2009-12-19 The way i did is: change hardware.conf to this Quote:REMOTE="Linux input layer (/dev/input/eventX)" and change rule 158 of /etc/init.d/lirc to: Quote:rm -f ${OLD_SOCKET} && ln -s ${TRANSMITTER_SOCKET}1 ${OLD_SOCKET} this will create a symlink from /var/run/lirc/lircd1 to /dev/lircd where xbmc reads from. - jbernardo - 2009-12-19 I don't have a separate event for mouse and keyboard. I have a event and a mouse entry in /dev/input, and that is all. My problem is that I just can't get the mouse and power buttons to do anything meaningfull. If I try to record with irrecord, I get the same values for all mouse buttons. - mighty_bombero - 2009-12-25 Tito Wrote:It doesnt work here, when i change /etc/init.d/lirc the rulenumbers dont match. Hm, I changed the lines starting with REMOTE_ARGS and TRANSMITTER_ARGS as in the original tutorial (though line numbers differ on Karmic). Hope this still helps. - wonko - 2009-12-26 Hi, thanks for this guide. Helped me a lot along the way. The problem I have is that a push of a button on the remote triggers the designated command multiple times. This happens when using the original remote as well as with my Logitech Harmony remote.I experimented with various delay settings in the Logitech software to no avail. Is there a way to fix this ? Regards, Matthias. - Redsandro - 2010-03-19 jbernardo Wrote:Looks like we have the exact same remote (PCremote), so I copied your variation of lircd.conf. But no matter what, I keep getting this: Code: $ irw lircd is not running after /etc/init.d/lirc is started. It doesn't give any error either. I tried apt-get purge lirc and install it again. |