Forum

Full Version: [Howto] mceusb driver with lirc protocol instead of rc-6/devinput
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I'm brand new to XBian - really good work, guys. I migrated XBMC from my zaphod headed main box to a RPi (in order to get rid of the HDMI cable across the living room doorstep)

One thing that bugged me on the main box already back when I set it up was the fact that the LIRC devinput driver caused some laggyness with my mceusb receiver.

Hardware used:
- USB Formosa21 eHome Infrared Transceiver
- Logitech Harmony 650

Symptoms with devinput:
- first button press is ignored very often when the remote hasn't been used for some minutes/hours
- huge lags on key repeats every now and then

Solution:
Use mceusb driver with the lirc protocol instead of rc-6 via the input event layer.

This also fixes (see comments below):
- Microsoft MCE 1039 remote unmapped keys

These are the steps needed:

1. Edit /etc/lirc/hardware/custom.conf (this gets sourced by the main hardware.conf and takes precedence if at least one of the variables in there is uncommented and not empty)
Code:
#DRIVER="" # do _not_ set devinput here
DEVICE="/dev/lirc0"
MODULES="lirc_dev mceusb ir_lirc_codec"

echo lirc > /sys/class/rc/rc0/protocols

2. Edit /etc/lirc/lircd.conf and add at the top:
Code:
include "/etc/lirc/remotes/mceusb.conf"

3. Restart lirc and xbmc
Terminal
# service lirc restart
# service xbmc restart

Took me about an hour to find out how this needs to be set up in XBian. Dead simple, actually.
My remote feels a lot snappier now.

Hope it helps others with USB MCE receivers, too.
Thank you!

After quite a bit of searching, this is exactly what I needed to get my Microsoft MCE 1039 remote to work with Xbian. There were a few other posts on the forums about this particular remote, but not many clear solutions (though this post looks equivalent).

It worked OOTB with Xbmcbuntu, so I assumed it would here too. Although the key mapping is a little different (I may still look into modifying it), it now works flawlessly! Until now only arrows and enter worked.
Glad it helped you!

The keymapping was a little different here too, compared to my Arch main box. But as I was using a custom Lircmap.xml anyway, I just copied it over and edited the few changed keys in there. Another way would be to copy over the lircd.conf file from your Xbmcbuntu install to /etc/lirc/remotes/ under a new name, and either include it in the main lircd.conf or specify it in hardware/custom.conf.

Oh, and I realized that this setup somehow doesn't survive a reboot, so I have to restart lirc and xbmc services manually after boot. But I have no idea why that happens.
@teekay

so you mean XBMC starts faster than LIRC?
@mk01: no, it's more like: lircd does start, but the hardware/custom.conf isn't sourced from main hardware.conf at boot.
/sys/class/rc/rc0/protocols shows rc-6 as active, and the lircd process has --driver=devinput.

Manually restarting lirc afterwards works fine.
so maybe ir-keytable taking care ?

put the keytable module into blacklist.

ir-keytable will show you which module it is. then edit any file in /etc/modprobe.d/ having line "blacklist my_rc_6_module"
Not sure I'm quite following. The ir-keytable command returns:
Terminal
xbian@xbian ~ $ ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event0) with:
Driver mceusb, table rc-rc6-mce
Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
Enabled protocols: RC-6
Repeat delay = 500 ms, repeat period = 125 ms

I tried adding "blacklist mceusb" to /etc/modprobe.d/xbian.conf then rebooting and now the remote doesn't work at all
Terminal
xbian@xbian ~ $ ir-keytable
/sys/class/rc/: No such file or directory

I also tried blacklisting rc-rc6-mce without any effect. What exactly is the module to blacklist?
Blacklisting anything codec/decoder whise but ir_lirc_codec does the trick here. Thanks @mk01.

@sievo: don't blacklist the mceusb driver, as that is the main driver for the device. Just blacklist all the ir_rc*_decoder etc like:
Code:
# cat /etc/modprobe.d/lirc.conf
blacklist ir_mce_kbd_decoder
blacklist ir_sony_decoder
blacklist ir_nec_decoder
blacklist ir_jvc_decoder
blacklist ir_sanyo_decoder
blacklist ir_rc5_decoder
blacklist ir_rc6_decoder
blacklist rc_rc6_mce
@teekay

ok, as we have a solution, would you be so kind and create new post, small how-to with short step-by-step summary of all this being told?

I will make the post sticky and lock.

would you?

thanks!
I'm not sure yet if the solution is valid. I rebootet the box a few times, and it seems that blacklisting sometimes works, sometimes not.
I mean all ir protocol/codec modules are loaded despite the blacklist config. No idea were to look at in te module-init tools/upstart corner.

What seems to be working constantly is moving the
Code:
echo lirc > /sys/class/rc/rc0/protocols
to /etc/rc.local

Maybe someone could confirm this before we turn it into a locked sticky thread. Also, wouldn't the wiki be a better place for something like this?
look also at

/etc/rc_maps.cfg

it is association list - so if a module X is loaded - keymaps are loaded automaticaly.
(and this is not happening via modprobe but ir-keytable). you have to disable module or delete mapping.
Same issue here. Some keys on the remote work, some don't and some take multiple presses before something happens. (HP MediaCenter IR receiver with generic MCE remote) It stopped working somewhere in the process of upgrading from Beta 2 to RC1 and all updates after. No idea when. Followed most items in this thread to fix it but with a couple of changes:

This did nothing for me:
Code:
# cat /etc/modprobe.d/lirc.conf
blacklist ir_mce_kbd_decoder
blacklist ir_sony_decoder
blacklist ir_nec_decoder
blacklist ir_jvc_decoder
blacklist ir_sanyo_decoder
blacklist ir_rc5_decoder
blacklist ir_rc6_decoder
blacklist rc_rc6_mce

This did nothing for me (in rc.local)
Code:
echo lirc > /sys/class/rc/rc0/protocols

This worked for me (add to /etc/udev/rules.d/99-input.rules. Adapted from http://forum.xbmc.org/showthread.php?tid=141868 )
Code:
ACTION=="add|change", SUBSYSTEM=="rc", RUN+="/usr/bin/ir-keytable -s $name -c -p LIRC"

JJ
@_JJ_

so using kernel mapper to emulate LIRC interface on IR receiver and then use of default lirc service ?
Thanks, with the guide from post#1 I got my MCE remote working.

I still these Problems are left:
- After every reboot the remote receiver is not available (and echo lirc > /sys/class/rc/rc0/protocols fails because /sys/class/rc/rc0/protocols doesn't exists) - I have to unplug and replug the USB on my PI after every boot to make the ir being recognized

- I have to enter the echo ... command manually after I replugged the IR Receiver - rc-6 is set as default every time
How can i set lirc as default service for ir? or How to automatically execute the echo when IR is connected?

- "ir-keytable -t" isn't showing any events regardless if lirc or rc-6 is selected.
ir-keytable output shows that remote is recognized:
Code:
$ ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event0) with:
    Driver mceusb, table rc-rc6-mce
    Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
    Enabled protocols: LIRC
    Repeat delay = 500 ms, repeat period = 125 ms
I have been struggling with this for several days as well.

Firstly I have very limited Linux knowledge so I not sure exactly what is going on. Confused

I do not have a usb receiver but I have a TSOP34838 receiver wired to the GPIO pins of the Raspberry Pi. To get that to work I first had to add lirc_rpi gpio_in_pin=18 to “/etc/modules”

Then I followed the opening post. This made my remote work. However it stopped working after a reboot.
Then I edited “/etc/default/xbmc” and added WAITFOR="lircd"
Now after a reboot it survives. (I have rebooted several times today)
As mentioned I have limited Linux experience so I cannot tell you exactly what I did. I think xbmc now waits until lirc is started before it continues to start???

Also when I do not use the: echo lirc > /sys/class/rc/rc0/protocols line, it still works fine for me.
Pages: 1 2
Reference URL's