You are not logged in.

#1 2011-05-02 06:24:11

amadar
Banned
Registered: 2011-04-15
Posts: 147

My pm-utils /etc/pm/sleep.d hook only works in 1 of 8 scenarios. Why?

I was having trouble with my ethernet card not working after resuming from suspend so I wrote a hook to unload and reload the necessary r8169 module but it only works when when I have modprobe -r r8169 and modprobe r8169 both executing after resume and if pm-suspend is executed as root.
What i mean by "it works" is that my ethernet card successfully resumes after i get back from suspension and i can connect to my network.
The hook in this case looks like this:

#!/bin/bash
case "$1" in
    hibernate|suspend)
        echo "We are suspending/hibernating..."
        touch ~/suspended
        ;;
    thaw|resume)
        echo "We are thawing/resuming... Reloading ethernet module (r8169)."
        modprobe -r r8169
        modprobe r8169
        touch ~/resumed
        ;;
    *)  echo "Warning (amadar): pm-utils was used incorrectly..."
        ;;
esac

However, if I unload the r8169 module before suspending then, the my ethernet card fails to come back to life. In this case I still execute pm-suspend as root and the hook looks like this:

#!/bin/bash
case "$1" in
    hibernate|suspend)
        echo "We are suspending/hibernating..."
        # UNLOAD MODULE BEFORE SUSPENDING:
        modprobe -r r8169
        touch ~/suspended
        ;;
    thaw|resume)
        echo "We are thawing/resuming... Reloading ethernet module (r8169)."
        modprobe r8169
        touch ~/resumed
        ;;
    *)  echo "Warning (amadar): pm-utils was used incorrectly..."
        ;;
esac

Now, in a normal case scenerio, I won't be executing pm-suspend as root. Generally, I'll be clicking on "suspend" through my Gnome 3 interface, pressing functionKey+f5, or closing my lid. In these non-root scenarios, neither of the two hook variations above will bring my ethernet card back to life.

I might add that the first scenario works perfect 100% of the time (the other 4 scenarios don't work at all). Also, the touch commands you see in the script get executed every time, so I know the hook itself (both variations of it) executes every time.

Also, after each of the 4 failing scenarios, I can resuscitate my ethernet card manually using modprobe, no problem. Basically, it seems that my ethernet will only continue working after suspension if I use the first hook variation and call pm-suspend as root, but seems that not matter what hook variation I try when suspending as a normal user through the desktop my ethernet card just won't reactivate.

Any idea what might be going on here?

P.S. My laptop is a HP TouchSmart 1025dx

Last edited by amadar (2011-05-02 06:29:35)

Offline

Board footer

Powered by FluxBB