Hi all,
I'm building a VDR server. This server uses a DVB-T USB receiver. This all works, until I do the following. When I watch live TV, and then suspend, my machine never shuts down. It also doesn't resume anymore.
The problem is that the driver for the USB receiver does not like to suspend while in use.
To work around this, I would like to stop VDR, wait until it is stopped, unload the driver of the receiver, perform the suspend. (The power will then be removed from the USB receiver, so it's reset) On resume, first load the driver, wait until the receiver is fully initialized, and then start VDR again.
I have read the following article on the wiki. It tells me howto monitor the process, and that the configuration files are here:
/var/log/pm-suspend.log
/usr/lib/pm-utils/pm-functions
https://wiki.debian.org/Suspend
Does anybody has an example of howto do this?
Best regards,
Cedric
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
stop a process before suspend, and start it after resume
Re: stop a process before suspend, and start it after resume
Me again,
I have figured out the steps I have to do manually:
{{{
# invoke-rc.d vdr stop
# rmmod dvb_usb_dib0700
# pm-suspend
<<< Press power button >>>
# modprobe dvb_usb_dib0700
# invoke-rc.d vdr start
$ vdr-sxfe
}}}
Now let's see if I can do these automatically:-)
Regards,
Cedric
I have figured out the steps I have to do manually:
{{{
# invoke-rc.d vdr stop
# rmmod dvb_usb_dib0700
# pm-suspend
<<< Press power button >>>
# modprobe dvb_usb_dib0700
# invoke-rc.d vdr start
$ vdr-sxfe
}}}
Now let's see if I can do these automatically:-)
Regards,
Cedric
Re: stop a process before suspend, and start it after resume
Me again,
Progress. I have added the following new file. On suspend it adds a date line to a file.
This added a date line each time on suspend:
# tail -f ~/data.txt
Hi, today is Fri Dec 6 12:12:53 CET 2013
Best regards,
Cedric
Progress. I have added the following new file. On suspend it adds a date line to a file.
Code: Select all
#!/bin/sh
# Shutdown VDR and unload driver to not crash during suspend
. "${PM_FUNCTIONS}"
case "$1" in
hibernate|suspend)
echo "Hi, today is $(date)" >> ~/date.txt
;;
esac
# tail -f ~/data.txt
Hi, today is Fri Dec 6 12:12:53 CET 2013
Best regards,
Cedric
Re: stop a process before suspend, and start it after resume
It's me again.
I have now the following script. When the USB receiver is not present, the machine does come back from suspent, but the filesystem is not mounted. Maybe this is because the modprobe or the rmmod throws an error:
# cat /usr/lib/pm-utils/sleep.d/00vdr-and-modules
I've got to investigate if this is the problem. Does anybody know howto mask the error?
Regards,
Cedric
I have now the following script. When the USB receiver is not present, the machine does come back from suspent, but the filesystem is not mounted. Maybe this is because the modprobe or the rmmod throws an error:
# cat /usr/lib/pm-utils/sleep.d/00vdr-and-modules
Code: Select all
#!/bin/sh
# Shutdown VDR and unload driver to not crash during suspend
. "${PM_FUNCTIONS}"
echo "We are now doing $1" >> ~/date.txt
case "$1" in
hibernate|suspend)
echo "$(date) About to stop VDR" >> ~/date.txt
invoke-rc.d vdr stop
echo "$(date) About to unload module" >> ~/date.txt
rmmod dvb_usb_dib0700
echo "$(date) About to write resume time" >> ~/date.txt
;;
resume)
echo "Seen resume" >> ~/date.txt
echo "$(date) About to load module" >> ~/date.txt
modprobe dvb_usb_dib0700
echo "$(date) About to start VDR" >> ~/date.txt
invoke-rc.d vdr restart
echo "$(date) Done" >> ~/date.txt
;;
esac
Regards,
Cedric
Re: stop a process before suspend, and start it after resume
I'd recommend trying as a first step using bash instead of sh, as it will not exit the script on error by default.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan
Re: stop a process before suspend, and start it after resume
Thanks, using bash was indeed the solution.
Now the only thing to figure out is to let VDR initiate the suspend, and write the wake-up time to the rtc.
Best regards,
Cedric
Now the only thing to figure out is to let VDR initiate the suspend, and write the wake-up time to the rtc.
Best regards,
Cedric