Debugging, log keyboard entries seen by frontend?

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Debugging, log keyboard entries seen by frontend?

Post by mathog »

The EPG navigation isn't working well on our system, most likely because of multiple key hits from the remote control on keys like "3". Which is a bit odd because other keys, including arrow keys, are working OK. I know how to make "lirc" display all the IR events it is seeing, but not how to make the mythfrontend program log each and every keystroke it responds to. How does one do that???

"lirc" is configured as it was before the upgrade, at which time it didn't have this issue. So it may be that there is another IR monitoring module/program running, even though I have not been able to find it. Being able to see what keys the frontend is actually seeing would be a big help in resolving this.

Thanks.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

Anybody? There are the "mythfrontend -v" options, but none of those listed with "-v help" sounds appropriate. No "input", "key", or even "event".
User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Debugging, log keyboard entries seen by frontend?

Post by paulh »

There is no extra debugging you can enable for that. The only thing you can do is add extra logging in appropriate places and recompile which may not be something you want to do.

It's possible what has happened is your remote now has in kernel support that makes remotes look and act like small keyboards with limited keys. So both lirc and the in kernel devinput are both generating key presses for some keys like the number keys. The way forward is to remove/disable lirc and switch to using the devinput in kernel stuff if it is that causing your problems.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

paulh wrote:
Thu Feb 01, 2018 7:26 am
There is no extra debugging you can enable for that. The only thing you can do is add extra logging in appropriate places and recompile which may not be something you want to do.
Maybe the developers could add it? I am a little surprised that it isn't already there.
paulh wrote:
Thu Feb 01, 2018 7:26 am
It's possible what has happened is your remote now has in kernel support that makes remotes look and act like small keyboards with limited keys. So both lirc and the in kernel devinput are both generating key presses for some keys like the number keys. The way forward is to remove/disable lirc and switch to using the devinput in kernel stuff if it is that causing your problems.
That could be what is going on but it seems pretty unlikely. The only IR receiving device on the system is the HDHomeRun and lirc had to be specially configured with its ip address/port to know where to get its IR data. The kernel would need to be pretty darn smart to figure that out all by itself. Also lsmod doesn't show anything which looks appropriate and none of the support software (ir-keytables) is present.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

It is possible that strace may be able to do this, it depends on how mythfrontend handles single key events.
I tested it with nano, and for a nano session with pid PID this running in another window

Code: Select all

   strace -tt -e trace=read -e read=0 -p $PID
showed each character as it was pressed in the nano application.

The method was suggested in this thread:

https://stackoverflow.com/questions/485 ... gram-linux
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Debugging, log keyboard entries seen by frontend?

Post by dizygotheca »

It doesn't sound like a lirc issue.
Are you talking about the EPG number keys jumping between channels (& the time-out), as in Live TV ?
The wiki suggesting they act like Page Up etc is wrong/out-of-date IMO.
It's odd if you don't realise what it is doing...

There is an (undocumented) theme element that shows the channel input but I'm not aware of any themes that use it.
You can enable it by adding

Code: Select all

<textarea name="jumptotext">
     <area>0,0,100,36</area>
</textarea>
to the schedule-ui.xml "programguide" window of a theme.
Post back if you need more details.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

dizygotheca wrote:
Fri Feb 02, 2018 12:23 am
It doesn't sound like a lirc issue.
Are you talking about the EPG number keys jumping between channels (& the time-out), as in Live TV ?
In the EPG the "3" key, for instance, jumps vertically either "a lot" or "all the way to the end". It used to go up and down a page at a time. However, while the navigation is hard to control, it stays in the EPG.
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Debugging, log keyboard entries seen by frontend?

Post by dizygotheca »

Sounds right! It's jumping to the next channel id/number that begins with a '3', '33' etc.

Puzzling how "it's changed" because it's been like that since 0.24.
https://github.com/MythTV/mythtv/commit ... bb487bc7b7
But then I saw another thread where you say you've just updated from 0.21...

I see no TV Frontend/PAGEDOWN key binding.
The only way to bind key '3' to Global/PAGEDOWN is to unbind it from the 3 number, which may be problematic elsewhere.
Try binding another key to Global/PAGEDOWN instead.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

dizygotheca wrote:
Fri Feb 02, 2018 11:17 pm
Sounds right! It's jumping to the next channel id/number that begins with a '3', '33' etc.
That would be OK, but that isn't what it is doing.

If I start on 4_2 and push "3" on the control (key "three" bound to "3") it goes to 2_2. Push it again and nothing happens. Push it once more and it goes to 32. That has a 3, but there is 31_* below it and 34* above it, so it is probably a coincidence.
dizygotheca wrote:
Fri Feb 02, 2018 11:17 pm
Puzzling how "it's changed" because it's been like that since 0.24.
https://github.com/MythTV/mythtv/commit ... bb487bc7b7
But then I saw another thread where you say you've just updated from 0.21...

I see no TV Frontend/PAGEDOWN key binding.
The only way to bind key '3' to Global/PAGEDOWN is to unbind it from the 3 number, which may be problematic elsewhere.
Try binding another key to Global/PAGEDOWN instead.
Yeah, we were happy with 0.21 but had to rebuild due to a disk problem, and pretty much had to upgrade everything.
Last edited by mathog on Sat Feb 03, 2018 6:15 am, edited 1 time in total.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

Code: Select all

   strace -tt -e trace=read -e read=0 -p $PID
Does not help, unfortunately. The frontend.real does read from stdin but it is a steady stream of data unrelated to key presses. It looks like this (the first 1 in the double quote section sometimes changes value.)

Code: Select all

21:19:31.883917 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
21:19:31.898031 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
21:19:31.912164 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
21:19:31.926327 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
21:19:31.940442 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
21:19:31.954577 read(5, "\1\0\0\0\0\0\0\0", 16) = 8
It must pull in the keypress information some other way. It might still be possible to use strace to read it, but I would need to have some idea where and what the method was.

A keyboard was plugged into the computer and pressing numeric values in the EPG jumps around in the same hopeless way that it does for the remote. So the problem isn't with the remote, it is with mythfrontend.real navigation, which at least means we don't need to mess about any more with strace.

Using the keyboard PageUp/PageDown/Home/End on the keyboard enabled the desired EPG navigation. Unfortunately there are no more keys on the remote to which those might be bound. What I really need is the original program behavior for the numeric keys. Equivalently, a way to map the number keys to PageUp/PageDown/Home/End solely within the context of the EPG. Surely there is some way to do this with a remote, no keyboard required?

https://github.com/MythTV/mythtv/commit ... bb487bc7b7

Says that the change only takes effect if EPGEnableJumpToChannel is enabled. It doesn't say there, or anywhere else I can find, where in the vast menu tree the setting is which corresponds to that value. That variable isn't listed in the current settings section, or anywhere else, in a SQL dump. Perhaps the option to use the old navigation was later removed from source. If so, as you noted, the wiki does not match the actual behavior at all. Either the wiki is wrong or there is a setting, somewhere, which makes the wiki right, but isn't documented there.

Anybody else care to chime in? How do you navigate in the EPG, and if resembles the old method, any idea what you had to set to get there?

Current version of mythtv is: 2:29.0+fixes.20171223.68e982e-0ubuntu0mythbuntu4
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Debugging, log keyboard entries seen by frontend?

Post by dizygotheca »

Yes, I over-simplified it because I don't understand why it works as it does. US channel numbering is odd...
https://github.com/MythTV/mythtv/blob/m ... .cpp#L1452
https://github.com/MythTV/mythtv/blob/4 ... .cpp#L2273

That commit removed that paticular setting.
The "only takes effect" refers to removing the defaults.

IMO the key bindings should have remained but with no default.
Then you could bind 3 to PAGEDOWN to regain the old behaviour.
Maybe raise a TRAC ticket.
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

dizygotheca wrote:
Sat Feb 03, 2018 11:03 pm
Maybe raise a TRAC ticket.
https://code.mythtv.org/trac/ticket/13214
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Debugging, log keyboard entries seen by frontend?

Post by PhilB »

If you look in your key bindings for TV Frontend, are there any entries which respond to '3' ?
Phil
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

PhilB wrote:
Sun Feb 04, 2018 11:02 am
If you look in your key bindings for TV Frontend, are there any entries which respond to '3' ?
No.

DAYLEFT home (this works with a keyboard)
DAYRIGHT end (this works with a keyboard)
PAGELEFT , < (this works with arrow on remote)
PAGERIGHT > . (this works with arrown on remote)

I bound 7 and 1 to the day actions and now that works.

There are no entries listed under "tv frontend -> actions" which have PageUp or Page Down bound to them. Yet those work with the keyboard to page up and down in the EPG. None of the actions have a number bound to them.

Is it maybe missing "actions" for EPGPageUp, EPGPageDown?

The other question is, if it is really supposed to be jumping to channels by pressing the first number of that channel with a key press, why isn't that working? I am unclear on how that mode is supposed to work. Perhaps some other key must be pressed first to enter that mode?
mathog
Senior
Posts: 125
Joined: Thu Dec 15, 2016 5:22 pm
United States of America

Re: Debugging, log keyboard entries seen by frontend?

Post by mathog »

mathog wrote:
Sun Feb 04, 2018 6:00 pm
PhilB wrote:
Sun Feb 04, 2018 11:02 am
If you look in your key bindings for TV Frontend, are there any entries which respond to '3' ?
No.

DAYLEFT home (this works with a keyboard)
DAYRIGHT end (this works with a keyboard)
PAGELEFT , < (this works with arrow on remote)
PAGERIGHT > . (this works with arrown on remote)

I bound 7 and 1 to the day actions and now that works.

There are no entries listed under "tv frontend -> actions" which have PageUp or Page Down bound to them. Yet those work with the keyboard to page up and down in the EPG. None of the actions have a number bound to them.

Is it maybe missing "actions" for EPGPageUp, EPGPageDown?
Hmm. There are PageUp and PageDown in the global settings, bound to chan+/chan- but one cannot bind 3 and 9 there because it conflicts with the numeric bindings at the same level.

So I guess the question is now, how to enter PageUp and PageDown at the EPG level. In the EPG it seems that chan+,chan- will jump up and down a page, which is helpful. However, it doesn't match the wiki and I still don't see how to make it do so.

The other question is, if it is really supposed to be jumping to channels by pressing the first number of that channel with a key press, why isn't that working? I am unclear on how that mode is supposed to work, can somebody please post an example of exactly what happens for a sequence of key presses? Perhaps some other key must be pressed first to enter that mode?

edit: text was in quote by mistake
Last edited by mathog on Mon Feb 05, 2018 6:03 pm, edited 1 time in total.
Post Reply