nikdoof.com

/posts/ 2008/eeepc-suspending-and-debian-lenny

EeePC, Suspending, and Debian Lenny

Mar 27, 2008

After initally setting up my EeePC to run Debian Lenny I quickly encountered a issue were the madwifi drivers wouldn’t resume correctly. The card would be unable to operate as it has lost sync with the kernel drivers, removing and reloading the related modules solved the issue.

Some people on the EeeUser forums ripped out the existing script from the default Xandros install, a simple acpi script that jumped through some hoops to disable the modules and clear everything down. The script worked as part of the existing acpi-support package and worked when using the acpi suspend options, now i’ve got GNOME and HAL installed it turns out these are no longer used, therefore still causing the issue.

After a little research it seems that the suspend support within Debian is currently in a state of flux, and a few bug tickets have been raised about the various issues. This provided my first hint of how to resolve it, a quick script in pm-utils, much like the acpi one, will fix this for good.

Simply, place this script into your /usr/lib/pm-utils/sleep.d/ folder, I’ve got it as 45eee-wifi that way if the script fails for some reason at least your video will be resumed.

#!/bin/bash

PWR=$(cat /proc/acpi/asus/wlan)

load_modules() {
   modprobe ath_pci
   modprobe wlan_wep
   modprobe wlan_tkip
   modprobe wlan_ccmp
}

unload_modules() {
   rmmod ath_pci
   rmmod wlan_scan_sta
   rmmod wlan_tkip
   rmmod wlan_wep
   rmmod wlan_ccmp
   rmmod ath_rate_sample
   rmmod wlan_acl
   rmmod wlan
   rmmod ath_hal
}

wifi_on() {

   if [ "$PWR" = "0" ]; then
      modprobe pciehp pciehp_force=1
      sleep 3
      echo 1 > /proc/acpi/asus/wlan
      sleep 2
      load_modules
      sleep 1
   fi
}

wifi_off() {
   if [ "$PWR" = "1" ]; then
      unload_modules

      echo 0 > /proc/acpi/asus/wlan
      sleep 1
      rmmod pciehp
      rmmod pci_hotplug
   fi
}

case "$1" in
        hibernate|suspend)
                wifi_off
                ;;
        thaw|resume)
                wifi_on
                ;;
        *)
                ;;
esac

The scripts in the “Arch acpi-eee” package provided the basis for this script, and it also works alot better than the existing scripts provided on eeeuser.com.