Mailing List Archive

Raspberry Pi 4 FrontEnd Remote Control Issues
Hi Folks!

Have a Raspberry Pi 4, 4 GB, which I’m using as a FrontEnd – seems to
work fine. What I would like to do is be able to use the television’s
remote control instead of a keyboard. Have used MythTV and before that
Mythbuntu and always used a keyboard, so this is my first time trying to
use a remote.

TV is a Seiki, found a LIRC configuration file at
https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee . AFAICT I’ve
configured it in correctly as /irw/seems to output correctly
“000000040be52ad 00 KEY_OK seiki” when I tap the “OK” key; the ‘00’ will
increment if I hold the key.

Problem is nothing happens when I’m in MythTV – menu just sits there
with pressing OK, Up, Down, Left… random keys. At this point I have the
Pi plugged in to a monitor up here in the Computer Room (the TV is
downstairs). Setup > General > Remote Control:

    LIRC daemon socket:         /var/run/lirc/lircd (guess so: default
and a file [purple] there)

    Enable CEC Control Interface:     Checked, as are all four options
in the submenu

*s**udo systemctl status lircd.service*says its ‘active (running)’, no
errors listed.

No idea where to look to correct whatever is wrong so asking for
guidance here; looked in the archives but nothing helpful in the way I
typed in search terms.

TIA!

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Martin,

maybe your HDMI cable does not support CEC - I just found out that a HDMI
1.3 High Speed Cable is needed/recommended.

Some years ago I used the Kodi CEC feature on our Samsung TV (Raspberry Pi
2). This worked fine. I would be glad if this would work with MythTV too.

Kind Regards
Jens

Problem is nothing happens when I’m in MythTV – menu just sits there with
> pressing OK, Up, Down, Left… random keys.
>
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Sat, 9 May 2020 19:20:04 -0500, you wrote:

>
>Hi Folks!
>
>Have a Raspberry Pi 4, 4 GB, which I?m using as a FrontEnd ? seems to
>work fine. What I would like to do is be able to use the television?s
>remote control instead of a keyboard. Have used MythTV and before that
>Mythbuntu and always used a keyboard, so this is my first time trying to
>use a remote.
>
>TV is a Seiki, found a LIRC configuration file at
>https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee . AFAICT I?ve
>configured it in correctly as /irw/seems to output correctly
>?000000040be52ad 00 KEY_OK seiki? when I tap the ?OK? key; the ?00? will
>increment if I hold the key.
>
>Problem is nothing happens when I?m in MythTV ? menu just sits there
>with pressing OK, Up, Down, Left? random keys. At this point I have the
>Pi plugged in to a monitor up here in the Computer Room (the TV is
>downstairs). Setup > General > Remote Control:
>
> ??? LIRC daemon socket: ??? ??? /var/run/lirc/lircd (guess so: default
>and a file [purple] there)
>
> ??? Enable CEC Control Interface:?? ? Checked, as are all four options
>in the submenu
>
>*s**udo systemctl status lircd.service*says its ?active (running)?, no
>errors listed.
>
>No idea where to look to correct whatever is wrong so asking for
>guidance here; looked in the archives but nothing helpful in the way I
>typed in search terms.
>
>TIA!
>
>Barry

If irw is working, you are a long way down the path of getting it
going. The next thing to do is to run irw and try every key on the
remote and make sure that they are all recognised. You need to have
mythfrontend shut down while doing that. It all the keys are working,
then you do not need to go back to ir-keytable and fix things there,
so that would be a bonus.

Once you have all the keys working, then to get them recognised in
MythTV, you have to configure two things: the lirc output, and
possibly the mythfrontend input keys. The first of these is the lirc
configuration that tells lirc how to translate the keystroke data you
are seeing from irw into keystrokes for each of the programs that will
take input from lirc, such as MythTV, Kodi, mplayer or irexec. Each
program that uses input from lirc links in the lirc library code to do
that. When the program starts up, the lirc library code looks for a
table of keystroke translations customised for the program. These
tables are normally found in a .lircrc file in the home directory of
the user running the program. The .lircrc file contains one table for
each program, identified by a name the program gives to the lirc
library code. All the various MythTV programs that use lirc
(mythfrontend, mythtv-setup.real, mythavtest, ...) use the same lirc
name: mythtv. The .lircrc file is usually just a list of "include"
statements that include other files, one file per set of program
definitions. So here is what is in .lircrc in Ubuntu:

root@mypvr:/home/stephen# 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

So all the actual definition files for the programs are stored in
$(HOME)/.lirc

Here is the start of my /home/stephen/.lirc/mythtv file:

# lircrc for devinput with Hauppauge Nova TD-500 and Hauppauge
HVR-900R2 remotes (with lirc 0.9.0),
# and MCE remotes.

# Save it in ~/.lircrc

begin
remote = devinput
prog = mythtv
# Guide key
button = KEY_EPG
# config = S
config = Ctrl+Alt+G
repeat = 0
delay = 0
end

begin
remote = devinput
prog = mythtv
button = KEY_EXIT
config = Escape
repeat = 0
delay = 0
end

begin
remote = devinput
prog = mythtv
button = KEY_OK
config = Return
repeat = 0
delay = 0
end

Each begin/end block is one keystroke definition for one program. Lirc
does not care which file the definitions are in, it is just a
convention to use one file per set of program definitions. So if you
are cutting and pasting and forget that you copied a definition with a
different program name in the "prog = " line, you will not get the
result you want.

So you need to check if you have the .lircrc and .lirc/* files. If
the MythTV install for Pi4 has not installed them, you will need to
get them from somewhere.

In your case, your "remote = " name should be "seiko" as that is what
irw is showing as the remote name. So in your $(HOME)/.lirc/mythtv
file, you will likely need to change all the "remote = " lines to read
"remote = seiko", using a global change. That will be the thing that
is preventing even the arrow keys from working at the moment.

The format of the .lircrc file definitions is on this page:

https://www.lirc.org/html/configure.html

Each key definition needs to have the "button = " value set to the
keystroke that you see in irw, and the "config = " value set to the
keyboard key that mythtv uses for that function. The MythTV
keystrokes are set up in:

mythfrontend > Setup > Edit keys

The "config = " value has to match the keystroke for a key set at the
bottom of an Edit keys window (allowing for different syntax for Ctrl-
and the like).

You should set "repeat = 1" only for keys you want to autorepeat, such
as the arrows and maybe PgUp and PgDn. For repeating keys, try
setting "delay = 1" and see if the autorepeat is the correct speed.
Adjust as required.

Any changes in the .lircrc files will only be seen when you shut down
mythfrontend and restart it.

Before going any further, you should check to see if any of the other
systemd services associated with lirc are installed and running. On
Ubuntu, apart from lirc itself (lircd.service, lircd.socket and
lircd-setup.service), there are three other services installed:

irexec.service
lircd-uinput.service
lircmd.service

With only the default configuration, one or more of these can
interfere with the proper operation of lirc (for example, causing
doubled keystrokes). So they all need to be stopped and disabled:

sudo systemctl stop <servicename>
sudo systemctl disable <servicename>

If at some later time you ever need them, configure them properly then
enable and start them.

So now if you start mythfrontend, things should be working at least
somewhat. You will need to test all keys to make sure each one is
working properly.

Another useful test program is ircat. If you shut down mythfrontend
and run:

ircat mythtv

then ircat will load the lirc keystroke definitions for "mythtv" and
will respond to them. So when you push a key on the remote, the
output you should see is what is on the matching "config = " line.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Jens!

> maybe your HDMI cable does not support CEC - I just found out that a HDMI
> 1.3 High Speed Cable is needed/recommended.
>
> Some years ago I used the Kodi CEC feature on our Samsung TV (Raspberry Pi
> 2). This worked fine. I would be glad if this would work with MythTV too.

Thanks for your reply.  At this time appears the problem is more a
problem in one of the points Stephen Worthington pointed out.  I haven't
gotten to the stage of connecting the Raspberry Pi to the TV yet as
noted a problem in the test setup but will keep in mind for a potential
HDMI cable issue.

Appreciate the suggestion!

Barry

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!

> If irw is working, you are a long way down the path of getting it
> going. The next thing to do is to run irw and try every key on the
> remote and make sure that they are all recognised.

Appears to be working to this point: /irw/ responded to all of the
remote's keys with the exception of (meaning these keys do not give a
response):

Return to previous channel (the one with the two arrows in a loop)
Information
Auto
V.Chip
Aspect
Add/Erase

Not sure those keys are needed in MythTV except perhaps as a shortcut –
that’s advanced! Did find “Fav -” responds “KEY_ENTER” while “OK”
responds “KEY_OK”.


> root@mypvr:/home/stephen# cat .lircrc

Found a problem here!  No such file!    Looked (with /find/) and appears
not hiding elsewhere.  I'm using Raspbian Buster on the RPi vs. Ubuntu
but don't think that's the problem;  the problem is the file wasn't
generated.  Will see if I can figure out, though of course your help is
appreciated!   ...Quick check using the show hidden files option in the
GUI for Files and no /home/pi/.lirc either.

TAI!

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Sun, 10 May 2020 14:16:40 -0500, you wrote:

>
>Hi Stephen!
>
>> If irw is working, you are a long way down the path of getting it
>> going. The next thing to do is to run irw and try every key on the
>> remote and make sure that they are all recognised.
>
>Appears to be working to this point: /irw/ responded to all of the
>remote's keys with the exception of (meaning these keys do not give a
>response):
>
>Return to previous channel (the one with the two arrows in a loop)
>Information
>Auto
>V.Chip
>Aspect
>Add/Erase
>
>Not sure those keys are needed in MythTV except perhaps as a shortcut ?
>that?s advanced! Did find ?Fav -? responds ?KEY_ENTER? while ?OK?
>responds ?KEY_OK?.

You can adjust which KEY_ value is created by each key by editing your
seiko file. And once you find the numeric value for each of the
missing keys, you can add them. Some of those keys do not look
particularly useful, but the Information one is likely to be something
you will want (I use the I key on my keyboard and the Info key on my
remote all the time). And you can repurpose keys to do anything you
want. I have my Power key doing the O command (list upcoming
recordings for a programme), since the Power symbol on the remote is
the closest thing it has to an O and I had no use for the Power
function.

Where did you put your seiko file? We need to be sure that it is
actually being used for the key translations.

To see what happens to the raw keystrokes, you need to shut down lirc:

sudo systemctl stop lircd

and then run ir-keytable:

sudo ir-keytable -t

Then try pressing some keys that work, and then the ones that do not.
It is a long time since I did this, but I think that with the keys
that do not work, you will simply not get any output from ir-keytable
-t. If there is output, hopefully it will give you the right value to
put into your seiko file. If not, take a look at your syslog file and
see if there are any messages created there about keycode errors.

When you have edited the seiko file (keep a backup copy!), you need to
at least restart ir-keytable -t to see the changes, and you may even
need to reboot.

To restart lirc:

sudo systemctl start lircd

>
>> root@mypvr:/home/stephen# cat .lircrc
>
>Found a problem here!? No such file!??? Looked (with /find/) and appears
>not hiding elsewhere.? I'm using Raspbian Buster on the RPi vs. Ubuntu
>but don't think that's the problem;? the problem is the file wasn't
>generated.? Will see if I can figure out, though of course your help is
>appreciated!?? ...Quick check using the show hidden files option in the
>GUI for Files and no /home/pi/.lirc either.
>
>TAI!
>
>Barry

I am not sure just how the .lircrc files on my system were originally
created. It may have been by the old Mythbuntu Control Centre program
(now deceased). But you can just create them manually (a big job!),
or copy someone elses'. I have put a copy of mine on my web server,
which contains my modified versions as well as the original versions:

http://www.jsw.gen.nz/mythtv/lircrc.tar.bz2

To install the files, do this from your mythfrontend user:

cd ~
wget http://www.jsw.gen.nz/mythtv/lircrc.tar.bz2
tar xvf lircrc.tar.bz2
chown $USER:$(id -g -n $USER) .lircrc .lirc .lirc/*

Then move the lircrc.tar.bz2 file to wherever you want to keep a copy
or delete it.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!

> You can adjust which KEY_ value is created by each key by editing your
> seiko file.

Right now I’m going to leave the unassigned keys (Auto, V.Chip, etc.)
alone, concentrating on the main-use keys (0-9, Up, Down, and the like).
BTW, it’s Seiki, not Seiko.


The Seiki configuration file - - the one I found at
https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee – is at
/etc/lirc/lircd.conf.d/Seiki_LIRC.conf . Good news is it is found/listed
by *systemctl status lircd.socket lircd.service*.




> To see what happens to the raw keystrokes, you need to shut down lirc:
>
> sudo systemctl stop lircd
>
> and then run ir-keytable:
>
> sudo ir-keytable -t

Well that seems to indicate a problem: ‘command not found’!



OK: /sudo apt install ir-keytable/ solves that problem!


> sudo ir-keytable -t
>
> Then try pressing some keys that work, and then the ones that do not.


And no output. Reboot.

sudo systemctl stop lircd
sudo ir-keytable -t


Still no output. /irw/does give an output.




> If there is output, hopefully it will give you the right value to
> put into your seiko file. If not, take a look at your syslog file and
> see if there are any messages created there about keycode errors.

cat /var/log/syslog

cat /var/log/syslog | grep -i error ==> just three from lightdm

cat /var/log/syslog | grep -i fail ==> ummmm… systemd’s
bthelper@hcio.service <mailto:bthelper@hcio.service> ==> bluetooth –
nevermind!

cat /var/log/syslog | grep -i lircd ==> messages re: “caught signal”


Otherwise nothing at all about keycode errors:


May 11 10:28:47 RPi-MythFE lircd[887]: lircd-0.10.1[887]: Notice: caught
signal

May 11 10:28:47 RPi-MythFE lircd-0.10.1[887]: Notice: caught signal

May 11 10:28:47 RPi-MythFE systemd[1]: Stopping Flexible IR remote
input/output application support...

May 11 10:28:47 RPi-MythFE systemd[1]: lircd.service: Main process
exited, code=killed, status=15/TERM

May 11 10:28:47 RPi-MythFE systemd[1]: lircd.service: Succeeded.

May 11 10:28:47 RPi-MythFE systemd[1]: Stopped Flexible IR remote
input/output application support.

pi@RPi-MythFE:~ $



OK, I’m going to send this off and see if anything makes sense as to why
not working as expected. Will take a look at your file (
http://www.jsw.gen.nz/mythtv/lircrc.tar.bz2 ) to compare to what I see here.


Again, TIA (and I got the letters in the right sequence this time!!)


Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Mon, 11 May 2020 10:45:22 -0500, you wrote:

>
>
>Hi Stephen!
>
>> You can adjust which KEY_ value is created by each key by editing your
>> seiko file.
>
>Right now I?m going to leave the unassigned keys (Auto, V.Chip, etc.)
>alone, concentrating on the main-use keys (0-9, Up, Down, and the like).
>BTW, it?s Seiki, not Seiko.
>
>
>The Seiki configuration file - - the one I found at
>https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee ? is at
>/etc/lirc/lircd.conf.d/Seiki_LIRC.conf . Good news is it is found/listed
>by *systemctl status lircd.socket lircd.service*.

Good, that is the right place for it.

>> To see what happens to the raw keystrokes, you need to shut down lirc:
>>
>> sudo systemctl stop lircd
>>
>> and then run ir-keytable:
>>
>> sudo ir-keytable -t
>
>Well that seems to indicate a problem: ?command not found?!
>
>
>
>OK: /sudo apt install ir-keytable/ solves that problem!

Yes, ir-keytable is no longer installed by default. The code that
runs the remotes is in the kernel now, and ir-keytable just talks to
that code and sends it commands. So it is not needed for a working
remote, just if you need to change things to get it working.

>> sudo ir-keytable -t
>>
>> Then try pressing some keys that work, and then the ones that do not.
>
>
>And no output. Reboot.
>
>sudo systemctl stop lircd
>sudo ir-keytable -t
>
>
>Still no output. /irw/does give an output.

What is the output of:

sudo ir-keytable

(without the -t). It should list your IR receiver(s).

I do not know how your remote works, just that it clearly does. IR
remotes need IR receiver hardware, which can be included in or with
tuners or as a separate device. The actual receiver is typically an
IR photo-diode, and in less naked devices than an RPi it is usually
hidden behind a small hole or transparent plastic window. So when you
are using your remote, what are you pointing it at? Does the RPi4
have a builtin IR receiver, or have you added one?

>> If there is output, hopefully it will give you the right value to
>> put into your seiko file. If not, take a look at your syslog file and
>> see if there are any messages created there about keycode errors.
>
>cat /var/log/syslog
>
>cat /var/log/syslog | grep -i error ==> just three from lightdm
>
>cat /var/log/syslog | grep -i fail ==> ummmm? systemd?s
>bthelper@hcio.service <mailto:bthelper@hcio.service> ==> bluetooth ?
>nevermind!
>
>cat /var/log/syslog | grep -i lircd ==> messages re: ?caught signal?
>
>
>Otherwise nothing at all about keycode errors:

The best way to find any keycode error messages (if there are any) is
to use the non-working buttons and then immediately look in syslog and
kern.log for the latest messages there that happened at the time you
were using the buttons.

I think it would also be a good idea to know just what version of lirc
is installed on your RPi4. So what does this command say:

sudo lircd -v
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


> The Seiki configuration file - - the one I found at
> https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee ? is at
> /etc/lirc/lircd.conf.d/Seiki_LIRC.conf . Good news is it is found/listed
> by **systemctl status lircd.socket lircd.service**.
> Good, that is the right place for it.

Figured it was in the correct subdir, just nice to have verified and
that being in the wrong place wasn’t the problem.



> What is the output of: sudo ir-keytable
> (without the -t). It should list your IR receiver(s).

pi@RPi-MythFE:~ $ sudo ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event4) with:
Name: gpio_ir_recv
Driver: gpio_ir_recv, table: rc-rc6-mce
LIRC device: /dev/lirc0
Attached BPF protocols: Operation not supported
Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
Enabled kernel protocols: lirc
bus: 25, vendor/product: 0001:0001, version: 0x0100
Repeat delay = 500 ms, repeat period = 125 ms
pi@RPi-MythFE:~ $



> I do not know how your remote works, just that it clearly does. IR
> remotes need IR receiver hardware, which can be included in or with
> tuners or as a separate device. The actual receiver is typically an
> IR photo-diode, and in less naked devices than an RPi it is usually
> hidden behind a small hole or transparent plastic window. So when you
> are using your remote, what are you pointing it at? Does the RPi4
> have a builtin IR receiver, or have you added one?
I added the IR detector from a Hauppage tuner. According to on-line
information for an after-market replacement uses a TSOP 2238 IR
Receiver. Information from PiHut says they sell the TSOP3802. AFAICT
equivalent for my usage. (PiHut seemed to indicate an IR detector was
fine, just the pinouts could differ.)


As for directing the remote control’s head, yes, directly to the opening
in the Hauppauge sensor – it’s hard to miss! <g> When nothing is
indicated on the screen the remote is closer and with grit – you know
that joke about how one presses the buttons harder on a remote control
with dead batteries?! Yup! <g>



You had a question on the version: /sudo lircd -v /


pi@RPi-MythFE:~ $ sudo lircd -v

lircd 0.10.1



Thanks!

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Mon, 11 May 2020 16:09:10 -0500, you wrote:

>
>Hi Stephen!
>
>
>> The Seiki configuration file - - the one I found at
>> https://gist.github.com/gisikw/a2ffa7f45efa0d9c3bee ? is at
>> /etc/lirc/lircd.conf.d/Seiki_LIRC.conf . Good news is it is found/listed
>> by **systemctl status lircd.socket lircd.service**.
>> Good, that is the right place for it.
>
>Figured it was in the correct subdir, just nice to have verified and
>that being in the wrong place wasn?t the problem.
>
>
>
>> What is the output of: sudo ir-keytable
>> (without the -t). It should list your IR receiver(s).
>
>pi@RPi-MythFE:~ $ sudo ir-keytable
>Found /sys/class/rc/rc0/ (/dev/input/event4) with:
> Name: gpio_ir_recv
> Driver: gpio_ir_recv, table: rc-rc6-mce
> LIRC device: /dev/lirc0
> Attached BPF protocols: Operation not supported
> Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
> Enabled kernel protocols: lirc
> bus: 25, vendor/product: 0001:0001, version: 0x0100
> Repeat delay = 500 ms, repeat period = 125 ms
>pi@RPi-MythFE:~ $
>
>
>
>> I do not know how your remote works, just that it clearly does. IR
>> remotes need IR receiver hardware, which can be included in or with
>> tuners or as a separate device. The actual receiver is typically an
>> IR photo-diode, and in less naked devices than an RPi it is usually
>> hidden behind a small hole or transparent plastic window. So when you
>> are using your remote, what are you pointing it at? Does the RPi4
>> have a builtin IR receiver, or have you added one?
>I added the IR detector from a Hauppage tuner. According to on-line
>information for an after-market replacement uses a TSOP 2238 IR
>Receiver. Information from PiHut says they sell the TSOP3802. AFAICT
>equivalent for my usage. (PiHut seemed to indicate an IR detector was
>fine, just the pinouts could differ.)
>
>
>As for directing the remote control?s head, yes, directly to the opening
>in the Hauppauge sensor ? it?s hard to miss! <g> When nothing is
>indicated on the screen the remote is closer and with grit ? you know
>that joke about how one presses the buttons harder on a remote control
>with dead batteries?! Yup! <g>
>
>
>
>You had a question on the version: /sudo lircd -v /
>
>
>pi@RPi-MythFE:~ $ sudo lircd -v
>
>lircd 0.10.1

That all looks good. I am still on lircd 0.10.0, but as far as I know
there are no significant configuration changes between the versions,
so my config files should work for you. So install the .lircrc and
.lirc/* files as per my previous post. There are two more steps
needed, which I had forgotten about. After you have installed the
.lircrc and .lirc/* files, you need to do this:

cd ~/.mythtv
ln -s ../.lircrc lircrc

This sets up a link to the .lircrc file in the place mythfrontend
expects to find it.

Then with lircd running do this:

ls -ald /dev/lircd

This is what I get:

lrwxrwxrwx 1 root root 15 May 10 04:51 /dev/lircd -> /run/lirc/lircd

If you do not have a /dev/lircd device like that, then you will need
to install a systemd service that creates it. I have put the file on
my web server, so do this:

sudo su
cd /etc/systemd/system
wget http://www.jsw.gen.nz/mythtv/lircd-dev.service
chown root:root lircd-dev.service
chmod u=rw,g=r,o=r lircd-dev.service
systemctl enable lircd-dev.service
systemctl start lircd-dev.service
exit

Note that I am not sure where Raspbian puts its user created systemd
unit files - if it is not /etc/systemd/system you will need to adjust
the cd command.

Then either change all the "remote = devinput" lines to "remote =
seiki", or in the Seiki_LIRC.conf file change the "name seiki" line to
"name devinput" and it should start working. You will need to restart
lircd if you change the Seiki_LIRC.conf file:

sudo systemctl restart lircd

And after installing (or editing) the .lirc/* files, you need to
restart mythfrontend (or restart your "ircat mythtv" command if you
are using that to test with).

You can check your mythfrontend.log file to see if it is finding the
lirc setup successfully. This is what I see:

May 10 04:51:51 mypvr mythfrontend.real: mythfrontend[3873]: I
CoreContext lirc.cpp:319 (Init) LIRC: Successfully initialized
'/dev/lircd' using '/home/stephen/.mythtv/lircrc' config
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


> ls -ald /dev/lircd

No such file or the RPi puts it elsewhere so looked, then I read later
where

> If you do not have a /dev/lircd
>
and the installation commands

> sudo su
> cd /etc/systemd/system
> wgethttp://www.jsw.gen.nz/mythtv/lircd-dev.service
> chown root:root lircd-dev.service
> chmod u=rw,g=r,o=r lircd-dev.service
> systemctl enable lircd-dev.service
> systemctl start lircd-dev.service
> exit

Recheck ls -ald /dev/lircd ==> now get the /lrwxrwxrwx 1 root root 15
May 10 04:51 /dev/lircd -> /run/lirc/lircd/ result (with my timestamp).



> Then either change all the "remote = devinput" lines to "remote =
> seiki", or in the Seiki_LIRC.conf file change the "name seiki" line to
> "name devinput" and it should start working.

I decided to use the ‘b’ option: only one item to change (though
Find-and-Replace wouldn’t be much work!) plus I’m considering cloning
the SD card to use on a second (TV) set – naturally a different brand
and remote! One master backup SD card would make things a little easier.



> sudo systemctl restart lircd
>
> And after installing (or editing) the .lirc/* files, you need to
> restart mythfrontend (or restart your "ircat mythtv" command if you
> are using that to test with).

Here I’ll admit to not following instructions on purpose (!) I had had
to power boot because the RPi had locked up – nothing due to your
commands but when when I inserted the thumbdrive a tiny bit of static
electricity even though I had touched metals (metal ring of the
thumbdrive connector to finger and finger to metal case of RPi).


So ended up with a fresh boot since Mythfrontend was started and figured
I’d try. *Yea!! The Seiki Remote works!! * At least up here on the
monitor – will move down to where the TV is later. (Will work, just have
to see what happens with both the TV and RPi looking at the same remote,
though TV vs HDMI Input on the TV may make that difference.)


Will have to figure what key on the remote does what but the basic
functions of moving highlighted text with the arrow keys works so I’m
presuming all assigned keys work; may have to tweak with Edit Keys but
that’s expected.


So once again a Big Thank You!!

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
I used Raspbian Buster Linux distro and the HDMI output to my TV. I was
surprised that CEC works out of box allowing me to use my TV remote in
MythTV Frontend. I didn't have to do anything additional except for editing
the Keybindings from the Mythfrontend menu to correctly map the new buttons
from the TV remote.
https://www.mythtv.org/wiki/Raspberry_Pi#Remote_Control_with_CEC

On Wed, May 13, 2020 at 1:53 PM Barry Martin <barry3martin@gmail.com> wrote:

>
> Hi Stephen!
>
>
> ls -ald /dev/lircd
>
> No such file or the RPi puts it elsewhere so looked, then I read later
> where
>
> If you do not have a /dev/lircd
>
> and the installation commands
>
> sudo su
> cd /etc/systemd/system
> wget http://www.jsw.gen.nz/mythtv/lircd-dev.service
> chown root:root lircd-dev.service
> chmod u=rw,g=r,o=r lircd-dev.service
> systemctl enable lircd-dev.service
> systemctl start lircd-dev.service
> exit
>
>
> Recheck ls -ald /dev/lircd ==> now get the *lrwxrwxrwx 1 root root 15 May
> 10 04:51 /dev/lircd -> /run/lirc/lircd* result (with my timestamp).
>
>
>
> Then either change all the "remote = devinput" lines to "remote =
> seiki", or in the Seiki_LIRC.conf file change the "name seiki" line to
> "name devinput" and it should start working.
>
> I decided to use the ‘b’ option: only one item to change (though
> Find-and-Replace wouldn’t be much work!) plus I’m considering cloning the
> SD card to use on a second (TV) set – naturally a different brand and
> remote! One master backup SD card would make things a little easier.
>
>
>
> sudo systemctl restart lircd
>
> And after installing (or editing) the .lirc/* files, you need to
> restart mythfrontend (or restart your "ircat mythtv" command if you
> are using that to test with).
>
> Here I’ll admit to not following instructions on purpose (!) I had had to
> power boot because the RPi had locked up – nothing due to your commands but
> when when I inserted the thumbdrive a tiny bit of static electricity even
> though I had touched metals (metal ring of the thumbdrive connector to
> finger and finger to metal case of RPi).
>
>
> So ended up with a fresh boot since Mythfrontend was started and figured
> I’d try. *Yea!! The Seiki Remote works!! * At least up here on the
> monitor – will move down to where the TV is later. (Will work, just have to
> see what happens with both the TV and RPi looking at the same remote,
> though TV vs HDMI Input on the TV may make that difference.)
>
>
> Will have to figure what key on the remote does what but the basic
> functions of moving highlighted text with the arrow keys works so I’m
> presuming all assigned keys work; may have to tweak with Edit Keys but
> that’s expected.
>
>
> So once again a Big Thank You!!
>
> Barry
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
>
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Wed, 13 May 2020 15:53:04 -0500, you wrote:

>
>Hi Stephen!
>
>
>> ls -ald /dev/lircd
>
>No such file or the RPi puts it elsewhere so looked, then I read later
>where
>
>> If you do not have a /dev/lircd
>>
>and the installation commands
>
>> sudo su
>> cd /etc/systemd/system
>> wgethttp://www.jsw.gen.nz/mythtv/lircd-dev.service
>> chown root:root lircd-dev.service
>> chmod u=rw,g=r,o=r lircd-dev.service
>> systemctl enable lircd-dev.service
>> systemctl start lircd-dev.service
>> exit
>
>Recheck ls -ald /dev/lircd ==> now get the /lrwxrwxrwx 1 root root 15
>May 10 04:51 /dev/lircd -> /run/lirc/lircd/ result (with my timestamp).
>
>
>
>> Then either change all the "remote = devinput" lines to "remote =
>> seiki", or in the Seiki_LIRC.conf file change the "name seiki" line to
>> "name devinput" and it should start working.
>
>I decided to use the ?b? option: only one item to change (though
>Find-and-Replace wouldn?t be much work!) plus I?m considering cloning
>the SD card to use on a second (TV) set ? naturally a different brand
>and remote! One master backup SD card would make things a little easier.
>
>
>
>> sudo systemctl restart lircd
>>
>> And after installing (or editing) the .lirc/* files, you need to
>> restart mythfrontend (or restart your "ircat mythtv" command if you
>> are using that to test with).
>
>Here I?ll admit to not following instructions on purpose (!) I had had
>to power boot because the RPi had locked up ? nothing due to your
>commands but when when I inserted the thumbdrive a tiny bit of static
>electricity even though I had touched metals (metal ring of the
>thumbdrive connector to finger and finger to metal case of RPi).

That sounds like the case of the RPi is not actually earthed. If this
is going to be an ongoing problem, you might want to see if the web
can tell you how to earth your case.

>So ended up with a fresh boot since Mythfrontend was started and figured
>I?d try. *Yea!! The Seiki Remote works!! * At least up here on the
>monitor ? will move down to where the TV is later. (Will work, just have
>to see what happens with both the TV and RPi looking at the same remote,
>though TV vs HDMI Input on the TV may make that difference.)
>
>
>Will have to figure what key on the remote does what but the basic
>functions of moving highlighted text with the arrow keys works so I?m
>presuming all assigned keys work; may have to tweak with Edit Keys but
>that?s expected.
>
>
>So once again a Big Thank You!!
>
>Barry

I would not declare success with just the arrow keys working, but it
is definitely a good start. It is probably better not to tweak Edit
Keys but rather to edit the $HOME/.lirc/mythtv file. That way you can
just copy that file to the other MythTV boxes. When you use Edit
Keys, you are also changing what the keyboard keystrokes are. Altering
the $HOME/.lirc/mythtv file only affects the remotes.

If you have problems with the TV and RPi responding to the same IR
input, try moving the RPi to one side where you can point the remote
at it and not at the TV. Preferable have the RPi in front of some
surface that will not reflect IR light well, such as curtains. Painted
walls often reflect IR quite well.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Monkey Pet!


> I used Raspbian Buster Linux distro and the HDMI output to my TV. I was
> surprised that CEC works out of box allowing me to use my TV remote in
> MythTV Frontend. I didn't have to do anything additional except for editing
> the Keybindings from the Mythfrontend menu to correctly map the new buttons
> from the TV remote.
> https://www.mythtv.org/wiki/Raspberry_Pi#Remote_Control_with_CEC

Thanks for the reference page: I think I remember seeing it but at the
time was looking for how to get the remote to control MythFrontend.  Two
reminders are better than none. :)   Stephen got my remote work, so now
to tweak that and probably even the CEC control.


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


> That sounds like the case of the RPi is not actually earthed. If this
> is going to be an ongoing problem, you might want to see if the web
> can tell you how to earth your case.

OK, thanks – did a quick preliminary search seems to indicate either no
grounding (earthing) necessary, else to ground if necessary. (For others
reading this, NEVER to either mains nor the hot/neutral. With U.S.
three-prong plugs there is a ground prong and I would verify with a
tester before connecting to the Pi.) There is also the possibility of
ground loops causing other problems.

At this point I’m also thinking the possibility of the SD card being the
cause. The original SD card was a well-respected brand, the backup card
isn’t a no-name but I have had problems with the brand and it seems
notably slower than the original. (I will be updating the original and
using that.)



> I would not declare success with just the arrow keys working, but it
> is definitely a good start. It is probably better not to tweak Edit
> Keys but rather to edit the $HOME/.lirc/mythtv file. That way you can
> just copy that file to the other MythTV boxes. When you use Edit
> Keys, you are also changing what the keyboard keystrokes are. Altering
> the $HOME/.lirc/mythtv file only affects the remotes.

OK, thanks! Does make sense.



> If you have problems with the TV and RPi responding to the same IR
> input, try moving the RPi to one side where you can point the remote
> at it and not at the TV. Preferable have the RPi in front of some
> surface that will not reflect IR light well, such as curtains. Painted
> walls often reflect IR quite well.

True: this particular remote I can do ‘trick shots’ with to control the
TV: bounce off the ceiling, over the shoulder, etc. Will see what
happens with the RPi.


Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


> I would not declare success with just the arrow keys working, but it
> is definitely a good start. It is probably better not to tweak Edit
> Keys but rather to edit the $HOME/.lirc/mythtv file. That way you can
> just copy that file to the other MythTV boxes. When you use Edit
> Keys, you are also changing what the keyboard keystrokes are. Altering
> the $HOME/.lirc/mythtv file only affects the remotes.

Follow-up to this – a bit of editing to the /.lirc/mythtv file and got
the basic functions to work; had to make a few concessions as don’t have
101 keys to play with like on a keyboard, plus preferring to use the
semi-basic remote that came with the TV just so nothing extra on the
counter. (Could use a programmable remote.…)

At this point have the Seiki TV’s remote able to control play/pause,
delete, bookmark, closed captioning, information as desired; the Fast
Forward and Rewind functions – acceptable. Probably assign another key
other than the arrow keys as they work properly for everything else
(menu selection, etc.).

Only thing I haven’t figured out is how to get MythFrontend started from
the remote (!). Maybe load-at-boot. (Hint?!)

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Sat, 16 May 2020 11:37:33 -0500, you wrote:

>
>Hi Stephen!
>
>
>> I would not declare success with just the arrow keys working, but it
>> is definitely a good start. It is probably better not to tweak Edit
>> Keys but rather to edit the $HOME/.lirc/mythtv file. That way you can
>> just copy that file to the other MythTV boxes. When you use Edit
>> Keys, you are also changing what the keyboard keystrokes are. Altering
>> the $HOME/.lirc/mythtv file only affects the remotes.
>
>Follow-up to this ? a bit of editing to the /.lirc/mythtv file and got
>the basic functions to work; had to make a few concessions as don?t have
>101 keys to play with like on a keyboard, plus preferring to use the
>semi-basic remote that came with the TV just so nothing extra on the
>counter. (Could use a programmable remote.?)
>
>At this point have the Seiki TV?s remote able to control play/pause,
>delete, bookmark, closed captioning, information as desired; the Fast
>Forward and Rewind functions ? acceptable. Probably assign another key
>other than the arrow keys as they work properly for everything else
>(menu selection, etc.).
>
>Only thing I haven?t figured out is how to get MythFrontend started from
>the remote (!). Maybe load-at-boot. (Hint?!)
>
>Barry

You use irexec for that. You have to edit the /etc/lirc/irexec.lircrc
file first. In you case, comment out or delete everything in the
file, then select one key from the remote to start mythfrontend with
and put the config for that one key in there. What irexec does is to
run the command you put in the "config = " line whenever you press
that key. What you will need to do is get it to run a command or
script file that changes to the mythfrontend user then runs
mythfrontend from that environment. I think this might work, but I
have not tried it:

config = "su -l <your mythfrontend user> /usr/bin/mythfrontend
--service"

(all on one line)

It is possible that it will need a DISPLAY=:0 environment setting as
well, in which case you would probably need to run a script from the
su -l command and put the environment setting in there.

Once you have irexec configured, do these commands to enable and start
it:

sudo systemctl enable irexec
sudo systemctl start irexec

If you want mythfrontend to load at boot, doing that depends on what
desktop you are running. If it is XFCE4, then you can run
mythfrontend at boot by setting it up from the GUI. Go to the Setup
menu, then run "Session and Startup" and click on the "Application
Autostart" tab. Click on the Add button and in the "Edit application"
window that pops up, fill it in like this:

Name: MythTV Frontend
Description: A frontend for all content on a mythtv-backend
Command: mythfrontend --service

That is what is installed automatically when you install the
mythfrontend package on Xubuntu. It may already be there - if so,
just tick it to enable it to be run at boot.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Sat, May 16, 2020 at 9:38 AM Barry Martin <barry3martin@gmail.com> wrote:

>
> Hi Stephen!
>
>
> I would not declare success with just the arrow keys working, but it
> is definitely a good start. It is probably better not to tweak Edit
> Keys but rather to edit the $HOME/.lirc/mythtv file. That way you can
> just copy that file to the other MythTV boxes. When you use Edit
> Keys, you are also changing what the keyboard keystrokes are. Altering
> the $HOME/.lirc/mythtv file only affects the remotes.
>
> Follow-up to this – a bit of editing to the /.lirc/mythtv file and got the
> basic functions to work; had to make a few concessions as don’t have 101
> keys to play with like on a keyboard, plus preferring to use the semi-basic
> remote that came with the TV just so nothing extra on the counter. (Could
> use a programmable remote.…)
>
> At this point have the Seiki TV’s remote able to control play/pause,
> delete, bookmark, closed captioning, information as desired; the Fast
> Forward and Rewind functions – acceptable. Probably assign another key
> other than the arrow keys as they work properly for everything else (menu
> selection, etc.).
>

I usually map the ARROW KEYS, ENTER, ESC, MENU, PAUSE PLAY, COMMERCIAL
JUMP, PAGE UP, PAGE DOWN. That usually gives me a vast majority of features.

If that fails, i have full keyboard/mouse remote that works well but have a
shorter range. One side is a air-mouse feature and arrows, flip it over and
it has a full qwerty keyboard. You can pickup one of these for extremely
cheap!

Been relying on the TV remote more recently since it has been working well.

Only thing I haven’t figured out is how to get MythFrontend started from
> the remote (!). Maybe load-at-boot. (Hint?!)
>

I opted for auto-load on restart, there is section in
https://www.mythtv.org/wiki/Raspberry_Pi#Autostart_mythfrontend_on_login

Although due to performance issues, i am now just directly starting
mythfrontend from the ~/.xsession file

https://www.mythtv.org/wiki/Raspberry_Pi#Running_without_a_desktop_environment_or_window_manager

>
>
Barry
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
>
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


It’s so simple when one knows the answers! You’re a good teacher to this
student!

I don’t know if the irexec option works or not. For my purposes it
seemed better to have the RPi boot to MythTV, though if I
accidentally/absentmindedly exit to the Desktop I can’t get back in
without pulling the plug (for the location would prefer just the one TV
Remote). Could use ssh or VNC.

I think I just talked myself into use a button on the remote! Will play
with irexec probably tomorrow.

In the meantime had gotten an autostart to work. The current Raspbian is
Buster and the Desktop is LXDE-pi. I didn’t find a GUI method so off to
Terminal! Edit the file */etc/xdg/lxsession/LXDE-pi/autostart* by adding
the line */usr/bin/mythfrontend* to the end. Reboot.

I was using my backup SD card which seems slower compared to the primary
card and I did see the Desktop background picture for about
three-quarters of a second before displaying the MythTV menu. More or
less stated for any others finding us so they know what to expect.

LIS. I think loading with a button on the remote is a better idea,
considering the preference for using the original TV’s remote. (Not that
I don’t appreciate Monkey Pet’s remote suggestion.)

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Monkey Pet!


> I usually map the ARROW KEYS, ENTER, ESC, MENU, PAUSE PLAY, COMMERCIAL
> JUMP, PAGE UP, PAGE DOWN. That usually gives me a vast majority of features.

Agree. Here in the U.S. or maybe it’s just us we’ve been having issues
with the Commercial Skip feature. Used to work but the last few years it
positions incorrectly; not a bad thing: there are a few entertaining
commercials, plus have seen announcements for shows of interest.

Did get my remote to run the other basic functions you listed, plus FF
and REW (the ‘Sticky’ ones as listed in Edit Keys, using the < and >
keys on a keyboard.


> I opted for auto-load on restart, there is section in
> https://www.mythtv.org/wiki/Raspberry_Pi#Autostart_mythfrontend_on_login
>
> Although due to performance issues, i am now just directly starting
> mythfrontend from the ~/.xsession file
>
> https://www.mythtv.org/wiki/Raspberry_Pi#Running_without_a_desktop_environment_or_window_manager

I will take a look at these, though for my use it seems the ability to
(re)start via the press of a remote button is advantageous, so will see
what I can do via irexec.

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


A couple/few/several questions, please.


> You have to edit the /etc/lirc/irexec.lircrc file first. In you case,
> comment out or delete everything in the file, then select one key from
> the remote to start mythfrontend

I didn’t have one to begin with so figured just create it as you said to
delete everything inside. after troubleshooting not sure the lack of a
file isn’t pointing to another problem. What I do have in the file is:

begin

     remote = devinput

     prog = mythtv

     button = KEY_C

     config = “su -l pi -c /home/pi/Load_MythFE.sh &”

     repeat = 0

     delay = 0

end



Without the -c switch it was complaining “cannot execute binary file”.
Found that little trick on the web. (Found what it was ‘complaining’
about when testing at Terminal.)


A sub-problem is the need to enter a password. The insertion of the -c
switch didn’t change the need. So now need to find out how to do that.
The good news is we (OK, you!) can be ‘sloppy’ and have a plain text
display as all the FEs have a common password.


> It is possible that it will need a DISPLAY=:0 environment setting as
> well, in which case you would probably need to run a script from the
> su -l command and put the environment setting in there.

And having problems figuring that one out. The Load_MythFE.sh is:


#!/bin/bash

DISPLAY=:0 <==zero

su -l pi -c /usr/bin/mythfrontend


Just dawned on me: do I need the ‘su -l pi -c’ string as it’s in irexec
file…… Nope! Now to figure out passing the the password.


Well, made your life a hare simpler! Will continue to try to figure out
the password thing.


As always, TIA!

Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Sun, 17 May 2020 16:00:51 -0500, you wrote:

>
>Hi Stephen!
>
>
>A couple/few/several questions, please.
>
>
>> You have to edit the /etc/lirc/irexec.lircrc file first. In you case,
>> comment out or delete everything in the file, then select one key from
>> the remote to start mythfrontend
>
>I didn?t have one to begin with so figured just create it as you said to
>delete everything inside. after troubleshooting not sure the lack of a
>file isn?t pointing to another problem. What I do have in the file is:
>
>begin
>
> ???? remote = devinput
>
> ???? prog = mythtv
>
> ???? button = KEY_C
>
> ???? config = ?su -l pi -c /home/pi/Load_MythFE.sh &?
>
> ???? repeat = 0
>
> ???? delay = 0
>
>end
>
>
>
>Without the -c switch it was complaining ?cannot execute binary file?.
>Found that little trick on the web. (Found what it was ?complaining?
>about when testing at Terminal.)
>
>
>A sub-problem is the need to enter a password. The insertion of the -c
>switch didn?t change the need. So now need to find out how to do that.
>The good news is we (OK, you!) can be ?sloppy? and have a plain text
>display as all the FEs have a common password.
>
>
>> It is possible that it will need a DISPLAY=:0 environment setting as
>> well, in which case you would probably need to run a script from the
>> su -l command and put the environment setting in there.
>
>And having problems figuring that one out. The Load_MythFE.sh is:
>
>
>#!/bin/bash
>
>DISPLAY=:0 <==zero
>
>su -l pi -c /usr/bin/mythfrontend
>
>
>Just dawned on me: do I need the ?su -l pi -c? string as it?s in irexec
>file?? Nope! Now to figure out passing the the password.
>
>
>Well, made your life a hare simpler! Will continue to try to figure out
>the password thing.
>
>
>As always, TIA!
>
>Barry

Getting rid of the need for a password is tricky. It involves
creating an /etc/sudoers.d file that allows a particular executable to
be run without a password. I have done this for helper scripts, to
allow them to be run as root from non-root users. It should also work
to allow one user to run things as another user. But the sudoers file
options are not exactly straightforward. This is what I have for my
mythtv-systemctl-helper.sh script, which allows mythtv user or mythtv
group users to run mythtv-systemctl-helper.sh without a password:

root@mypvr:/etc/sudoers.d# cat mythtv-systemctl-helper
mythtv,%mythtv
ALL=NOPASSWD:/home/mythtv/bin/mythtv-systemctl-helper.sh

(all on one line)

The first "mythtv" is the mythtv user. The "%mythtv" is mythtv group.
The mythtv-systemctl-helper.sh file is owner root and group mythtv,
and gets run as its owner (root), which allows it to do systemctl
commands. But as it does not have "group" or "other" write
permission, the mythtv user and group can not edit the file to get it
to do arbitrary commands as root, so it is not a security risk - it
will only do the systemctl commands the script is set up to allow.

So what I think you need for your Load_MythFE.sh file is to have that
file be owner <your mythfrontend user> and group mythtv, and chmod
u=rwx,g=rx,o=r. Then try this in a new /etc/sudoers.d file
"Load_MythFE"

<your mythfronend user> ALL:NOPASSWD:<full path to
Load_MythFE.sh>/Load_MythFE.sh

(all on one line).

Files in /etc/sudoers.d need to be chown root:root and chmod
u=r,g=r,o= or they will be ignored.

I think you will need to move the "su -l" command into the
Load_MythFE.sh file.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!


> Getting rid of the need for a password is tricky. It involves
> creating an /etc/sudoers.d file

I was snooping around last night and found this at
https://stackoverflow.com/questions/233217/how-to-pass-the-password-to-su-sudo-ssh-without-overriding-the-tty
:


echo <password> | su -c <command> <user>

So: echo MyPassword | su -l pi -c /home/pi/Load_MythFE.sh

(substitute the real password up there)


Modified the line in /etc/lirc/irexec.lircrc and seems to work.
Admittedly not a good solution for some as is easily found and displayed
in plain text but for me is fine. Will keep your suggestion as might
need a more secure option, and so far not 100% working – I haven’t
gotten the loading button on the remote to work yet.


Also had found my system wanted /export DISPLAY=:0.0/ – needed the
addition of “.0”. Found that at
https://forums.xilinx.com/t5/Embedded-Linux/Qt-window-can-not-be-displayed-Could-not-connect-to-any-X/td-p/902773



OK, still having problems I think with ‘the beginning’: when the yellow
button is pressed (KEY_C) nothing happens. I’m guessing this the
location of the problem because:


/etc/lirc/irexec.lircrc

Supposed to ‘see’ the button is pushed and run Load_MythFE.sh. If I run
the script at the Terminal things work. I also tried looking at the
MythWeb page of the Backend – which system is idle, active, etc. Yellow
button, nothing. Manual entry – becomes active. Just wanted to make sure
there wasn’t a display issue and the Frontend merely wasn’t being seen.


Also tried changing “config = echo “This is the C key”” to see if
anything pops up - - but to where? So tried “config = echo “This is the
C key” > /home/pi/Test.txt” hoping it would create the test file. Nope.
Trouble is I don’t know for certain if these test commands are right.
Guessing so as the first test is from some LIRC file.


So then while looking to see is the Test.txt file was being created saw
I had Test_LIRC.py. Not quite sure it’s supposed to do as was at the end
of an article I was using to guide me before asking for help here.
Article dead-ended at the script so I wasn’t sure what it did. Did give
me a potential clue: error message “no module named lirc”. (Didn’t we
install it like a dozen times early on?) (At Terminal) lirc ? command
not found. sudo lirc ? command not found. OK. install ? already
installed. <sizzle>


I think off the “no module named lirc’ error Googled and found these
specifically on the RPi4:


https://www.raspberrypi.org/forums/viewtopic.php?t=269703

Thu Apr 02, 2020 ? The latest version appears to be broken.

- -

Mon Apr 06, 2020 ? As there has been no response from this I've been
looking at alternatives.

It looks like pigpio provides what I need which is easier than using
Lirc anyway.


https://www.raspberrypi.org/forums/viewtopic.php?t=235256


[Stretch/Buster] Using LIRC with kernel 4.19.X and gpio-i
<https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256&sid=cda4dc3db943f0d9642a34f6fc2f088c>

Kernel 4.19 does not include lirc_dev, so it is recommended to use
gpio-ir.
https://lb.raspberrypi.org/forums/viewt ... 1&start=50
<https://lb.raspberrypi.org/forums/viewtopic.php?f=29&t=224931&start=50>

<More of article>


So at this point I’m not sure what to do. The second reference seems to
indicate patches and etc. I don’t ‘read’ code so at this point if better
to toss out the lirc stuff and go with pigpio (which I initially read as
“pig – pe – oh” and later occurred to me it’s ‘[raspberry] pi G-P-I-O’).
Could also just go back to the load at boot. ...Doesn’t quite make sense
why once MythFrontend is loaded the remote works.

I don’t know how much time and effort you want to put into this, though
I may be ‘leading the pack’ with a remote-operated RPi 4!


Barry
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
On Mon, 18 May 2020 15:10:26 -0500, you wrote:

>
>
>Hi Stephen!
>
>
>> Getting rid of the need for a password is tricky. It involves
>> creating an /etc/sudoers.d file
>
>I was snooping around last night and found this at
>https://stackoverflow.com/questions/233217/how-to-pass-the-password-to-su-sudo-ssh-without-overriding-the-tty
>:
>
>
>echo <password> | su -c <command> <user>
>
>So: echo MyPassword | su -l pi -c /home/pi/Load_MythFE.sh
>
>(substitute the real password up there)
>
>
>Modified the line in /etc/lirc/irexec.lircrc and seems to work.
>Admittedly not a good solution for some as is easily found and displayed
>in plain text but for me is fine. Will keep your suggestion as might
>need a more secure option, and so far not 100% working ? I haven?t
>gotten the loading button on the remote to work yet.

I suspect that the "su -l" needs to be changed to some form of sudo
command for the /etc/sudoers.d file to work. The su and sudo commands
are not the same. They are related, but I think sudoers only works
for sudo.

>Also had found my system wanted /export DISPLAY=:0.0/ ? needed the
>addition of ?.0?. Found that at
>https://forums.xilinx.com/t5/Embedded-Linux/Qt-window-can-not-be-displayed-Could-not-connect-to-any-X/td-p/902773

Good, I was not sure if it needed the .0, or whether :0 was enough. I
have never delved into just how that works.

>OK, still having problems I think with ?the beginning?: when the yellow
>button is pressed (KEY_C) nothing happens. I?m guessing this the
>location of the problem because:
>
>
>/etc/lirc/irexec.lircrc
>
>Supposed to ?see? the button is pushed and run Load_MythFE.sh. If I run
>the script at the Terminal things work. I also tried looking at the
>MythWeb page of the Backend ? which system is idle, active, etc. Yellow
>button, nothing. Manual entry ? becomes active. Just wanted to make sure
>there wasn?t a display issue and the Frontend merely wasn?t being seen.
>
>
>Also tried changing ?config = echo ?This is the C key?? to see if
>anything pops up - - but to where? So tried ?config = echo ?This is the
>C key? > /home/pi/Test.txt? hoping it would create the test file. Nope.
>Trouble is I don?t know for certain if these test commands are right.
>Guessing so as the first test is from some LIRC file.

That is the test I would have suggested. Since the irexec service is
running irexec as root, permissions should not matter and the Test.txt
file should be written to (if /home/pi is a valid directory).

>So then while looking to see is the Test.txt file was being created saw
>I had Test_LIRC.py. Not quite sure it?s supposed to do as was at the end
>of an article I was using to guide me before asking for help here.
>Article dead-ended at the script so I wasn?t sure what it did. Did give
>me a potential clue: error message ?no module named lirc?. (Didn?t we
>install it like a dozen times early on?) (At Terminal) lirc ? command
>not found. sudo lirc ? command not found. OK. install ? already
>installed. <sizzle>

Some things to check. Is irexec running?

sudo ps -ef | grep irexec

What log output do you get from irexec? I am not sure exactly where
the irexec service will be logging things, but it should show up
somewhere. What do these commands show?

sudo systemctl status irexec
sudo journalctl --unit=irexec
sudo journalctl -b0 /usr/bin/irexec

>I think off the ?no module named lirc? error Googled and found these
>specifically on the RPi4:
>
>
> https://www.raspberrypi.org/forums/viewtopic.php?t=269703
>
> Thu Apr 02, 2020 ? The latest version appears to be broken.
>
> - -
>
> Mon Apr 06, 2020 ? As there has been no response from this I've been
> looking at alternatives.
>
> It looks like pigpio provides what I need which is easier than using
> Lirc anyway.
>
>
> https://www.raspberrypi.org/forums/viewtopic.php?t=235256
>
>
> [Stretch/Buster] Using LIRC with kernel 4.19.X and gpio-i
> <https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256&sid=cda4dc3db943f0d9642a34f6fc2f088c>
>
> Kernel 4.19 does not include lirc_dev, so it is recommended to use
> gpio-ir.
> https://lb.raspberrypi.org/forums/viewt ... 1&start=50
> <https://lb.raspberrypi.org/forums/viewtopic.php?f=29&t=224931&start=50>
>
> <More of article>
>
>
>So at this point I?m not sure what to do. The second reference seems to
>indicate patches and etc. I don?t ?read? code so at this point if better
>to toss out the lirc stuff and go with pigpio (which I initially read as
>?pig ? pe ? oh? and later occurred to me it?s ?[raspberry] pi G-P-I-O?).
>Could also just go back to the load at boot. ...Doesn?t quite make sense
>why once MythFrontend is loaded the remote works.
>
>I don?t know how much time and effort you want to put into this, though
>I may be ?leading the pack? with a remote-operated RPi 4!

The remote is working - you have had it doing things. Most of the
problems with lirc packaging have been about doing the configuration
using the python configure programs. These can be broken due to a bad
package (as Ubuntu 18.04 lirc was). A missing _client.so module is
common. But lircd itself is normally fine and as long as you manually
set up the config (as you have done), it works.

Getting irexec to work as well is just icing on the cake. But it too
should work, with the right config. So for testing purposes, I would
suggest:

config = echo "irexec test" >/tmp/irexec.txt

It should be using a button that is not assigned to one of the other
lirc programs in the $HOME/.lircrc settings. Using the /tmp directory
for tests like this is a good idea as it is able to be used by any
user without permissions problems.

I put this in my /etc/lirc/irexec.lircrc file:

begin
prog = irexec
button = KEY_SELECT
config = echo "irexec test" >/tmp/irexec.txt
end

and restarted irexec:

sudo systemctl restart irexec

Then when I pressed the Home key on my remote, which sends KEY_SELECT,
it created a /tmp/irexec.txt file with the "irexec test" text, as
expected. Then I edited /etc/lirc/irexec.lircrc to this:

begin
prog = irexec
button = KEY_SELECT
config = echo "irexec test"
end

and restarted irexec again. Pressing Home three times gave this from
a "journalctl --unit=irexec" command:

-- Logs begin at Sat 2020-04-18 03:07:45 NZST, end at Tue 2020-05-19
21:38:15 NZST. --
May 19 21:32:14 mypvr systemd[1]: Started Handle events from IR
remotes decoded by lircd(8).
May 19 21:36:02 mypvr systemd[1]: Stopping Handle events from IR
remotes decoded by lircd(8)...
May 19 21:36:02 mypvr systemd[1]: Stopped Handle events from IR
remotes decoded by lircd(8).
May 19 21:36:02 mypvr systemd[1]: Started Handle events from IR
remotes decoded by lircd(8).
May 19 21:37:53 mypvr systemd[1]: Stopping Handle events from IR
remotes decoded by lircd(8)...
May 19 21:37:53 mypvr systemd[1]: Stopped Handle events from IR
remotes decoded by lircd(8).
May 19 21:37:53 mypvr systemd[1]: Started Handle events from IR
remotes decoded by lircd(8).
May 19 21:38:13 mypvr irexec[5393]: irexec test
May 19 21:38:14 mypvr irexec[5393]: irexec test
May 19 21:38:15 mypvr irexec[5393]: irexec test

And this from "journalctl -b0 /usr/bin/irexec":

-- Logs begin at Sat 2020-04-18 03:07:45 NZST, end at Tue 2020-05-19
21:38:15 NZST. --
May 19 21:38:13 mypvr irexec[5393]: irexec test
May 19 21:38:14 mypvr irexec[5393]: irexec test
May 19 21:38:15 mypvr irexec[5393]: irexec test

So when the output is not redirected to a file, systemd puts the
output into the journal files.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Raspberry Pi 4 FrontEnd Remote Control Issues [ In reply to ]
Hi Stephen!

> Some things to check. Is irexec running?
>
> sudo ps -ef | grep irexec
pi 2095 852 0 13:55 pts/0 00:00:00 grep –color=auto irexec

Quite frankly not all that conclusive to me, though that H:M:S of all
zeros is a little suspicious. So ran *service irexec status* and got an
‘inactive (dead)’ result. Seems to confirm my suspicion.


> What log output do you get from irexec? I am not sure exactly where
> the irexec service will be logging things, but it should show up
> somewhere. What do these commands show?
>
> sudo systemctl status irexec
> sudo journalctl --unit=irexec
> sudo journalctl -b0 /usr/bin/irexec

pi@RPi-MythFE:~ $ sudo systemctl status irexec


? irexec.service - Handle events from IR remotes decoded by lircd(8)

Loaded: loaded (/lib/systemd/system/irexec.service; disabled; vendor
preset: enabled)

Active: inactive (dead)

Docs: man:irexec(1)

http://lirc.org/html/configure.html

http://lirc.org/html/configure.html#lircrc_format



pi@RPi-MythFE:~ $ sudo journalctl --unit=irexec

-- Logs begin at Mon 2020-05-18 18:36:22 CDT, end at Tue 2020-05-19
14:06:30 CDT. --

-- No entries --

pi@RPi-MythFE:~ $



pi@RPi-MythFE:~ $ sudo journalctl -b0 /usr/bin/irexec

-- Logs begin at Mon 2020-05-18 18:36:22 CDT, end at Tue 2020-05-19
14:07:14 CDT. --

-- No entries --

pi@RPi-MythFE:~ $



OK, so those results weren’t unexpected as we had found out irexec
wasn’t running. Reading ahead a bit found /sudo systemctl restart
irexec/ so let’s see what /sudo systemctrl start irexec/does:

Now /service status irexec/says is active (running). (Good!) rerun the
above tests….


pi@RPi-MythFE:~ $ sudo systemctl status irexec

? irexec.service - Handle events from IR remotes decoded by lircd(8)

Loaded: loaded (/lib/systemd/system/irexec.service; disabled; vendor
preset: enabled)

Active: active (running) since Tue 2020-05-19 14:12:12 CDT; 3min 52s ago

Docs: man:irexec(1)

http://lirc.org/html/configure.html

http://lirc.org/html/configure.html#lircrc_format

Main PID: 2235 (irexec)

Tasks: 1 (limit: 4915)

Memory: 300.0K

CGroup: /system.slice/irexec.service

??2235 /usr/bin/irexec /etc/lirc/irexec.lircrc


May 19 14:12:12 RPi-MythFE systemd[1]: Started Handle events from IR
remotes decoded by lircd(8).

pi@RPi-MythFE:~ $


pi@RPi-MythFE:~ $ sudo journalctl --unit=irexec

-- Logs begin at Mon 2020-05-18 18:36:22 CDT, end at Tue 2020-05-19
14:16:47 CDT. --

May 19 14:12:12 RPi-MythFE systemd[1]: Started Handle events from IR
remotes decoded by lircd(8).

pi@RPi-MythFE:~ $


pi@RPi-MythFE:~ $ sudo journalctl -b0 /usr/bin/irexec

-- Logs begin at Mon 2020-05-18 18:36:22 CDT, end at Tue 2020-05-19
14:17:13 CDT. --

-- No entries --

pi@RPi-MythFE:~ $



So that appears to be good news! Test the remote…. Well, I would have
loved to have said the thing now worked but no.


> Getting irexec to work as well is just icing on the cake. But it too
> should work, with the right config. So for testing purposes, I would
> suggest:
>
> config = echo "irexec test" >/tmp/irexec.txt

Huh: I just switched SD cards to test on a ‘temporary system’ – the
irexec service is up and running – I was not expecting that. /sudo
systemctl status irexec/says it has been running for 20 hours, which I
find odd as that card removed last night and I just installed it.

Other two look the same except for the timestamps

Probably insignificant, just saying something if it is.


Back to testing: /config = echo "irexec test" >/tmp/irexec.txt/

Again to be nitpicky, mainly because you mentioned permissions, I had to
/mkdir tmp/as wasn’t present. Properties: owner = pi, group = pi, view
content = anyone, change content = only owner (so pi), access content =
anyone.



> sudo systemctl restart irexec

Well that wasn’t impressive – /tmp is empty.

Reboot, check irexec status, test; nope.



> begin
> prog = irexec
> button = KEY_SELECT
> config = echo "irexec test"
> end

I left in as /echo "irexec test" >/tmp/irexec.txt/so see if would now
write to the file. Darn. :(


Edit out my test….

and restarted irexec again. Pressing Home three times gave this from
a "journalctl --unit=irexec" command:

My results:


pi@RPi-MythFE:~/tmp $ sudo journalctl --unit=irexec

-- Logs begin at Tue 2020-05-19 15:00:47 CDT, end at Tue 2020-05-19
15:11:35 CDT

May 19 15:00:50 RPi-MythFE systemd[1]: Started Handle events from IR
remotes dec

May 19 15:08:40 RPi-MythFE systemd[1]: Stopping Handle events from IR
remotes de

May 19 15:08:40 RPi-MythFE systemd[1]: irexec.service: Main process
exited, code

May 19 15:08:40 RPi-MythFE systemd[1]: irexec.service: Succeeded.

May 19 15:08:40 RPi-MythFE systemd[1]: Stopped Handle events from IR
remotes dec

May 19 15:08:40 RPi-MythFE systemd[1]: Started Handle events from IR
remotes dec

May 19 15:10:17 RPi-MythFE systemd[1]: Stopping Handle events from IR
remotes de

May 19 15:10:17 RPi-MythFE systemd[1]: irexec.service: Main process
exited, code

May 19 15:10:17 RPi-MythFE systemd[1]: irexec.service: Succeeded.

May 19 15:10:17 RPi-MythFE systemd[1]: Stopped Handle events from IR
remotes dec

May 19 15:10:17 RPi-MythFE systemd[1]: Started Handle events from IR
remotes dec

May 19 15:11:07 RPi-MythFE irexec[945]: irexec test

May 19 15:11:08 RPi-MythFE irexec[945]: irexec test

May 19 15:11:09 RPi-MythFE irexec[945]: irexec test

lines 1-15/15 (END)



pi@RPi-MythFE:~/tmp $ sudo journalctl -b0 /usr/bin/irexec

-- Logs begin at Tue 2020-05-19 15:00:47 CDT, end at Tue 2020-05-19
15:14:11 CDT

May 19 15:11:07 RPi-MythFE irexec[945]: irexec test

May 19 15:11:08 RPi-MythFE irexec[945]: irexec test

May 19 15:11:09 RPi-MythFE irexec[945]: irexec test

lines 1-4/4 (END)


OK, you know me well enough you probably guessed what I did! Yes, tried
to see if the old config to load Myth would work. Nothing; did put in a
new line to journalctl -b0… still “irexec test” though. Ah! restart
irexec ==> nope but journalctl -b0’s message was:


May 19 15:21:03 RPi-MythFE irexec[945]: irexec test /<== the old test/

May 19 15:25:52 RPi-MythFE irexec[1109]: /bin/sh: 1: echo <mypassword> |
su -l pi -c /home/pi/Load_MythFE.sh: not found


My config line starts at “echo”; no idea where “/bin/sh :1:” originates.


OK, tried without the quote marks (config = echo pswd blah-blah-blah).
Nothing, nothing... about to check journalctl and MythTV pops up!!
Woohoo!!!!


Shutdown, power switch off, … power up – at Desktop, push button – still
works! Yea!!!!


Thank you!! Barry

1 2  View All