2003.12.22 @ 8:48:47 PM
I've got a D-Link DWL122 Wireless USB Adapter this weekend for $29.99. Not only the price was good, but it also stated "Mac OSX supported", which sort of encouraged me to go ahead and give it a try.
I asked Mr. Goggle, who told me right away it uses a Prism2 chipset, and that it is supported by linux-wlan-ng version 0.2.1-pre13 or later, thanks to a patch written by Andrew Beresford.
(Gentoo users use "emerge". More info at the end of this document)
Installation was long but smooth. It requires kernel sources and a locally compiled kernel, as any precompiled kernel with sources will cause dependency errors when executing depmod:
/sbin/depmod -a
depmod: *** Unresolved symbols in /lib/modules/2.4.20/net/p80211.o
depmod: *** Unresolved symbols in /lib/modules/2.4.20/usb/prism2_usb.o
I realized it would be rather hard for an inexperienced user to get this device to work. That is the reason why I wanted to write something about it. So here is a quick HOWTO:
- First become root and cd into your src directory:
su -
cd /usr/src
- Get the latest kernel source from www.kernel.org. I used 2.4.23 when I wrote this article, but it also works on 2.6
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.23.tar.bz2
- Uncompress your kernel and make a symlink so that it can be accessible as /usr/src/linux
tar -jxf linux-2.4.23.tar.bz2
rm linux
ln -s linux-2.4.23 linux
- cd into your new kernel and compile it:
make menuconfig (spend a few minutes here configuring your kernel properly, one of the pleasures of opensource)
make dep
make bzImage
make modules
make modules_install
make install
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.23
cp System.map /boot/System.map-2.4.23
Note for kernel 2.6 users: Install the module-init-tools package, enable on your kernel Device Drivers -> Networking support -> Wireless LAN (non-hamradio) ->
And compile your kernel with "make && make modules && make modules_install" instead
- Create the right entries in your bootloader. This instructions will depend on the bootloader and distro you are using. In my case it is GRUB running on Debian, therefore the configuration file is located at /boot/grub/menu.lst. It would be /boot/grub/grub.conf in RedHat and /etc/lilo.conf for LILO users. All you have to do in all cases is create a new section as follows (for lilo users, it is slightly different):
title Linux kernel 2.4.23
root (hd0,0)
kernel /boot/vmlinuz-2.4.23 root=/dev/hda2
(make sure you set the right root parameters, check your existing menu options for clues. Lilo users must now execute lilo)
- Reboot your machine choosing the new kernel and log in as root again.
- Get the latest linux-wlan-ng drivers (0.2.1-pre16 in this case), uncompress and configure as follows:
wget ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/linux-wlan-ng-0.2.1-pre16.tar.gz
tar -zxf linux-wlan-ng-0.2.1-pre16.tar.gz
cd linux-wlan-ng-0.2.1-pre16
./Configure
-------------- Linux WLAN Configuration Script -------------
The default responses are correct for most users.
Build Prism2.x PCMCIA Card Services (_cs) driver? (y/n) [y]: n
Build Prism2 PLX9052 based PCI (_plx) adapter driver? (y/n) [n]: n
Build Prism2.5 native PCI (_pci) driver? (y/n) [n]: n
Build Prism2.5 USB (_usb) driver? (y/n) [n]: y
Linux source directory [/usr/src/linux]:
The kernel source tree is version 2.4.23.
Alternate target install root directory on host []:
Module install directory [/lib/modules/2.4.23]:
It looks like you have a System V init file setup.
Prefix for build host compiler? (rarely needed) []:
Build for debugging (see doc/config.debug) (y/n) [n]:
Configuration successful.
- Compile and install with:
make all
make install
- That's all. Now you can tail /var/log/messages -f and plug in your Wifi usb adapter. You will see something like this:
Dec 22 19:40:01 laptop kernel: hub.c: new USB device 00:07.2-2, assigned address 2
Dec 22 19:40:01 laptop kernel: usb.c: USB device 2 (vend/prod 0x2001/0x3700) is not claimed by any active driver.
Dec 22 19:40:04 laptop /etc/hotplug/usb.agent: Setup prism2_usb for USB product 2001/3700/132
Dec 22 19:40:05 laptop /etc/hotplug/wlan.agent: WLAN startup on null (null)
Dec 22 19:40:05 laptop kernel: prism2_init: prism2_usb.o: 0.2.1-pre16 Loaded
Dec 22 19:40:05 laptop kernel: prism2_init: dev_info is: prism2_usb
Dec 22 19:40:05 laptop kernel: usb.c: registered new driver prism2_usb
Dec 22 19:40:05 laptop /etc/hotplug/wlan.agent: WLAN p80211 starting!
Dec 22 19:40:05 laptop /etc/hotplug/wlan.agent: WLAN register on wlan0 (prism2_usb)
Dec 22 19:40:05 laptop /etc/hotplug/wlan.agent: WLAN wlan0 registered.
Dec 22 19:40:05 laptop /etc/hotplug/net.agent: invoke ifup wlan0
Dec 22 19:40:05 laptop wland[1071]: wland daemon init successful
Dec 22 19:40:05 laptop wland[1071]: netlink socket opened and bound successfully
Dec 22 19:40:05 laptop /etc/hotplug/wlan.agent: /sbin/prism2dl not found, aborting firmware download.
Dec 22 19:40:06 laptop kernel: ident: nic h/w: id=0x8026 1.0.0
Dec 22 19:40:06 laptop kernel: ident: pri f/w: id=0x15 1.1.3
Dec 22 19:40:06 laptop kernel: ident: sta f/w: id=0x1f 1.7.1
Dec 22 19:40:06 laptop kernel: MFI:SUP:role=0x00:id=0x01:var=0x01:b/t=1/1
Dec 22 19:40:06 laptop kernel: CFI:SUP:role=0x00:id=0x02:var=0x02:b/t=1/1
Dec 22 19:40:06 laptop kernel: PRI:SUP:role=0x00:id=0x03:var=0x01:b/t=1/4
Dec 22 19:40:06 laptop kernel: STA:SUP:role=0x00:id=0x04:var=0x01:b/t=1/12
Dec 22 19:40:06 laptop kernel: PRI-CFI:ACT:role=0x01:id=0x02:var=0x02:b/t=1/1
Dec 22 19:40:06 laptop kernel: STA-CFI:ACT:role=0x01:id=0x02:var=0x02:b/t=1/1
Dec 22 19:40:06 laptop kernel: STA-MFI:ACT:role=0x01:id=0x01:var=0x01:b/t=1/1
Dec 22 19:40:06 laptop kernel: Prism2 card SN: 000000000000
Dec 22 19:40:11 laptop /etc/hotplug/wlan.agent: WLAN wlan0 brought up successfully.
Dec 22 19:40:11 laptop /etc/hotplug/wlan.agent: WLAN bringing up layer 3+ with /sbin/ifup
Dec 22 19:40:11 laptop kernel: linkstatus=CONNECTED
- Now you need to configure your network accordingly with your access point. Edit /etc/wlan/wlan.conf and set your SSID as follows:
SSID_wlan0="mywlan"
ENABLE_wlan0=y
- This means you will need a /etc/wlan/wlancfg-mywlan file. You can use the included wlancfg-DEFAULT for reference. You might want to try first with the default configuration, disabling WEP on your access point, but do not forget to enable it once you know it works:
cp /etc/wlan/wlancfg-DEFAULT /etc/wlan/wlancfg-mywlan
Note: When enabling WEP make sure there are NO spaces/tabs after "=" in the line dot11WEPDefaultKey0=00:01.... otherwise it WILL NOT WORK !!!. I have submitted this info, and hopefully will be corrected in future versions.
- Configure now your IP:
ifconfig wlan0 192.168.0.2 netmask 255.255.255.0
route add -net default gw 192.168.0.1
Note: This IP configuration will work with most default configurations. Make sure you set the right local (wlan0) and gateway (gw) ip addresses. You may even have DHCP enabled on your access point, in that case you can obtain your ip automatically with dhclient
Note2: I have just installed Gentoo on my laptop and emerge takes care of evrything. All you have to do is:
USE="usb -pci" emerge linux-wlan-ng
(make sure first that emerge -s linux-wlan-ng shows version 0.2.1-pre13 or later)
Note3: Make sure CONFIG_PACKET and CONFIG_FILTER are enabled in your kernel if you expect DHCP to work.
That should get you going. Enjo
哈哈,没有白白努力。修改了点代码。终于可以用DWL G-122上网了。下一步是把驱动放入ARM-7上,现在已经有把握了。
/etc/Wireless/RT73STA/rt73sta.dat的配置是十分重要的,在这上面花了很多时间嘿嘿!
[Default]
CountryRegion=0
CountryRegionABand=7
WirelessMode=0
SSID=isassid
NetworkType=Infra //修改,原来是Adhoc
Channel=7 //根据AP修改
AuthMode=WEPAUTO //修改
EncrypType=WEP //加密方式
DefaultKeyID=0 //修改原来是1,修改后Key1生效
Key1Type=0
Key1Str= //密码
Key2Type=0
Key2Str=
Key3Type=0
Key3Str=
Key4Type=0
Key4Str=
WPAPSK=abcdefghijklmnopqrstuvwxyz
TxBurst=0
PktAggregate=0
TurboRate=0
WmmCapable=0
AckPolicy=0;0;0;0
BGProtection=0
IEEE80211H=0
TxRate=9 //根据AP计算调整
RTSThreshold=2347
FragThreshold=2346
PSMode=CAM
TxPreamble=0
AdhocOfdm=0
FastRoaming=0
RoamThreshold=70
iwlist rausb0 scan
Warning: Driver for device rausb0 has been compiled with version 20
of Wireless Extension, while this program supports up to version 17.
Some things may be broken...
rausb0 Scan completed :
Cell 01 - Address: 00:13:46:51:6B:2B
ESSID:"isassid"
Mode:Managed
Channel:7 //对应修改
Encryption key:on
Bit Rate:3 Mb/s //3×8=24MBPS
iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
sit0 no wireless extensions.
Warning: Driver for device rausb0 has been compiled with version 20
of Wireless Extension, while this program supports up to version 17.
Some things may be broken...
rausb0 RT73 WLAN ESSID:"isassid"
Mode:Managed Channel=7 Access Point: 00:13:46:51:6B:2B
Bit Rate=18 Mb/s
RTS thr:off Fragment thr:off
Encryption key:1111-1111-11
Link Quality=40/100 Signal level:-76 dBm Noise level:-115 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
这就说明成功的加入了AP.
ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=0 ttl=255 time=3.99 ms