Forward keyboard event to OS or use System.Exec

Hi and thanks for this great OS! I’m using latest version on a Odroid N2+ (CoreELEC (official): 9.2.5 (Amlogic-ng.arm)).

I’m using it as a “Kodi box” for movies and tv shows and as a music player (with mpd addon and mympd webUI).
All is working great except the remote (harmony remote) with mpd, I’ve tried different things:

First I added <f1>System.Exec("/storage/")</f1> in Keyboard.xml --> working but unreliable (sometimes I need to click 4-5 times before my script is run)

Then I removed it and installed Triggerhappy from entware. It’s working great and is always responsive but it needs kodi to be stop (systemctl stop kodi). So I’m stopping Kodi (Keyboard.xml --> <f11>System.Exec("/storage/")</f11>) when I want to listen to music and starting it with triggerhappy when I want to use it. It’s not optimal as it’s giving me error (Failed to add /run/systemd/ask-password to directory watch: inotify watch limit reached) and kodi have turned irresponsive a few times.

So, finally, here are my questions :
If I go back to a kodi based solution, is it possible to make System.Exec (or another way) responsive ? How ?
If I keep triggerhappy:

  • can I forward events (keypresses) to the OS because Kodi seems to be blocking them ?
  • or can I “pause” Kodi so it won’t intercept event and unpause it after ?

Hope my questions are complete and that the help I may find could help others !

For System.Exec make kodi log and enable debug mode in it’s settings. Are you sure it is not your script who doesn’t do it’s job on first call?

Thanks for your help, I logged keypress event and, of course, I wasn’t able to have bugs… Here is the log part:

2020-12-04 13:56:30.604 T:4060137312 DEBUG: Keyboard: scancode: 0x3b, sym: 0x011a, unicode: 0x0000, modifier: 0x0
2020-12-04 13:56:30.604 T:4060137312 DEBUG: HandleKey: f1 (0xf090) pressed, action is System.Exec("/storage/")
2020-12-04 13:56:30.683 T:4040401792 INFO: CAESinkALSA - Unable to open device “default” for playback
2020-12-04 13:56:30.700 T:4040401792 INFO: CAESinkALSA - Unable to open device “sysdefault:CARD=AMLAUGESOUND” for playback
2020-12-04 13:56:30.708 T:4040401792 INFO: CAESinkALSA - Unable to open device “hdmi:CARD=AMLAUGESOUND,DEV=0” for playback

I let the information about ALSA because it happens every time I press the key and I don’t know if it can be related. (it may be because mpd is getting the audio card busy)

I’ll try to catch log with error and report back!

My script are pretty simple and work on CLI and most of the time from kodi, they all look that way:

/storage/.kodi/addons/service.multimedia.mpd/bin/mpc toggle
exit 0

I doubt System.Exec is a problem but mpc toggle action. Maybe it doesn’t work first time. That’s why you must press key few times. But command is executed on every press.

That’s what I’m also thinking, I’ve changed “Toggle” to a more classical “Play/Pause” set of commands and I didn’t had any problem since.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.