Ubuntu: Not quite laptop ready; ipw3945 ACPI fixes.

I’ve heard many things over the years about Ubuntu.. heck, I even passed out a few of their ‘free’ CDs in ’05 (Hoary, 5.04). It worked great.

However, I’ve recently attempted to adopt it on a fledgling Laptop which was just becoming more of a nuisance to try to keep running than was worth the time invested.

When reading through documents for others who attempting to do the same, it shocked me at how lacking support was in Linux for nearly three year old commodity parts. Ubuntu, the first Linux distribution I actually had a specific reason to distrust (They imported alpha grade drivers, which were at version 0.1 and known to cause crashes into the mainstream), was now not enabling proprietary drivers in their default install.

This, of course, meant that their pretty little installer crashed. Hard.

I ended up installing Ubuntu via apt and wired ethernet. It was more of a pain than getting Debian running.. and Debian tends to scare people away.

The one thing I did like is that Ubuntu’s Gnome ‘Network Manager’ applet actually worked with my ipw3945, and the fglrx driver could be tweaked so I could shut my machine down.

However, upon waking, it still broke the ipw3945. That worked fine for everything else. Oh well.

Here’s my ugly little script I used to reload/reinit the ipw3945 if it crashed, restarting the userspace daemon, and firing off wpa_supplicant, since it never seems to return after sleeping, even if I let it keep the network module loaded:

/etc/acpi/resume.d/70-fixwifi.sh:

#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
# This script is naaasty...
/etc/init.d/networking stop
REVISION=/sbin/ipw3945d-`uname -r`
ISRUNNING=`pidof $REVISION`
rmmod ipw3945 > /dev/null 2&>1
if [ $? -eq 0 ]; then
  modprobe -r -f ipw3945
  modprobe ipw3945
fi
if [ x$ISRUNNING -eq x ] && [ -x $REVISION ]; then
  $REVISION --quiet
  sleep 2s
fi
WPA=`wpa_cli status | awk -F= ' /wpa_state/ { print $2 }'`
#start everything back up
if [ x$WPA -ne xCOMPLETED ]; then
  # I really hate this, but it's not worth beautifying right now
  killall wpa_supplicant
  /etc/init.d/wpa_start.sh &
  # wait for it
  sleep 5s
fi
/etc/init.d/networking start
/sbin/ifup eth1

/etc/init.d/wpa_start.sh:

#!/bin/sh
ISRUNNING=`pidof wpa_supplicant`
if [ x$ISRUNNING -eq x ]; then
  wpa_supplicant -i eth1 -c \
  /etc/wpa_supplicant.conf -Dwext -w
fi

/etc/wpa_supplicant.conf:

network={
  ssid="MY SSID"
  scan_ssid=1
  psk="MY_WPA_KEY"
}

What it does is test to see if the wireless is loaded, and if so, attempt to remove it. If it is successful (not in use), force unload (why not?) then reload the module. If the userspace daemon isn’t running, fire it off. Finally, take a little nap while wpa_supplicant inserts itself, then fire off networking.

It’s obnoxious, and annoying (note that I hardcoded the interface of eth1), but there seems to be no way of getting nm-applet to properly reinit the interface, itself.

Although when connected, it does still measure the signal and allow me to switch, so that’s good enough for me.