Wireless network device

Index


Introduction

Starting from STLinux2.3 distribution, support for some USB wifi dongles based on Ralink RT73 chipset was added into linux kernel to allow user to exploit wireless extensions. They are based over the IEEE 802.11 protocol. The work is based starting from rt73 legacy driver distributed by serialmonkey project (http://rt2x00.serialmonkey.com). This project was officially included in the linux kernel series available on STLinux-2.4. In this section you can find useful informations to use wifi dongles with ST kernel; however, for a full wifi instructions set, we will invite you to read specific documents.

[Top]

Supported dongles

Here is a list of supported dongles, the ones based on RT73 chip. We remember this is the only chip officially supported by our STLinux-2.3 distribution. STLinux-2.4 didn't required a specific driver porting, so this list could be enlarged to the whole ralink chips. List could be incomplete.

  • Asus WL-167G
  • Belkin F5D7050EF
  • Belkin F5D7050ES
  • Conceptronic C54RU Ver2
  • D-Link DWL-G122 H/W Ver.:C1
  • Edimax EW7318UG
  • Linksys WUSB54GC
  • Sitecom WL-113
  • Sitecom WL-172
  • Surecom EP-9001-g
  • PLanex GW-US54HP
  • Digitus DN-7003GR VPR 1.0

[Top]

Configuring the kernel

To use USB wireless driver you have to set the following features in your linux kernel.

Kernel starting from release #102 already contains this wireless support. Full boards support starts from kernel #122. Previous versions were for 7109 and 7200 boards.

Open the kernel menuconfig and enable the following:

Networking ---> Wireless ---> Generic IEEE 802.11 Networking Stack (mac80211)
Device Drivers ---> Network device support ---> Wireless LAN ---> Wireless LAN (802.11)
Device Drivers ---> Network device support ---> Wireless LAN ---> STMicroelectronics rt73 wireless usb device

Also make sure the following options are enabled:

Device Drivers ---> Generic Driver Options ---> Userspace firmware loading support
File systems ---> Pseudo filesystems ---> Virtual memory file system support (former shm fs)

Networking support ---> Wireless ---> cfg80211 - wireless configuration API
Networking support ---> Wireless ---> Generic IEEE 802.11 Networking Stack (mac80211)
Device Drivers ---> Network device support ---> Wireless LAN ---> Wireless LAN (IEEE 802.11) ---> Ralink driver support ---> Ralink rt2501/rt73 (USB) support

[Top]

How to use the device

Once kernel has been built, with rt73 driver enabled, to start using usb dongles you have to install the rt73.bin firmware the driver needs to be correctly initialized. You can find it into iso image or download from ftp site (wireless-frmw package). It will be installed on target filesystem (lib/firmware directory).

If driver is built as built-in, there is also the possibility to boot the kernel with the usb dongle already plugged in the usb connector : user has to put the firmware under _kernel_tree_/usr directory and also he has to enable the following otpion from the kernel configurator:

Device Drivers ---> Network device support ---> Wireless LAN ---> Rt73 firmware loaded inside kernel

To remember that this option has to be enabled only if driver is built as built-in. If it is built as module, /lib/firmware/rt73.bin firmware is enough because driver init phase will start (obviously) only after filesystem is mounted.

No others options have to be enabled to boot the kernel with usb dongle already plugged (coldplug), firmware will be loaded at its first use when userspace will be available.

The userspace firmware is however always required for all the unplug/plug operations user will do during his working session.

You also need wireless tools package to manage your wireless connection. As above, you can find it on iso image or into ftp site. This package contains iwconfig, iwpriv and iwlist tools.

Once wireless device will be recognized, a wlan0 device will be created: typing ifconfig -a you will see it, at the moment with link down. Enable it typing ifconfig wlan0 up or ifconfig wlan0 <ip_address>. If you choose the first command, you will need to assign an ip address in future.

After this step, if a wireless access point is available in the nearby, typing iwconfig wlan0 you will see your connection status.

For example you should see a similar output:

wlan0     RT73 WLAN  ESSID:"linksys"
          Mode:Managed  Frequency=2.412 GHz  Access Point: 00:18:F8:7A:D0:59
          Bit Rate:54 Mb/s
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Link Quality=100/100  Signal level:-22 dBm  Noise level:-79 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Where, for example:
  • ESSID is the access point name where network is wired
  • Access Point is the access point's mac address
  • Link Quality is the signal strength

If wireless device was correctly initialized and wired to an access point, you can use it as a normal network interface, using also all network commands available.

For detailed instructions regarding wireless tools you can visit their man pages. Wireless tools are also required to enable/disable encryption keys, useful to setup security connections. Take care that tools commands are not fully available for this rt73 driver, for example you cannot set device "mode" to master, in order to set dongle as an access point. If you'll try to enable (through wireless tools) a not supported capability, driver will reply with a warning message that won't corrupt its use.

If you have built the driver as a loadable module, type the following to insert and use it:

insmod rt73.ko [debug=<number>]
Once dongle was plugged...
ifconfig wlan0 [up | <ip_address>]

Where number is the same as above.

To disable connection, you have to put down network typing ifconfig wlan0 down. To remove rt73 device (previously loaded as module) you have to type rmmod rt73.

[Top]

Encrypted connections

To work with WEP encryption key you can use iwconfig to setup it.

target# iwconfig wlan0 mode managed
target# ifconfig wlan0 up
target# iwconfig wlan0 essid <your_essid> key <your_key>

Where your_essid and your_key are the ssid of the access point you want to connect on and the WEP key you want to set. This is valid for both STLinux distributions. Take care to enable WEP support on kernel side.
Once secure connection with access point is established, we can assign an ip address using for example udhcpc.
target# udhcpc -i wlan0

For WPA/WPA2 connections we need to distinguish the two cases:

Although wpa_supplicant is distributed as STLinux-2.3 distribution update, to work with encryption user doesn't need to use it, in fact the driver is not totally compliant with it. However most of the common wpa_supplicant features are already included in the driver code and to use them iwpriv user application is needed. It is contained in the wireless-tools package and for sure user has already installed it (it contains also iwconfig).

Wireless encryption is supported starting from kernel #125

To setup WPA using iwpriv, user needs to follow these steps:

target# iwconfig wlan0 mode managed
target# ifconfig wlan0 up
target# iwconfig wlan0 essid <access_point_name>
or
target# iwconfig wlan0 ap <access_point_mac_address>
target# iwpriv wlan0 set AuthMode=WPAPSK
target# iwpriv wlan0 set WPAPSK=<YOUR_WPA_KEY>
target# iwpriv wlan0 set EncrypType=TKIP

Please verify CONFIG_IEEE80211_CRYPT_TKIP is enabled in the kernel config.

To setup WPA2 using iwpriv user needs to follow these steps:
1), 2), 3a) or 3b) as previous ones
target# iwpriv wlan0 set AuthMode=WPA2PSK
target# iwpriv wlan0 set WPAPSK=<YOUR_WPA2_KEY>
target# iwpriv wlan0 set EncrypType=AES

Please verify CONFIG_CRYPTO_AES is enabled in the kernel config.

After these steps the status can be verified with "iwconfig wlan0" command.
Also be sure that Access Point is configured for WPA/WPA2 encryptions.

wpa_supplicant is the userspace application to use to setup these encrypted connections. Before this, user has to verify that both TKIP (for WPA) and AES (WPA2) supports are enabled on kernel. wpa_supplicant (distributed in our distro) comes with a wpa_supplicant.conf configuration file that has to be tuned to fit network requirements. Please read the content of the default distributed file to meet your personal requirements. Before using wpa_supplicant, user has to setup the ssid of the access point and to enable wlan0 connection:

target# iwconfig wlan0 mode managed 
target# iwconfig wlan0 essid <your_essid>
or
target# iwconfig wlan0 ap <ap_mac_address>

where ap_mac_address is the mac address of the access point.
 target# ifconfig wlan0 up

The working command line for wpa_supplicant is the following:
 target# wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -B

In this case wext is the linux default wireless extension, the one used by most of the wireless devices. With the -B option we put wpa_supplicant in background; to see debug informations user has to use -d or -dd options. Once secure connection is established, we can setup the ip address as explained above.

[Top]