October 23, 2005 2:30 PM
Recently, I purchased the D-Link DWL G122 Wireless USB adapter. I liked the idea of a compact, easily removable wireless adapter. My main aim was to build an ad-hoc network so that I can seamlessly connect with my Thinkpad.
dwl g122 linux driver led me to believe that I'd
probably have to use ndiswrapper which basically loads the windows
version of the driver in Linux. I was preparing to do all that when I
noticed that the hardware version of my DWL-G122 was Ver B1. That
meant it used an RT2500 chipset. Linux drivers for this has recently
been developed by the company that makes the chipset,
Ralink Technology. The Linux driver is
available for download in source form at
the company's support page. To quote the description given in the
README file of the driver:
This is a linux device driver for Ralink RT2500USB b/g WLAN Card. This driver implements basic 802.11 function. Infrastructure and Ad-hoc mode with open or shared or wpapsk or wpa2psk authentication method. WEP-40 and WEP-104 or tkip or aes encryption.
The version of the driver that I downloaded was developed in Fedora Core 3 and hence it easily compiled with no fuss in Fedora Core 2. I think it'll work in most flavors of Linux. Once you've downloaded the relevant driver from the website and followed the instructions in the README to set it up, you can use these scripts1 to set up an ad-hoc network2.
To bring up the ad-hoc network (
#!/bin/bash THE_SSID=test; PATH_TO_USBDRIVER=/home/anirudh/RT25USB-V18.104.22.168 cd $PATH_TO_USBDRIVER && echo "Configuring D-Link DWL-G122 to work in ad-hoc mode (OPEN) with SSID=$THE_SSID ..."; /sbin/insmod rt2570.ko && /sbin/ifconfig rausb0 up address 192.168.0.1 && echo "status before iwconfig"; /sbin/iwconfig rausb0 && /sbin/iwconfig rausb0 mode ad-hoc && /sbin/iwconfig rausb0 key off && /sbin/iwconfig rausb0 channel 6 && /sbin/iwconfig rausb0 essid $THE_SSID && echo "status after iwconfig"; /sbin/iwconfig rausb0; echo "Successfully configured D-Link DWL-G122 in ad-hoc mode (OPEN) with SSID $THE_SSID";
To bring down the ad-hoc network (
#!/bin/bash echo "De-initializing D-Link DWL-G122..."; /sbin/ifconfig rausb0 down && /sbin/rmmod rt2570.ko && echo "De-initialized D-Link DWL-G122";
You should have root privileges before running these scripts.