You are not logged in.
I have a media player pc, connected to my video projector. I'm using kodi and tvheadend with dvb-t tuner to watch television.
The problem is that the tvheadend.service starts, but I get a message in kodi, that no dvb input is available or something similar. The workaround so far, is to connect via ssh from my phone and restart the tvheadend .service. After restarting immediately it works as expected, and I have TV.
But since I'm using a remote to control kodi, (working via ir-keytable and no lirc) I would like to press a button and have the tvheadend.service restart without having to ssh the machine.
Does anyone have an idea on how to do it?
Chatgpt suggested a udev rule, but there was no way to make it work. I tried acpid as well, but It doesn't work either. I could not see any events with acpi_listen.
Please help me to relax, without having to deal with ssh at the end of my day
Last edited by capthookb (2024-10-09 17:18:48)
Offline
I was going to ask you why you'd even consider a udev rule for this - but now I just want to know why you'd ask chatGPT such a question. Forget that approach. I thought your title might be an X-Y question, but it's actually a new subspecies: an X-GPT question.
All you want to do is bind a command to a key / button press. I'm not sure how Kodi handles bindings, but I'm pretty sure it has a configuration for this. Alternatively you could run a generic tool like xbindkeys.
The first step though is knowing what button you want to use on the remote and what button / keysym signal it emits: xev is good for testing this.
Last edited by Trilby (2024-10-03 18:03:56)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
https://wiki.archlinux.org/title/Kodi#U … te_control
Kodi can run python scripts, see eg. https://forum.kodi.tv/showthread.php?tid=365690 on how to get from there to random stuff ("os.system(…)")
However:
The problem is that the tvheadend.service starts, but I get a message in kodi, that no dvb input is available or something similar. The workaround so far, is to connect via ssh from my phone and restart the tvheadend .service. After restarting immediately it works as expected, and I have TV.
The service likely starts too early, before the dvb device is ready.
Instead of wasting hours now on trying to figure what that device is, waste the hours over the next years and just have "ExecStartPre=sleep 5" in the service to delay it by 5 seconds (you can fiddle w/ that value)
Offline
The service likely starts too early, before the dvb device is ready.
Instead of wasting hours now on trying to figure what that device is, waste the hours over the next years and just have "ExecStartPre=sleep 5" in the service to delay it by 5 seconds (you can fiddle w/ that value)
along with the sleep - isn't there an option to make one service depend on another? i.e. instead of the sleep just have tvhead start after that dvb one?
Offline
You're probably rather waiting for a device node than another service.
That's also possible to track, but you'd first need to know what device(s) you're waiting for.
The OP needs to restart https://wiki.archlinux.org/title/Tvheadend
Offline
Guys, thank you for replying.
Xev or xbindkeys will not work since I am not using xserver at all. I have kde under Wayland installed but Icm not loading kodi under KDE.
I'm running kodi in gbm mode which is the most feature rich way to run it.
The remote works with ir-keytable and I can see the key being pressed using evtest. But how can I bind the key press with a script?
It is basically the same thing that I would need to figure out if I wanted to press e.g F1 in order to launch a script. How can I fo that?
I tried adding a systemctl restart tvheadend in kodi-gbm.service under the ExecStartPost setting, but this doesn't always work.
Seth, I will try to play with the sleep value. Probably you are correct because the web Interface of tvheadend does not have a dvb device it can use, up until I restart the service.
However it would be useful to have buttons on my remote launcing scripts. I would like to be able to restart kodi, adjust settings onmy sound card, poweroff tge system with a simple button, create a script like a timer to shutdown after x minutes etc.
Offline
However it would be useful to have buttons on my remote launcing scripts
Kodi can run python scripts, see eg. https://forum.kodi.tv/showthread.php?tid=365690 on how to get from there to random stuff ("os.system(…)")
xev (through xwayland) will most likely still tell you the relevant keysymbol since the wayland input code is lifted from xkb.
Offline
Seth, thank you for your insight. Indeed, I measured the time tvheadend was starting and the DVB device was not ready yet. I added a delay, and now the tvheadend service starts normally!
I was trying to figure out the udev rules as well, but I read that udev is not very reliable for keystrokes. It is more suitable for events like usb connect disconnect, etc.
I will now fiddle with kodi and buttons to run my other custom scripts.
Thank you guys!
Offline
\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline