Posts: 64
Joined: Nov 2010
Reputation:
0
I have tvheadend set up and working great. However when the box goes into sleep, when it resumes I can't play any live TV. "no free adapter available".
Restarting the box fixes it. I have doubled checked and there's no other PVR add-ons that could be using the card.
I'm using openelec.
I can only seem to find similar issues where restarting the box causes this. But restarting the box for me fixes it! Only caused by resuming from sleep.
Has anyone encountered this before?
Thanks
Posts: 47
Joined: Jun 2016
Reputation:
2
I know this problem quite well. Although i dont use openelec.
I set up a normal lubuntu 16.04 and start into kodi on startup. But I encountered your problem because my system didnt unmount the driver for m tv-card when going to sleep. so the adapter is already in use, when you resume.
As I use lubuntu 16.04 and systemd and I am only a user not a developer I kinda did try and error and solved the problem for me.
If you are interested I can share my config with you.
Posts: 64
Joined: Nov 2010
Reputation:
0
Yes please ninjafuchs that would be great.
I think I remember seeing an option relating to unmounting, but it was a text entry field and I didn't know what to enter or what it required..
Posts: 47
Joined: Jun 2016
Reputation:
2
2017-09-14, 11:23
(This post was last modified: 2017-09-14, 11:24 by ninjafuchs.)
Maybe that is something, that you could try out.
I for myself wrote a little service file.
First you have to find out which modules you have to unload.
you can use: dmesg|grep DVB or lsmod|grep dvb
so my modules are: budget, budget_core, dvb_core and saa7146
Unfortunately the order of unmounting and mounting seems to have influence on this topic.
So you need sudo rights and create a file:
I chose: /etc/systemd/system/kodi-suspend.service
and wrote in it:
[Unit]
Description=stop tvheadend, dvb-module und xbox-controller treiber
Before=sleep.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/systemctl stop tvheadend.service
ExecStart=/sbin/modprobe -r budget
ExecStart=/sbin/modprobe -r budget_core
ExecStart=/sbin/modprobe -r dvb_core
ExecStart=/sbin/modprobe -r saa7146
ExecStop=/sbin/modprobe saa7146
ExecStop=/sbin/modprobe dvb_core
ExecStop=/sbin/modprobe budget_core
ExecStop=/sbin/modprobe budget
ExecStop=/bin/systemctl start tvheadend.service
[Install]
WantedBy=sleep.target
afterwards save the file and enable it with this command:
sudo systemctl enable kodi-suspend.service
I hope this will help you. Again I like to point out that this worked for me and I dont use openelec (never tried it) and I am on a lubuntu 16.04 system with systemd.
Posts: 47
Joined: Jun 2016
Reputation:
2
I am sorry to disappoint you but, but this is beyond my knowledge. But I think that you almost found all modules.
But for testing you can try to unmount the modules one after the other and mount them afterwards manually.
Maybe this will give you a hint to the correct order.
See this topic kept me testing for days. Maybe there is a other way, but I simply dont know it.
Posts: 64
Joined: Nov 2010
Reputation:
0
Is there any logs or anywhere to check if the unmounting is happening and happening correctly?
Also is there a way I can simulate the sleep, (unmounting and mounting manually and then restarting tvheadend manually?) so I can try different combinations without having to reboot / sleep and wake the machine each time?
Posts: 47
Joined: Jun 2016
Reputation:
2
Of course is this possible.
Just try and execute every line after the other (without the ExecStart or ExecStop in the beggining but most likely you will need sudo rights).
If nothing is returned then the command succeded. If there is a return something went wrong.
Posts: 3
Joined: Sep 2017
Reputation:
0
This is pretty puzzling to me. I have the same issue using an hdhomerun device on LibreELEC. I can see in the tvheadend web gui that the adapters are not there after resume. I don't really see anything that I can identify as a related kernel module, nothing like the modules mentioned above. Mostly what I see in journalctl is errors relating to the system trying to run user space drivers like dvb_hdhomerun and dvb_hdhomerun_fe in a startup script. Everything in the journalctl entries has tvheadend as part of the message. I would be very curious and grateful if someone could point me in the right direction to solve this issue.
Posts: 64
Joined: Nov 2010
Reputation:
0
I actually switched to Libreelec from openelec to see if that would solve the issue for me but it hasn't. I need to try and do more manual testing of manually unmounting and remounting. But I'm not quite sure what I should be looking for our checking when doing it manually to confirm it is working.