Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have found an old infrared remote controller with the receptor connected as USB. I connect it into my Linux box (Mint LMDE kernel 3.2.0-4-amd64). It's recognized with lsusb as "Zydacron HID Remote Control".

It works ... almost ... I can change the volume, start/stop the media player, choose the track in the playlist.

But some key seems to not react (not configured).

  • How can configure all the keys?
  • Should I install "lirc"?
share|improve this question

2 Answers 2

up vote 1 down vote accepted

So I have to come back on this because I found a "better" solution (IMHO) without LIRC !

As I said, the first time I connected the USB receiver, almost all buttons on the remote was working, without any other software nor any configuration.

On different advice (not only here), I installed LIRC and plugins I found for the software I use the most often.

After some difficulties, I configured LIRC in the sense that the computer was receiving scancode and they was translated. After this, I started "Totem" and activate the LIRC plugin ... and nothing work anymore !!! :-( even not the key which was working before

Same thing with Banshee or VLC !

However, when I closed the application or disable the LIRC plugin, my key works again and I can set the volume, start, stop and pause any mp3 or video ...etc.

As I understood, making the remote being recognized by LIRC isn't enough, I had to write a configuration file for each and every program I would like to use ... even for keys which was working without LIRC. Sound crazy ... without talking about the fact that finding accepted LIRC actions by every plugin seems rather difficult and some software (like Banshee by example) don't offer more possibilities than those I already had without LIRC (even less).


So I searched ...

First find, since kernel 2.6.36, the drivers of LIRC are integrated. This is the reason why, when I configured LIRC, I had to use "devinput" driver.

Since this version, all remote control are recognized as external keyboard ! This explain also why most of the keys was working out of the box. So, as it's a keyboard, what we have to do is to "remap" the non working key on another code/action. This is how:

Start by doing an "lsusb" and identify your remote controller:

Bus 006 Device 002: ID 13ec:0006 Zydacron HID Remote Control 

You must write down the ID 13ec:0006 , it will be useful.

Now display the content of /dev/input/by-id in long format.

ls -l /dev/input/by-id/
lrwxrwxrwx 1 root root 10 Apr 15 19:27 usb-13ec_0006-event-kbd -> ../event10 

You find the correct line thanks to the ID and then the event associated to it! Now, with this information, we will try to read from the remote

sudo /lib/udev/keymap -i input/event10

When you press a key on the remote, you should see the scan code and the currently associated keycode:

scan code: 0xC00CD   key code: playpause
scan code: 0x70028   key code: enter
scan code: 0x7002A   key code: backspace
scan code: 0x7001E   key code: 1
scan code: 0x70022   key code: 5

Beware some key may return a keycode but this keycode may not be recognized by your window manager (Gnome3 in my case). Or the keycode isn't correct. In my case, I had to remap the key number to keypad (Belgium keyboard) and the special key (audio, video, DVD, ...) to some unused function key.

Now we will write our keymap file. You can use any name, in my case, I name it 'zydacron'

sudo vi /lib/udev/keymaps/zydacron

There is already several files in this folder. The format is very simple:

<scan code> <keycode> <# comment eventually>

example :

0x70027 kp0
0x7001E kp1
0x7001F kp2
0xC0047 f13 # music
0xC0049 f14 # photo
0xC004A f15 # video
0xC00CD playpause # Play/Pause

You can put only key which need to be remapped ! You will find on this page the official list of all key code. Again, it doesn't means that every key code on this list is supported by your window manager, you will have to test to be sure.

When the file is done, we can test it with :

sudo /lib/udev/keymap input/event10 /lib/udev/keymaps/zydacron

If something doesn't work, you will have to try another keycode. And then redo the mapping.

When everything works as you expect, we will make it permanent. Edit the file /lib/udev/rules.d/95-keymap.rules

sudo vi /lib/udev/rules.d/95-keymap.rules

In the file after LABEL="keyboard_usbcheck" but before GOTO="keyboard_end" add the following line:

ENV{ID_VENDOR_ID}=="13ec", ENV{ID_MODEL_ID}=="0006", RUN+="keymap $name zydacron" 

You can recognize the vendor id and model id as the 2 parts of the ID found with lsusb, and also the name of my file.Adapt it to your own values.

Restart the udev process:

sudo service udev restart

(or reboot your computer) , And you are done.

Now each time, you plug your receiver, no matter on which USB port nor the event number given by the system, the mapping will be done automatically

Little tip :I mapped one key as "tab" and another as "F10", very useful in Banshee, to "jump" across sub-window and to open the main menu.

Hope it help

share|improve this answer

I would definitely installed lirc. You can go through the list of supported remotes here. If your remote isn't directly supported all is not lost.

If you can't find your remote control here it does not mean that your remote control is not supported but there is no config file for it yet. All remote controls that are supported by learning remote controls, i.e. almost any, should also work with LIRC. Please send me your config file if you add a new remote control.

I've done this before as well, most remotes will work with lirc. You'll just have to tweak a config file so that all the keys work as they should. It's pretty straightforward, look through the Howtos for more info.

share|improve this answer
    
Well "straightforward" isn't the term I should use :-). I had a lot of trouble just to make lircd to detect my remote. Even "sudo dpkg-reconfigure lirc" produce nothing. Finally,by trying and guessing,I found that my remote was know as /dev/input/event10 and the driver to use was "devinput", so I downloaded a generic config file here lirc.org/remotes/devinput and with the help of "od -x /dev/input/event10" and this web page johntellsall.blogspot.be/2010/03/… ,I have something working. Still some tweak to be done,but it's a good start –  ericc Apr 10 '13 at 19:27
    
Did this not end up working out for you? I just noticed that you unaccepted this answer. –  slm Apr 16 '13 at 16:42
    
I wasn't really pleased by the way LIRC is working, And I was convinced that an other way was possible so I spent 5 days (well 5 evenings) searching on Google an trying a lot of different thinks, and finally I found a way which seems better (at least for me) –  ericc Apr 16 '13 at 18:25
    
Not a problem, glad you found a solution to your problem. Between our two answers I think we have everything covered now 8-). –  slm Apr 16 '13 at 20:03
    
Point is that LIRC is still installed and configured. If for any reason I need a different mapping for a specific application (assuming that this application provide enough keymap for LIRC) I can still write a LIRC configuration for it and activate the plugin. I have in mind XBMC by example –  ericc Apr 16 '13 at 20:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.