![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
![]()
A FreeBSD driver for Atmel based USB WLAN adapters. The aim of the project is to get all Atmel at76c503a compatible USB WLAN adapters to work on FreeBSD.
At this moment the following USB devices are supported by the driver :
Other devices might also work, please let me know if you find a device with different USB ID's.
To use this driver you need FreeBSD 5.1-RELEASE or later with the kernel sources installed. First, unpack the driver into your source tree. (You may want to create backups of your source tree before you begin.)
This should extract the following files :
Since version 0.5 of the atuwi driver, the driver comes with a script that automatically compiles the driver. To start the compile-script, go into the directory where your kernel sources are installed (normally /usr/src/sys ) and simply type the following :
If the compile script finished successfully you can skip the next chapter and continue with the chapter "Testing the driver".
If the atuwi-compile script failed, or if you like to compile the driver step by step by hand, please follow the following steps : The atuwi-driver uses a system called 'DFU' to upload firmware into the USB adapter. After the firmware has been uploaded, the adapter has to be resetted. The current USB stack doesn't have the ability to do this in a nice way, so I have added this functionality and provided a patch. Patching your USB code and recompiling it can be done as follows:
FreeBSD's UHCI driver has an error in it that causes a system to hang when booted with a wireless USB adapter plugged in. To prevent this I have submitted a PR with a patch, so new versions of FreeBSD should already have this fixed. For all versions that don't have this patched yet you should patch it with the patch file that comes with the driver. If you're not sure if your system already has the patch or not, just try to patch it and "patch" will complain if the patch is already there. Type the following to apply the patch:
Now update the usbdevs list with the ID's of the WLAN adapters and rebuild it: (this can also be done using cvs, but for ease of use we'll just get the usbdevs list from the cvsweb interface using fetch)
After that it's time to compile the driver itself :
Note that the driver comes with patches to the usb subsystem. For these patches to take effect you'll have to recompile your kernel and reboot now. Otherwise the driver will work, but you will have to use a trick to get your wireless device to work. (Which is explained later on) If you've made it up to here you should now be the happy owner of a file called 'if_atuwi.ko'. Let's try to load it and see if it works...
Now plug in the WLAN adapter and watch the debug output. If all goes well the debug messages will stop with something like :
Congratulations, you can now begin configuring the interface (and skip the next chapter). Please read the next chapter if the debug messages stop with something like :
If you don't see any debug messages that start with 'atuwi0', you must have a WLAN adapter that's either not supported, or not yet listed in the driver. Please email me ( Danovitsch @ Vitsch . net ) the output of 'usbdevs -v' so I can add the USB ID's to the driver.
If for some reasone you are using a kernel without my reset modifications, you will have to use a little trick to reset the adapter. If you remove a USB plug from a hub, you first disconnect the two data pins and then the two pins supplying the power. (This is because the data pins are shorter in length.) So if you gently unplug the USB connector only half way out of the hub (about 2 milimeters) the data pins are disconnected from the hub, but the device is still powered. This means the hub will detect the device is gone, but the firmware will stay in the RAM of the device. When you plug the device back in now, the hub will detect the device again. Doing this is fairly easy, but it won't always work on the first attempt. Just try a couple of times.
The following are a couple of self-explenatory examples that show how the interface can be configured :
Switching back from Ad-Hoc mode to Infrastructure mode can be done with this command :
And switching from Infrastructure to Ad-Hoc can be done like this:
The following command will set a 64-bit WEP key :
And setting a 128-bit WEP key :
Turning WEP off again :
Possible wepmode's are :
WEP encrypted packets will ONLY be received correctly if the transmitter and the receiver are using the exact same WEP key (wether we're in mixed mode or not). When setting WEP keys, make sure the length is exactly 10 hex-digits for 64-bit keys or 23 hex-digits for 128-bits.
If you are going to plug/unplug the adapter, you probably want the thing to be automatically configured when it's plugged in. USBD will do this for us after some minor modifications.
Somewhere in the file add the next couple of lines :
Save the file and restart usbd :
Now add your settings to /etc/rc.conf . The syntax should look like this :
To let the system know we want to automatically load the settings add :
And to make 'usbd' start during boot you should have :
After plugging the device into the usb hub it should now be automatically detected and configured.
Although it's possible to load the driver at boot time it might be easier to compile the driver into the kernel sometimes. To do this we have to add the driver to the list of options that can be choosen in a kernel-config :
Now edit your kernel config file and simply add a line with 'device atuwi' to it. Re-config, compile, install, reboot and the adapter should initialise at boot time :)
What if you're with your laptop in the middle of nowhere, far from your cat-5 hub, but just in range of a wireless network and you suddenly feel the urge to install FreeBSD? Well... I found myself in that situation yesterday and I found out that using the driver from sysinstall is very easy and completely painless :) First, make your kernel & mfsroot floppies. Then take a third floppy and put the driver on it : Format the floppy
Mount it, copy the driver and unmount it again.
Now boot your system with the kernel & mfsroot floppies. When sysinstall appears simply insert the driver floppy and follow the menu to load it. During install things like ssid and WEP-settings can be filled in in the box 'extra options to ifconfig'. For those that are having a little chicken-and-egg problem with the 'compile the driver, put it on a floppy, and then install FreeBSD' order and for the impatient, the floppy image can also be downloaded from the internet from : For FreeBSD 5.1-RELEASE :
For FreeBSD 5.2.1-RELEASE :
For FreeBSD 5.3-BETA7 :
For FreeBSD current (as of 2004-10-18) :
After downloading, extract the image and burn it onto a floppy. The driver will support all devices currently supported by the driver. For information on how to burn floppy images onto a floppy please read the
floppy-readme :
By default the driver tends to be a bit too verbose. The debug flags can be altered on-the-fly with sysctl variable 'hw.atuwi.debug' . This will silence the driver:
For an explanation of possible debug flags, settings and optimizations of the driver please have a look at /usr/src/sys/dev/usb/if_atuwireg.h
$ATUWI: $Id: atuwi-README.daan,v 1.12 2004/10/23 18:45:35 daan Exp $ Releases:atuwi-0.6 atuwi-floppies atuwi-0.5 atuwi-0.4 atuwi-0.3 atuwi-0.2 atuwi-0.1 Email me with questions/comments : Daan <Danovitsch @ Vitsch . net> |