madwimax & ap mode

Well, it took me a while to figure out what was wrong and why the heck my atheros laptop wifi won’t go to AP mode.
Looks like the ath5k driver that is in stock ubuntu 10.04 cannot do any AP mode, so you’ll have to grab ath_pci one. However, the snapshots didn’t work at all and I had to compile the svn version.
It looks like regular modbrobe -r ath5k && modprobe ath_pci DOESN’T work: Youll get 0 scan results/devices won;t see the ap created. You have to either blacklist ath5k, OR
modprobe -r ath5k
suspend the laptop
resume the laptop
modprobe ath_pci

Windows fans can do a reboot.
Well, nevertheless, I got it working and finally share a small script that does all the mode-switching between client mode and ap mode.

#!/bin/bash
WW=$1
if [ $WW == "ap" ]; then
ifconfig ath0 down
wlanconfig ath0 destroy
killall knetworkmanager
/etc/init.d/network-manager stop
wlanconfig ath0 create wlandev wifi0 wlanmode ap
#wlanconfig ath0 destroy
#wlanconfig ath0 create wlandev wifi0 wlanmode ap
#wlanconfig ath1 create wlandev wifi0 wlanmode sta nosbeacon
hostapd -B /etc/hostapd/anomalia.conf&
sleep 1
ifconfig ath0 192.168.0.1
/etc/init.d/dhcp3-server start
exit 0
fi
if [ "$WW" == "sta" ]; then
killall hostapd
ifconfig ath0 down
wlanconfig ath0 destroy
wlanconfig ath0 create wlandev wifi0 wlanmode sta nosbeacon
sleep 1
/etc/init.d/network-manager start
su necromant -c knetworkmanager&
/etc/init.d/dhcp3-server stop
sleep 1
exit 0
fi

./ap.sh ap kills the network-manager & knetworkmanager
(Gnome users need to kill nm-applet)
./ap.sh sta brings back the sta mode.
Quite quick and dirty – but it does the job

Leave a Reply