LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Atheros/MadWifi pccard hack (https://www.linuxquestions.org/questions/slackware-14/atheros-madwifi-pccard-hack-386813/)

masoni 11-26-2005 06:47 PM

Atheros/MadWifi pccard hack
 
I've just upgraded to the latest version of the MadWifi driver (madwifi.org).

A change has been made to the code so that my pccard now gets added as 'wifi0' when it is plugged in.

wlanconfig must then be run to create the network device (I used ath<n> ) against which a network interface can be configured.

To do this automatically when the card is insert I modified /etc/hotplug/net.agent and added the following code

Code:

            # Run ifrename as needed - Jean II
            # Remap interface names based on MAC address. This workaround
            # the dreaded configuration problem "all my cards are 'eth0'"...
            # This needs to be done before ifup otherwise ifup will get
            # confused by the name changed and because iface need to be
            # down to change its name.
            if [ -x /usr/sbin/ifrename ] && [ -r /etc/iftab ]; then
                debug_mesg invoke ifrename for $INTERFACE
                NEWNAME=`/usr/sbin/ifrename -i $INTERFACE`
                if [ -n "$NEWNAME" ]; then
                    debug_mesg iface $INTERFACE is remapped to $NEWNAME
                    INTERFACE=$NEWNAME
                fi;
            fi

            # Additional hack for MadWifi
            #if [ `/sbin/iwconfig 2>&1 | grep "^wifi.*no wireless extentions"` ] ; then
            if [[ "$INTERFACE" =~ "wifi[0-9]+" ]]; then
                NEWNAME=`/usr/local/bin/wlanconfig ath create wlandev $INTERFACE  wlanmode sta`
                INTERFACE=$NEWNAME
            fi


            # Slackware Linux:


It's worth mentioning that the number assigned to the device name is set by the kernel and increments everytime the card is ejected and re-inserted between reboots.
wlanconfig should let you hardcode the number (e.g wlanconfig ath0 ....) but I kept getting an ioctl error when I try.

rc.inet1.conf may need duplicate entries if you intend to pop the card in and out between reboots.

you can use wlanconfig to destroy the 'ath' device but this only works while the device is running so I couldn't think of any way to automate this :confused: when the card is ejected.

I hope this information helps someone else.

Iain

Charred 11-28-2005 06:18 AM

Good to know for when I upgrade. I'll keep an eye out for it!


Aaaaand off the zero-replies list we go...:)

tlaurenzo 12-04-2005 07:28 PM

Try this
 
if [[ "$INTERFACE" =~ "wifi[0-9]+" ]]; then
VAPNAME=`/usr/local/bin/wlanconfig ath create wlandev $INTERFACE wlanmode sta`
/sbin/ifrename -i $VAPNAME
fi

I put the above code in place of the previously suggested modifications. In addition to a line in /etc/iftab, this causes the newly created ath? interface to immediately be renamed to wlan9, which is something that the Fedora network profile tools can grab onto.

The iftab entry is a little tricky because the base wifi? interface shares the MAC address of the virtual ath? interface. I used something this (with the mac address of my card inserted):
wlan9 mac FF:FF:FF:FF:FF:FF iwproto IEEE*

This forces the matching rule to only work on the interface with wireless extensions enabled (ie. the ath? interface, not the wifi? interface).

It all works now, and when I plug the Atheros card in, I immediately get a wlan9 interface that comes up and acquires its address.

TJ


All times are GMT -5. The time now is 07:30 PM.