Howto/suspend

'''Be careful with this script! I do not assume responsibility for any things that happen when using. It may be considered a dirty hack. But as it works for me. You may find a way to make it bette! Please feel free to make it better! '''

Howto suspend extension for TV-Viewer with pm-utils:
''The intention of the script is: You can not unload the kernelmodule if it is used by tv-viewer. So it will free the module in order that it can be either unloaded or do it's internal powersaving stuff.

It uses several bash functions and may be considered a quite dirty hack. But it does the thing it should to me. - Tested and working on OpenSuSE 12.1 64 Bit. With Hauppauge PVR 150 - ...

My script detects on suspend if tv-viewer was started. If it was started, it will start to work and see if playback is running. For the case that playback is running, when going to suspend the computer, it will stop playback. Save the information that playback was running to a file in tv-viewers internal /tmp/ structure and restart the playback after resume from standby.

If playback was not running, when going to powersaving, it will start to work but decide to not do anything currently.''

The source:
Here you can find the Powersaving Script ( Last update: 2012-10-26 )

Naming and placing the file:
''This suspend extension for TV-Viewer works as suspendhook within pm-utils. The filename is case sensitive and has to wear the '00aa_' at the beginning. It must be set as executable and should be placed in: /etc/pm/sleep.d/00aa_tvcard_tv-viewer. On my system the structure is owned by root.''

cp /(your downloadlocation)/00aa_tvcard_tv-viewer /etc/pm/sleep.d/00aa_tvcard_tv-viewer chown root.root /etc/pm/sleep.d/00aa_tvcard_tv-viewer chmod +x /etc/pm/sleep.d/00aa_tvcard_tv-viewer

If your used driver is powermanagement capable, that should have been the necessary steps and the script should work instantly.

Handle problematic modules
''Please verify that your kernel modules for the tv card support the powersaving actions or make pm-utils handle the corresponding driver properly. You can test by issueing pm-suspend, into a terminal. When testing, the card should not be used. Best would be, after a fresh reboot. In the rare cases that your tv-card gets stuck on suspend or that the whole system hangs, because of the tv-card or any other modules, you can create a copy of the default configuration and add these modules to a section in these steps: '' cp /usr/lib/pm-utils/defaults /etc/pm/config.d/unload_module

Add your problematic modules to this line: and uncomment it: SUSPEND_MODULES=""

Some of the modules which are currently and often known to be problematic are: *802 ndiswrapper forcedeth *8139* ehci-hcd uhci-hcd *usb* *1394 *hid* and tv-cards like ivtv bttv and btusb;

Detect known problem modules
You can check by issueing this in your terminal: lsmod | grep -iE '802|ndiswr|forced|8139|hci|usb|1394|hid|..tv'

''For the case that you have some of the modules loaded by default. You can now add them to "SUSPEND_MODULES="; And they will be unloaded and reloaded safely. This requires some testing. Even if you have these special modules, it does not definitively mean that they are problematic. So please only add problematic modules.

For my Hauppauge PVR 150 the line looks like this:'' SUSPEND_MODULES="wm8775 cx25840 tuner ivtv cx2341x tveeprom lirc_dev lirc_igorplugusb"

After my last distupgrade to SuSE 12.2 i had to change the line to:'' SUSPEND_MODULES="ivtv tuner cx25840 cx2341x tveeprom wm8775 lirc_dev lirc_igorplugusb"

As the order and the dependencies of the modules seem to change in this release.

Nothing helped!
''If this did not help to get your powersaving working, you can not use this script. It is absolute necessary that either your cards driver supports powersaving or that you are able to let it be loaded/unloaded automatically.

You can find further informations about configuring pm-utils in its documentation. Also see "man pm-utils".

Check for errors of the script:
My script produces some little output. In an error case, it should report what was wrong. On SuSE i can find the output in:'' /var/log/pm-suspend.log

Beer
Have fun!

Greetings,

R Wild-Thing;;

http://tv-viewer.sourceforge.net/