Linux wakes immediately from sleep

3

1

From time to time opensuse 12.3 starts to wake up from sleep immediately. I have created a service in /etc/init.d be able to wake up from keyboard and mouse with the following code:

echo enabled > /sys/bus/usb/devices/usb5/power/wakeup
echo enabled > /sys/bus/usb/devices/5-1/power/wakeup
echo enabled > /sys/bus/usb/devices/5-2/power/wakeup

I've also added this option in grub:

usbcore.autosuspend=-1

I have nvidia card with 319.32 drivers installed. Most of the time going to sleep and resuming works fine, but after some period of time it just keeps waking up immediately and only rebooting the system helps.

qwerus

Posted 2013-08-18T01:23:08.013

Reputation: 31

Answers

0

Copy this script in:

/etc/pm/sleep.d/10unbindusb

and make it executable.

# Revision: 21.12.2009
# Author: Sandro Mani


function unbind_usb {
    for driver in ehci ohci uhci; do
        cd "/sys/bus/pci/drivers/${driver}_hcd";
        ids=$(ls | grep :);
        echo $ids > /tmp/DISABLED_$driver;
        for id in $ids; do
            echo -n "$id" > unbind;
        done;
    done;
}

function bind_usb {
    for driver in ehci ohci uhci; do
        cd "/sys/bus/pci/drivers/${driver}_hcd";
        for id in $(cat /tmp/DISABLED_$driver); do
            echo -n "$id" > bind;
        done;
        rm /tmp/DISABLED_$driver;
    done;
}


case "$1" in
    hibernate|suspend)
        unbind_usb;
    ;;
    thaw|resume)
        bind_usb;
    ;;
    *)
    exit 1;
    ;;
esac;
exit 0;

http://ubuntuforums.org/showthread.php?t=1168204

vujke

Posted 2013-08-18T01:23:08.013

Reputation: 223