Linux suspend issues

It’s been quite a lot of time that mi HTPC remained turned on, when I tried to suspend the system I had plenty of issues.

First issue is that dvb didn’t resume correctly generating a lot of “m88ds3103 0-0069: i2c wr failed=-6″ errors.” after resume and DVB not working at all. For a HTPC it’s a big issue since the main purpose of the HTPC is view dvb content. It seemed I just needed to remove the m88ds3103 module and insert it again after suspend. Sadly the module showed three usages

htpc@htpc:~$ lsmod |grep m88
m88ds3103 32768 3 cx23885

Removing the cx23885 module still show 2 usages without any clear indication of what is going on:

htpc@htpc:~$ lsmod |grep m88
m88ds3103 32768 2

No way to remove the module. After various tentative I identified the module that kept m88ds3103 busy, it’s the smipcie module, so to remove the m88ds3103 module I first need to remove the smipcie module. From my point of view this should be considered a defect either in the lsmod or in the module itself, since no dependency module is identified.

the second issue is related to the HTPC waking up just after suspending. Again after some researches I found the the HTPC wakes up on any kind on USB UHC event, this means constantly. I found no way to disable this as configuration. So I created my own hook for the suspend, it just disables wake up on USB/UHC before going to sleep executing echo “UHC1” > /proc/acpi/wakeup for all the peripherals.

With this two patches the suspend works smoothly, it just take a while to stop mythtv-backend, but otherwise no issues.

The script is named /usr/lib/pm-utils/sleed.d/50htpc to be put in the folder /usr/lib/pm-utils/sleed.d/

This is the code:

. "${PM_FUNCTIONS}"
suspend_htpc()
{
    service mythtv-status stop
    service mythtv-backend stop
    rmmod cx23885
    rmmod smipcie
    rmmod m88ds3103
     devices="UHC1 UHC2 USB3 UHC4 USB5 UHC6 UHC7"
    for device in ${devices}; do
            if grep -qw ^$device.*enabled /proc/acpi/wakeup; then
                    sudo sh -c "echo $device > /proc/acpi/wakeup"
            fi
    done
}
resume_htpc()
{
   modprobe m88ds3103
   modprobe smipcie
   modprobe cx23885
   service mythtv-backend start
   service mythtv-status start
}
case "$1" in
 hibernate|suspend)
 suspend_htpc
 ;;
 thaw|resume)
 resume_htpc
 ;;
 *) exit $NA
 ;;
 esac
WP to LinkedIn Auto Publish Powered By : XYZScripts.com