Saturday, April 17, 2010

Wireless Sleep/Wakeup Issue Resolved for EeePC running Ubuntu 9.10

After upgrading from ubuntu 9.04 to 9.10 a few months ago on my EeePC, I started having issues with my wireless connection. Specifically, when the EeePC would go to sleep, the wireless card would not turn back on when the computer woke up. Moreover, while running:


$ sudo modprobe -r ath9k
$ sudo modprobe ath9k


seemed to turn the wireless card back on, the card was unable to see any networks, and gave a "Device not ready" error in the Gnome toolbar. My solution for the past few months has been to not let the EeePC fall asleep. But today, I finally got fed up with the issue and found a more robust fix. After reading this bug report, I discovered I could get wireless working after the EeePC woke up by running the following commands:


$ sudo modprobe -r ath9k
$ rfkill block wifi
$ rfkill unblock wifi
$ sudo modprobe ath9k


Hooray! To avoid running this series of commands every time the computer woke up, I added them to the EeePC wifi toggle script, "/etc/acpi/eeepc/eeepc-wifi-toggle.sh" in the "radio_on" function. For me this was around line ~59. The final result looked something like this:


...
function radio_on {
echo 1 > $RADIO_CONTROL
sleep 1
# HACK
rfkill block wifi
rfkill unblock wifi
# END HACK
get_wifi_driver
/sbin/modprobe $WIFI_DRIVER 2>/dev/null
...


with my changes between the # HACK / # END HACK comments.

Now wifi starts up and connects to a wireless network when the EeePC wakes up like a champ!

Note: The eeepc-wifi-toggle.sh script is called from /etc/pm/sleep.d/00-eeepc-wifi. The sleep.d directory is where Ubuntu puts scripts that are run when the computer falls asleep and wakes up.

No comments: