[mythtv-users] Calling all lirc gurus

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Dec 23 04:51:32 UTC 2018

On Sun, 23 Dec 2018 03:15:41 +0000, you wrote:

>Hi All,
>	I just upgraded my mythbuntu system from 16.04.5 to 18.04 and it was impressively smooth.
>	However, I have two issues with my lirc setup, after reading a lot of misinformation about 
>	removing lirc, I discovered that the lirc config files changed format radically and just needed
>	some manual rewriting.
>	I followed the instructions at lirc.org, as best I could, to update the appropriate files. 
>	BTW I'm running version 0.10.0[1207] of lirc (the standard one that came with 18.04).
>	I now have a working remote (again) with these two annoyances:
>		1) After booting up the first key pressed on the remote repeats endlessly.
>		2) The KEY_SLEEP key on the remote is somehow causing the system to sleep.
>	Problem 1) is cured, temporarily, by hitting any key on the keyboard and after that the remote works 
>	perfectly aside from problem 2).
>	Problem 2) In my 16.04.5 setup hitting KEY_SLEEP on my remote called the irexec 
>	daemon which was configured to run a script using home-assistant. I don't 
>	ever want the system to actually sleep. I want to use the remote's KEY_SLEEP key 
>	to talk to irrexec. Any ideas what is causing the KEY_SLEEP to get past irexec?
>	Even after reading and googling every recent article as well as the explanations on the wiki;
>	I find myself just as confused as when I started.
>	I'm pretty sure my mceusb device is being treated as an IR remote rather than an actual keyboard
>	but maybe the remote's power key is special. I'm not sure. All I know is everything was perfect
>	under 16.04.5.
>	Also, when the looping problem occurs, I see spurious X events when I run xev. In this
>	example, of me pressing the up arrow key on the remote. The following loops over and 
>	over. I don't understand why X is even seeing this the event should go to lirc and, then,
>	the application (mythfrontend):
>KeyPress event, serial 37, synthetic NO, window 0x4400001,
>    root 0x1e1, subw 0x0, time 1321786, (89,64), root:(960,540),
>    state 0x0, keycode 111 (keysym 0xff52, Up), same_screen YES,
>    XLookupString gives 0 bytes:
>    XmbLookupString gives 0 bytes:
>    XFilterEvent returns: False
>	As soon as I hit a key on my Logitech K400 keyboard, the looping 
>	immediately  stops and I see the single space key event from the 
>	keyboard:
>KeyRelease event, serial 38, synthetic NO, window 0x4400001,
>    root 0x1e1, subw 0x0, time 1764624, (89,64), root:(960,540),
>    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
>    XLookupString gives 1 bytes: (20) " "
>    XFilterEvent returns: False
>	Interestingly, from this point onwards xev sees no more remote key presses.
>	I had thought that since I've told lirc to use the devinput driver that no
>	key events from the remote should reach X. I thought they would be
>	the responsibility of lirc. 
>$ xinput
>? Virtual core pointer                          id=2    [master pointer  (3)]
>?   ? Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
>?   ? Logitech K400                             id=10   [slave  pointer  (2)]
>?   ? lircd-uinput                              id=11   [slave  pointer  (2)]
>? Virtual core keyboard                         id=3    [master keyboard (2)]
>    ? Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
>    ? Power Button                              id=6    [slave  keyboard (3)]
>    ? Power Button                              id=7    [slave  keyboard (3)]
>    ? C-Media Electronics Inc.       USB PnP Sound Device       id=8    [slave  keyboard (3)]
>    ? Media Center Ed. eHome Infrared Remote Transceiver (0471:060c)    id=9    [slave  keyboard (3)]
>    ? Logitech K400                             id=12   [slave  keyboard (3)]
>    ? lircd-uinput                              id=13   [slave  keyboard (3)]
>	I've created a git repository containing my lirc config files just in case anyone
>	can help solve 1) the repeating problem and 2) how to disable the remote's
>	sending of KEY_SLEEP. I'll try to put as much detail up there as I can. Just ask
>	and I can upload more details:
>	irw captures the remote key events as expected:
>$ irw
>0001006700000001 00 KEY_UP devinput-64
>0001006c00000001 00 KEY_DOWN devinput-64
>	And ir-keytable looks like it is seeing the correct device:
>$ ir-keytable
>Found /sys/class/rc/rc0/ (/dev/input/event4) with:
>        Name: Media Center Ed. eHome Infrared Remote Transceiver (0471:060c)
>        Driver: mceusb, table: rc-rc6-mce
>        lirc device: /dev/lirc0
>        Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
>        Enabled protocols: lirc rc-5 rc-6
>        bus: 3, vendor/product: 0471:060c, version: 0x0101
>        Repeat delay = 500 ms, repeat period = 125 ms
>	Apologies for the long post...
>	Compliments of the Season,
>	Doug

It sounds like you are using lirc by manually setting up the config
files, rather than using the Python config programs.  That does work,
but there are still a couple of problems you can run into.  I would
recommend that you run my script that fixes all the 18.04 lirc
problems I know about, including getting the Python config programs to


That may fix your problem where a key autorepeats - for me, that was
caused by extra lirc daemons being run by systemd (lircmd,
lircd-uinput) when they had not had their config files set up.  Part
of my script disables those, and also the irexec daemon.

The KEY_SLEEP problem is more difficult, as I do not have that
problem.  The easy way to be completely sure that the system will not
sleep if you use KEY_SLEEP is to reconfigure the key table used to
assign the value sent by that key to something other than KEY_SLEEP.
What happens is that the system is somehow receiving the KEY_SLEEP
value and acting on it, rather than it being passed through to lirc
and on to the programs using lirc.  Before trying that, I would
recommend running my script and seeing if that fixes the problem, and
then making sure that lirc is really running when KEY_SLEEP causes
sleep - use "ps -ef | grep -i lirc" to see if lirc is running and what
command line options it has.  If lirc is not running, all the KEY_
values are sent to the system.  If it is running, they should be sent
to lirc instead, but it is possible that they can be set up to be sent
to the system as well as to lirc.

More information about the mythtv-users mailing list