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

NetworkManager no wakeup on Ubuntu

Since the last six months I have an issue with my NetworkManager, sometimes it doesn’t wakup correctly after a standby or suspend.  After some test I found that the problem comes out each time the suspend/standby procedure freezes the system and I have to manually shutdown. To make the NetworkManager the only way is to standby and wakup my laptop.

After several tests I found out what happens and a small workarround.

On my laptop I have an hardware issue with my webcam, the cable which connects the camera to the motherboard throught the monitor is a little bit loose, so sometimes the camera generates an error. This error causes a seg fault in the linux kernel. This seg fault prevents the webcam module to stanby corretly and my laptop freezes during standby cycle. This happens after the NetworkManger has entered the standby cycle in which the network gets disabled.

Now I have to manually power off the laptop, and turning the laptop on again doesn’t run the wakeup cycle,  in the wakup cycle the NetworkManager enables the network again. So my network remains disabled until I run the wakeup cycle.

The first workarround is to standby/wakup the laptop, the second workarround is to run the wakeup command manually:

sudo dbus-send –print-reply –system –dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.wake

I thing this issue comes out each time a suspend/standby isn’t followed by a wakeup (ex: battery runs out) .

Hope this helps others 🙂

WP to LinkedIn Auto Publish Powered By : XYZScripts.com