[mythtv-users] Remote and blaster without LIRC?

Don Brett dlbrett at zoominternet.net
Tue Jun 18 20:09:15 UTC 2019

On 6/12/2019 10:42 AM, Stephen Worthington wrote:
> On Wed, 12 Jun 2019 09:28:30 -0400, you wrote:
>> On 6/4/2019 12:50 AM, Stephen Worthington wrote:
>>> On Mon, 3 Jun 2019 15:52:10 -0400, you wrote:
>>>> This should be working, but it's not; MythTv responds to none of the
>>>> button presses from the remote.
>>>> Using lirc-setup, when picking mceusb hardware, it pretty much forces
>>>> the driver to default, so, I ended up using default. Testing with irw,
>>>> it works fine, and returns string  that match the strings in
>>>> /etc/lirc/lircd.conf.d/mceusb.lircd.conf.  If I change a string in
>>>> mceusb.lircd.conf and retest, I can see the changes in irw.
>>>> Testing with ircat, it looks like it's working, but I'm not sure where
>>>> the strings are config from.  Some buttons match the contents of
>>>> /etc/lirc/lircd.conf.d/mythtv.lircrc, and some don't.  If I change a
>>>> string in mythtv.lirc and retest, nothing changes.  I suspect ircat is
>>>> getting strings from somewhere else.
>>>> Below are the the contents of lircd_options_conf and a couple of
>>>> examples; any suggestions on what to look for next?
>>>> *Contents of "lircd_options_conf":*
>>>> # Generated by lirc-setup
>>>> [lircd]
>>>> nodaemon = False
>>>> driver = default
>>>> device = /dev/lirc0
>>>> output = /var/run/lirc/lircd
>>>> pidfile = /var/run/lirc/lircd.pid
>>>> plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins
>>>> permission = 666
>>>> allow-simulate = No
>>>> repeat-max = 600
>>>> lircd_conf = mceusb.lircd.conf
>>>> [lircmd]
>>>> uinput = False
>>>> nodaemon = False
>>>> [modinit]
>>>> code = echo lirc > /sys/class/rc/rc0/protocols
>>>> *example 1:*
>>>> don at johnny:~$ irw
>>>> 000000037ff07be0 00 KEY_DOWN mceusb
>>>> 000000037ff07be0 01 KEY_DOWN mceusb
>>>> 000000037ff07be1 00 KEY_UP mceusb
>>>> 000000037ff07be1 01 KEY_UP mceusb
>>>> ^C
>>>> don at johnny:~$
>>>> don at johnny:~$ ircat mythtv
>>>> Down
>>>> Up
>>>> *example 2:*
>>>> don at johnny:~$ irw
>>>> 000000037ff07bdc 00 KEY_BACK mceusb
>>>> 000000037ff07bdc 01 KEY_BACK mceusb
>>>> ^C
>>>> don at johnny:~$ ircat mythtv
>>>> Escape
>>>> *example 3:*
>>>> don at johnny:~$ irw
>>>> 000000037ff07bdd 00 KEY_OK mceusb
>>>> 000000037ff07bdd 01 KEY_OK mceusb
>>>> ^C
>>>> don at johnny:~$
>>>> don at johnny:~$ ircat mythtv
>>>> Return
>>>> ^C
>>>> don at johnny:~$
>>> >From the irw output above, the "default" driver setting is actually
>>> using a driver named "mceusb".  The IRW output looks OK, but the arrow
>>> keys are not the best ones to use as an example as they also tend to
>>> work even without LIRC due to how the other paths for processing IR
>>> input work.  The KEY_BACK example though is a key that normally does
>>> not work without the LIRC setup being right, so that looks good.
>>> The "ircat mythtv" command should be looking at ~/.lircrc for its
>>> config file.  On a normal MythTV system, that file is just a set of
>>> include commands to read other files.  Here is mine from
>>> /home/stephen/.lircrc:
>>> stephen at mypvr:~$ cat .lircrc
>>> #Custom lircrc generated via mythbuntu-lirc-generator
>>> #All application specific lircrc files are within ~/.lirc
>>> include ~/.lirc/mythtv
>>> include ~/.lirc/mplayer
>>> include ~/.lirc/xine
>>> include ~/.lirc/vlc
>>> include ~/.lirc/xmame
>>> include ~/.lirc/xmess
>>> include ~/.lirc/totem
>>> include ~/.lirc/elisa
>>> include ~/.lirc/irexec
>>> You need to run ircat from the same user as mythfrontend is run from,
>>> in order for it to find the correct .lircrc file.  From the above, it
>>> looks like you are doing that, but I can not be completely sure.
>>> In the files included from .lircrc, the convention is that each of
>>> those files will have the settings for the program that matches the
>>> file's name.  So all the settings for mplayer will be in the mplayer
>>> file and all the settings for mythtv will be in the mythtv file.
>>> However, the way LIRC works is that what matters is what is in each
>>> individual setting, so if you get something in a different file that
>>> has the settings for mythtv, it will work.  And it could override a
>>> valid earlier setting that you have made with a later invalid one.  So
>>> you need to watch out for that.  If you are not using any programs
>>> other than mythtv with LIRC, and you want to absolutely rule out any
>>> problems like that, you can just comment out all the other includes in
>>> the .lircrc file by putting a # character at the start of the line.
>>> So all the LIRC settings for program "mythtv" should be in
>>> ~/.lirc/mythtv.  Settings for program "mythtv" are identified by a
>>> "prog = mythtv" line.  Here is my Escape / Back button:
>>> begin
>>>       remote = devinput
>>>       prog = mythtv
>>>       button = KEY_BACK
>>>       config = Escape
>>>       repeat = 0
>>>       delay = 0
>>> end
>>> What that says is when LIRC receives an input from the "devinput"
>>> driver, and is attached to program "mythtv", it should translate any
>>> "KEY_BACK" signals it receives into the keystroke "Escape" and send
>>> that to program "mythtv".  MythTV has settings in mythfrontend that
>>> tell it what to do with the keystroke "Escape" when received from
>>> LIRC:
>>> MariaDB [mythconverg]> select * from keybindings where keylist like
>>> '%Esc%';
>>> +-------------+------------+----------------------------+---------+----------+
>>> | context     | action     | description                | keylist | hostname |
>>> +-------------+------------+----------------------------+---------+----------+
>>> | Global      | ESCAPE     | Escape                     | Esc     | mypvr    |
>>> | Main Menu   | EXITPROMPT | Display System Exit Prompt | Esc     | mypvr    |
>>> | Global      | ESCAPE     | Escape                     | Esc     | savaidh  |
>>> | Main Menu   | EXITPROMPT | Display System Exit Prompt | Esc     | savaidh  |
>>> | TV Playback | BACK       | Exit or return to DVD menu | Esc     | savaidh  |
>>> | Global      | ESCAPE     | Escape                     | Esc     | gt70     |
>>> | Main Menu   | EXITPROMPT | Display System Exit Prompt | Esc     | gt70     |
>>> | TV Playback | BACK       | Exit or return to DVD menu | Esc     | gt70     |
>>> +-------------+------------+----------------------------+---------+----------+
>>> 8 rows in set (0.00 sec)
>>> If you are looking for keys in the database, as well as the
>>> "keybindings" table for ordinary key bindings that work only from the
>>> specified context, you need to search the "jumppoints" table for the
>>> global jump points that work from anywhere (any context) in
>>> mythfrontend.  And note that the "keylist" field is a comma separated
>>> list of keys, not just a single key.
>>> The action in MythTV depends on the context, and the hostname.  Each
>>> frontend in the database is identified by its hostname, and the
>>> settings can be different for each frontend.  And you can see that in
>>> the MythTV settings, the LIRC keystroke "Escape" is spelled "Esc",
>>> just to confuse things further.  In mythfrontend GUI, you can find
>>> those settings at Setup > Edit Keys.
>>> So in your case, to get the Escape / Back remote button to work, you
>>> would want this in your ~/.lirc/mythtv file:
>>> begin
>>>       remote = mceusb
>>>       prog = mythtv
>>>       button = KEY_BACK
>>>       config = Escape
>>>       repeat = 0
>>>       delay = 0
>>> end
>>> Note the change in the "remote =" line to "remote = mceusb", as that
>>> is the driver name that irw is showing for your setup.  So take a look
>>> at your ~/.lirc/mythtv file.  It likely has more than one set of
>>> settings in it for "prog = mythtv", each set of setting having a
>>> different "remote =" value.  What you need is a full set of those
>>> settings, with "remote = mceusb".  Here is what I had in my original
>>> ~/.lirc/mythtv file:
>>> stephen at mypvr:~/.lirc$  grep "remote =" mythtv.original | uniq
>>>       remote = mceusb_hauppauge
>>>       remote = vista_mce
>>>       remote = mceusb
>>> So it is not unlikely that you have a set of "remote = mceusb"
>>> settings in your ~/.lirc/mythtv file.  I have long since renamed my
>>> original ~/.lirc/mythtv file to ~/.lirc/mythtv.original, and edited a
>>> copy of it to suit my system, so I now only have "remote = devinput"
>>> settings in it.  I would recommend that you do the same, but only have
>>> "remote = mceusb" in your ~/.lirc/mythtv file.  Then you need to go
>>> through all the keys on your remote, checking what is output by "ircat
>>> mythtv" against that file, and then changing either the Mythfrontend
>>> setting for the key to match the file, or the file setting in the
>>> "config =" line to match Mythfrontend.  I recommend keeping the
>>> Mythfrontend settings and changing the "config =" settings, as the
>>> Mtyhfrontend settings are also what you use from a real keyboard, and
>>> the defaults work well from a keyboard.  If you have a remote key that
>>> does not produce output in ircat, you will need to create a new
>>> begin/end block with the appropriate settings for it, with a "button
>>> =" value that matches its irw output.  Each time you change something
>>> in ~/.lirc/mythtv, you will need to restart ircat at least, so it will
>>> read the new settings.  I am not sure if you also need to restart
>>> lircd:
>>> sudo systemctl restart lircd
>>> I think that is unnecessary, but check to see if you need to.
>>> Once you have a set of "remote = mcuusb" settings that work, you can
>>> consider the "repeat =" and "delay =" settings for them.  Those
>>> control whether a key autorepeats, and how quickly it repeats,
>>> respectively.  I have my arrow keys, the channel and volume keys, and
>>> PgUp and PgDown set to "repeat = 1" and "delay = 1".  All other keys
>>> do not autorepeat.  The "delay = 1" gives the fastest possible
>>> autorepeat rate.  But those are just my personal preferences.
>> Still working on it, but getting close.  It looks like mythtv frontend
>> is using /home/don/.lirc/mythtv, but ircat is using something else.
>> Nothing was changing when testing with ircat, so I picked an obscure
>> button to experiment with.
>> With this configuration, ircat displayed a "Z" and mythtv frontend had
>> no response to pressing the DVD button.
>> begin
>>      remote = mceusb
>>      prog = mythtv
>>      button = KEY_DVD
>>      config = Z
>>      repeat = 3
>>      delay = 0
>> end
>> I changed it to this:
>> begin
>>      remote = mceusb
>>      prog = mythtv
>>      button = KEY_DVD
>>      config = PgDown
>> #    config = Z
>>      repeat = 3
>>      delay = 0
>> end
>> ...ircat still showed a "Z" and mythtv frontend did a page down. Hmmm,
>> another mystery.
>> don at johnny:~$ ircat -c ~don/.mythtv/lircrc  mythtv
>> Z
>> Z
>> ^C
>> don at johnny:~$
>> Note: ~don/.mythtv/lircrc  >  ~don/.lirc
> I have no idea why ircat would not see the change.  But since it is
> mythfrontend you need working, and it is, that should not be too much
> of a problem.  You might like to try:
> ircat -c /home/don/.lircrc mythtv
> to make 100% sure that it is loading the correct config.  I can not
> see any reason for there being a problem with the link, but bypassing
> it makes sure.  In fact I think it is mythfrontend that needs the
> link, and ircat will be loading its settings from ~/.lircrc anyway.
> You could also make sure you are in the /home/don directory and then
> try:
> ircat mythtv
> in case it loads .lircrc from the current directory.
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums:https://forum.mythtv.org
I have all the remote buttons working with LIRC now, so, here's a 
summary of what I did.  I'm not sure all the steps were correct or 
necessary, but they seem to work.  I started with a new Mate-Ubuntu 
18.04 installation that had the remote working without lirc.  After 
realizing blaster was not supported in the kernel-only method, I 
abandoned the lirc-less approach and started over.

Reading through the latest LIRC documentation was helpful to understand 
the theory, but a bit confusing on the actual steps. Also, the 
installation packages had some issues, so I used Stephen's script and 
several other steps instead.

*Downloaded Stephen's script and saved to /home/don/Downloads/lirc_ubuntu*

*Run the script*
$ cd /home/don/Downloads/lirc_ubuntu
don at johnny:~/Downloads/lirc_ubuntu$ sudo ./lirc-ubuntu-18.04-install.sh
....answered user don for who would run mythfrontend question
don at johnny:~/Downloads/lirc_ubuntu$ sudo reboot

*Run lirc-setup from X-windows*
-Access X windows > Open a terminal
don at johnny:~$ cd /etc/lirc
don at johnny:/etc/lirc$ sudo lirc-setup
[sudo] password for don:

*From the top half of lirc-setup window*
-Click "Use default driver..." button
-Click "Use preconfigured capture device..." button; pick USB and then 
Microsoft mce remotes gear

*From the bottom half of lirc-setup window*
-Search and browse buttons didn't work for me, so I opened a browser and 
navigated to:
-Scroll down and click mceusb > download mceusb.lirc.conf and save to 
-Return  to the lirc-setup program and select "Use local file"
-Navigate to and select the mceusb.lirc.conf file just downloaded.
-Click the "Write configuration" button to save selections.  Exit the 
lirc-setup program.
-The lirc-setup program creates a readme that instructs you to move four 
files, but mine only created one.  I moved lirc_options.config to 
/etc/lirc and ignored the other three instructions.

At this point I thought lirc should be working.  It wasn't, so I had to 
do a couple of more steps.

-Copied .lirdrc from a working 16.04 installation to /home/don
-This file has an include list that points to several application button 
setups (mythtv, mplayer, etc.).

-Copied the .lirc directory and it's contents from a working 16.04 box 
to /home/don/.lirc/.
-This directory has the application setups (mythtv, mplayer, etc.) that 
.lircrc (from previous step) pointed-to.

don at jonny:~/.lirc$ ls -l
total 84
-rw-rw-r-- 1 don don     6979 Dec 17  2017 elisa
-rw-rw-r-- 1 don don     6636 Dec 17  2017 mplayer
-rwxrw-rw- 1 don mythtv 12485 Feb 13  2016 mythtv
-rwxrw-rw- 1 don don    12253 Dec 17  2017 mythtv.old
-rw-rw-r-- 1 don don     5746 Dec 17  2017 totem
-rw-rw-r-- 1 don don     7101 Dec 17  2017 vlc
-rw-rw-r-- 1 don don     6876 Dec 17  2017 xine
-rw-rw-r-- 1 don don     6434 Dec 17  2017 xmame
-rw-rw-r-- 1 don don     6434 Dec 17  2017 xmess

*Sym link to /home/don/.lirc/*
-Created a link to point to the application button files

don at johnny:~$
don at johnny:~$ cd ~/.mythtv
don at johnny:~/.mythtv$ ln -s ../.lircrc lircrc

At this point, the buttons were working pretty well, but some still 
needed adjustments, so I edited them as needed.  The "button = " line 
must have an entry that matches entries in 

*Example: modified guide button in /home/don/.lirc/mythtv*
     remote = mceusb
     prog = mythtv
#    button = Guide
     button = KEY_EPG
     config = S
     repeat = 0
     delay = 0

All remote buttons are now working, but blaster is missing something.  
Blaster hardware was previously defined in hardware.conf, but that 
config file is replaced with something in lirc_options.conf.  Not sure 
what's missing, so maybe another discussion thread is needed.


Extra notes:

*Instructions for lirc-less installation*

*Re-ran lirc installation script (lirc-ubuntu-18.04-install.sh)*
-Got duplicate entries (Unit/Service/Install) in 
/etc/systemd/system/lirc-dev.service and service would not start; 
removed duplicates and all is well.

*Using wrong remote*
-/etc/lirc/lircd.conf.d/mceusb.lircd.conf has setting for three remotes 
(mceusb, mceusb_hauppauge, vista_mce)
-journalctl reported it was using vista_mce; I removed mceusb_hauppauge 
and vista_mce; now reports mceusb.

don at johnny:~$ journalctl -b0 /usr/sbin/lircd | tail -30
Jun 18 14:55:32 johnny lircd-0.10.0[1086]: Info: Using remote: mceusb.

PS - Stephen and Alec...thanks for the help

This email has been checked for viruses by Avast antivirus software.

More information about the mythtv-users mailing list