Search:  
Gentoo Wiki

Linksys_WUSB54G


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process


Rt2500 Mini-PCI card

Contents

Subpages

Introduction

This 'HOWTO' is meant to show how you can get your wireless RaLink-chip based device to work with Gentoo. There are two ways to accomplish this:

Which hardware?

First, it is important to find out chip your wireless device is based on. Use /usr/sbin/lspci (or lsusb, for USB devices) (/usr/sbin/lspci is part of sys-apps/pciutils, and lsusb is part of sys-apps/usbutils)

Alternatively, look at SerialMonkey's hardware list: http://rt2x00.serialmonkey.com/wiki/index.php?title=Hardware

Linux Drivers

Open Source rt2x00

Note: This section is a bit dry - help and add some links to genkernel, /etc/conf.d/net configuration, etc.. Thanks for your time

The open source drivers for the rt2x00 chipset family comes in two flavors:

The new rt2x00 drivers aim for inclusion into the vanilla kernel, so it is the way to go. RT2500 has been usefull, but... long live rt2x00! By the way: there is an rt2x00 CVS ebuild (fetching the source from CVS)... it looks old... Can someone report his mileage using it?

Because not all software versions described in this section have made it yet in portage, the recommended way to use rt2x00 is then to:

  1. manually fetch the kernel sources (until 2.6.24+ reaches portage) (see also ketchup)
  2. download the daily CVS snapshot for rt2x00 drivers (see rt2x00 website)
  3. build your kernel (see genkernel if needed)
  4. build your rt2x00 modules
  5. Install the modules and configure your wireless lan interface

Kernel required options

Following the README file in the rt2x00 snapshot, you should find the options that need to be activated within the kernel:

Kernel config option	Required for component
------------------------------------------------------------------
# CONFIG_NET_RADIO	all
# CONFIG_MAC80211	all
# CONFIG_WLAN_80211	all
# CONFIG_PCI		rt2400pci, rt2500pci, rt61pci
# CONFIG_USB		rt2500usb, rt73usb
# CONFIG_HOTPLUG	rt61pci, rt73usb
# CONFIG_FW_LOADER	rt61pci, rt73usb
# CONFIG_CRC_ITU_T	rt61pci, rt73usb
# CONFIG_DEBUG_FS	rt2x00 (optional, only for debug)
# CONFIG_RFKILL		rt2400pci, rt2500pci, rt61pci (optional, only for button support)
Note: It looks like the option "CONFIG_NET_RADIO" is no longer available/needed. "CONFIG_MAC80211" is the new 802.11 stack. Recompile your kernel and boot it for the next part.

rt2x00 modules

Make sure:

Edit the "config" file within the rt2x00 driver sources. You can say no (n) to the "CONFIG_D80211" option (no longer relevant), and also to all the options that you actually activated within the kernel directly. Those options are still present but are no longer relevant since the stack (and rfkill, etc.) went into the kernel.

Then, you are ready to compile and install the modules:

# make
# make install

Your modules should be ready to get loaded (if not already done... check it with lsmod). Use modprobe to install them (e.g. modprobe rt2500pci). Check ifconfig or iwconfig to see it the interface "wlan0" appeared. Their should also be a "wmaster0" device - check rt2x00's README file for more details about it.

udev changes

In case udev already had configured your ralink chipset in the past, check your "/etc/udev/rules.d/70-persistent-net.rules" file and change:

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:11:50:8f:xx:xx", NAME="ra0"

to :

SUBSYSTEM=="net", DRIVERS=="?*", SYSFS{address}=="00:11:50:8f:xx:xx", SYSFS{type}=="801", NAME="wmaster0"
SUBSYSTEM=="net", DRIVERS=="?*", SYSFS{address}=="00:11:50:8f:xx:xx", NAME="wlan0"
Note: please use your MAC address :)

For those using the RT61pci and other drivers that require firmware to be loaded with the module, you will need to add this line to /etc/udev/rules.d/999-firmware.rules:

ACTION=="add", SUBSYSTEM=="firmware", RUN+="/sbin/firmware.sh"

The contents of /sbin/firmware.sh:

#!/bin/sh -e

FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware"

err() {
    echo "$@" >&2
    if [ -x /bin/logger ]; then
        /bin/logger -t "${0##*/}[$$]" "$@"
    fi
}

if [ ! -e /sys$DEVPATH/loading ]; then
    err "udev firmware loader misses sysfs directory"
    exit 1
fi

for DIR in $FIRMWARE_DIRS; do
    [ -e "$DIR/$FIRMWARE" ] || continue
    echo 1 > /sys$DEVPATH/loading
    cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
    echo 0 > /sys$DEVPATH/loading
    exit 0
done

echo -1 > /sys$DEVPATH/loading
err "Cannot find  firmware file '$FIRMWARE'"
exit 1
Note: Don't forget to make /sbin/firmware.sh executable by root - The latest firmware files for the RT chipsets that require it can be downloaded from [Here] - Unpack the firmware files to /lib/firmware

Configuration

Edit your /etc/conf.d/net. The default should do the trick (iwconfig + dhcp) for most users. In case you need something more elaborated, check the net.example and wireless.example files.

Warning: There should not be the need for any other kind of configuration. The configuration steps described below only apply to legacy drivers.

Don't forget to make your symlink net.wlan0 -> net.lo in your /etc/init.d folder. You can also add it to the default runlevel (rc-update add net.wlan0 default) in case your net.* services are not device initiated.

"Legacy" Driver

Kernel

        Kernel config option            Required for component
        ------------------------------------------------------------------
        # CONFIG_NET_WIRELESS           all
        # CONFIG_NET_RADIO              all
        # CONFIG_IEEE80211              all
        # CONFIG_IEEE80211_CRYPT_WEP    if you use WEP
        # CONFIG_PCI                    rt2400pci, rt2500pci, rt61pci
        # CONFIG_USB                    rt2500usb, rt73usb
        # CONFIG_HOTPLUG                rt61pci, rt73usb
        # CONFIG_FW_LOADER              rt61pci, rt73usb
        # CONFIG_INPUT                  rfkill
        # CONFIG_CRYPTO                 d80211
        # CONFIG_CRYPTO_AES             d80211
        # CONFIG_CRYPTO_AES_586         d80211 (optional, only for x86)
        # CONFIG_CRYPTO_AES_X86_64      d80211 (optional, only for x86_64)
        # CONFIG_CRYPTO_ARC4            d80211

Then, recompile

Driver

1. Emerge the driver

  #emerge --sync
  #emerge net-wireless/rt2500 (or your chipset)

Or get the latest driver from http://rt2x00.serialmonkey.com/wiki/index.php/Downloads ( I used the nightly builds). At this stage, I found rt2x00 unusable but rt2500 worked flawlessly.

2. With a bit of luck, upon reboot everything will be fine. The module will load without any error messages and 'iwconfig ra0' will give something like

ra0       RT2500 Wireless  ESSID:""
          Mode:Managed  Frequency=2.412 GHz  Bit Rate:11 Mb/s   Tx-Power:0 dBm   
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Link Quality=0/100  Signal level=-120 dBm  Noise level:-192 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

3. Make rc know about this device,

# cd /etc/init.d
# ln -s net.lo net.ra0
# rc-update add net.ra0 default

To delete the eth0 reference (careful, don't do this until you are sure):

# rc-update del net.eth0


4. Because I knew my network IP range etc., I was immediately able to gain access to network by typing the following commands (key is in hex format):

# iwconfig ra0 mode Managed
# iwconfig ra0 key 16284a2b28882c5554514d9999
# ifconfig ra0 192.168.1.2 broadcast 192.168.1.255 netmask 255.255.255.0 up
# route add default gw 192.168.1.1

Please note that it is important that the .dat file be placed in the proper directory, and that you edit it initially. This is due to the file's interaction with the "Legacy Binary"

5. Put the connection details in the wireless configuration file:

File: Configuration File: /etc/conf.d/wireless
		essid_ra0="house"
		key_house="16284a2b28882c5554514d9999 enc restricted"

The gentoo documentation for wireless configuration at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4 describes how you can add the above configuration to either /etc/conf.d/wireless or /etc/conf.d/net, but recommends adding it to /etc/conf.d/net.

6. Optionally specify dhcp (dhcp is assumed if nothing is set)

File: Configuration File: /etc/conf.d/net
config_ra0=( "dhcp" )

7. Start the wireless network connection

# /etc/init.d/net.ra0 start

8. Connect to the wireless network at boot

# rc-update add net.ra0 default

p.s. You should be able to access the RaConfig2500 utility (Signal strength, WPA etc.) by entering this command (I have not really used this utility)

# RaConfig2500

Good luck.

Ndiswrapper

http://ndiswrapper.sourceforge.net/ has a guide of how to install along with a list of supported cards - go to the list to find cards with RT2500 chipsets along with working windows drivers to use in ndiswrapper.

EDIT JG 20 Oct 2006: Hope this helps someone, I've put this in because it is quite hard to find concrete info on doing anything with an rt2400. I have an rt2400 (doh!) and wanted to use SMP. For quite some time I have been happily using NDISwrapper with the driver from here: http://www.ralinktech.com/drivers/Windows/2004_0505_IS_RT2460_WPA_Drv2.1.0.1.zip However version 1.25 broke it. I reverted back to 1.23 and that fixed it again. I am not sure yet what was wrong and don't particularly care so wont pursue it as this is an old card. To summarise, I have an rt2400 working with ndiswrapper 1.23 + wpa_supplicant 0.5.5 on kernel 2.6.18. It's very stable and doesn't need to be the cause of hamstringing your system by turning off smp or messing with stack sizes.

rt2400 with ndiswrapper 1.47 works with windows driver from http://www.ralinktech.com.tw/data/2004_0505_IS_RT2460_WPA_Drv2.1.0.1.zip

set up the driver (may be obsolete)

# mkdir rt2500
# cd rt2500
# wget http://rt2x00.serialmonkey.com/rt2500-cvs-daily.tar.gz
# tar -xvvf rt2500-cvs-daily.tar.gz
# cd [new dir created]/Module
# mkdir /etc/Wireless/RT2500STA/
# cp RT2500STA.dat /etc/Wireless/RT2500STA/


Setting up the network

run /sbin/ifconfig ra0 inet YOUR_IP up

RT2500 driver can be configured via following interfaces, i.e. (i) iwconfig command, (ii) iwpriv command, (iii) configuration file, (iv) RaConfig2500

  1. iwconfig comes with kernel.
  2. iwpriv usage, please refer to file iwpriv_usage.txt for details.
  3. copy configuration file RT2500STA.dat to /etc/Wireless/RT2500STA/RT2500STA.dat. Please refer to 3.1) for details.
  4. RT2500 provides GUI : RaConfig2500
File: Configuration File: RT2500STA.dat
# Copy this file to /etc/Wireless/RT2500STA/RT2500STA.dat
# This file is a binary file and will be read on loading rt2500.o module.
#
# Use "vi -b RT2500STA.dat" to modify settings according to your need.
# 
# 1.) set NetworkType to "Adhoc" for using Adhoc-mode, otherwise using as Infrastructure-mode
# 2.) set Channel to "0" for auto-select on Infrastructure mode
# 3.) set SSID for connecting to your Accss-point.
# 4.) AuthMode can be "OPEN", "SHARED", "WPAPSK", "WPANONE"
# 5.) EncrypType can be "NONE", "WEP", "TKIP", "AES"
# for more information refer to the Readme file.
# 
[Default]
CountryRegion=0
WirelessMode=0
SSID=AP350
NetworkType=Infra
Channel=0
AuthMode=OPEN
EncrypType=NONE
DefaultKeyID=1
Key1Type=0
Key1Str=0123456789
Key2Type=0
Key2Str=
Key3Type=0
Key3Str=
Key4Type=0
Key4Str=
WPAPSK=abcdefghijklmnopqrstuvwxyz
TXBurst=0
TurboRate=0
BGProtection=0
ShortSlot=0
TxRate=0
RTSThreshold=2312
FragThreshold=2312
PSMode=CAM
-----------------------------------------------
syntax is 'Param'='Value' and describes below. 

1. CountryRegion=value
   value
        0:      for use channel 1-11
        1:      for use channel 1-11
        2:      for use channel 1-13
        3:      for use channel 10-11
        4:      for use channel 10-13
        5:      for use channel 14
        6:      for use channel 1-14
        7:      for use channel 3-9
2. WirelessMode=value
   value
        0:      802.11 B/G mixed
        1:      802.11 B only
3. SSID=value
   value
         1~32 ascii characters.
4. NetworkType=Infra
   value
       Infra : infrastructure mode
       Adhoc : adhoc mode
5. Channel=value
    value
        1~14 depends on  CountryRegion
6. AuthMode=value
    value
        OPEN      For Open System
        SHARED    For Shared key system
        WPAPSK    
7. EncrypType=value
    value
        NONE      :For AuthMode=OPEN
        WEP       :For AuthMode=OPEN or AuthMode=SHARED
        TKIP      :For AuthMode=WPAPSK
        AES       :For AuthMode=WPAPSK
8. DefaultKeyID=value
    value
        1 ~ 4
9. Key1Type=value
    value
        0:        Hexadecimal
        1:        Ascii
10. Key1Str=value
    value
        10 or 26 hexadecimal characters eg: 012345678
        5 or 13 ascii characters eg: passd
11. Key2Type=value
    value
        0:        Hexadecimal
        1:        Ascii
12. Key2Str=value
    value
        10 or 26 hexadecimal characters eg: 012345678
        5 or 13 ascii characters eg: passd
13. Key3Type=value
    value
        0:        Hexadecimal
        1:        Ascii
14. Key3Str=value
    value
        10 or 26 hexadecimal characters eg: 012345678
        5 or 13 ascii characters eg: passd
15. Key4Type=value
    value
        0:        Hexadecimal
        1:        Ascii
16. Key4Str=value
    value
        10 or 26 hexadecimal characters eg: 012345678
        5 or 13 ascii characters eg: passd
17. WPAPSK=value
    value
        8 ~ 63 characters
          or
        64 hexadecimal characters
18. TxBurst=value
    value
        0:        Disable
        1:        Enable
19. TurboRate=value
    value
        0:        Disable
        1:        Enable
20. BGProtection=value
   value
        0:        Auto
        1:        Always On
        2:        Always Off
21. ShortSlot=value
    value
        0:        Disable
        1:        Enable
22. TxRate=value
   value
         0:     Auto
         1:     1 Mbps
         2:     2 Mbps
         3:     5.5 Mbps
         4:     11 Mbps 
         5:     6  Mbps  //WirelessMode must be 0
         6:     9  Mbps  //WirelessMode must be 0
         7:     12 Mbps  //WirelessMode must be 0
         8:     18 Mbps  //WirelessMode must be 0
         9:     24 Mbps  //WirelessMode must be 0
        10:     36 Mbps  //WirelessMode must be 0
        11:     48 Mbps  //WirelessMode must be 0
        12:     54 Mbps  //WirelessMode must be 0
23. RTSThreshold=value
    value
        1 ~ 2312
24. FragThreshold=value
    value
        256 ~ 2312
25. PSMode=value
    value
    MAX_PSP   Power Saving Mode
    CAM   CAM (Constantly Awake Mode)   

26. AdhocModeRate=value
    value
    0:		Adhere WIFI spec
    1:		Violate WIFI spec

27. ApClient=value
    value
    0:		Disable ApClient mode
    1:		Enable ApClient mode


Or have a look at the Wireless/Configuration for a more elaborate explanation.

configure

# nano /etc/Wireless/RT2500STA/RT2500STA.dat

Mine looks like:

File: /etc/Wireless/RT2500STA/RT2500STA.dat
# Copy this file to /etc/Wireless/RT2500STA/RT2500STA.dat
# This file is a binary file and will be read on loading rt2500.o module.
# Use "vi -b RT2500STA.dat" to modify settings according to your need.

[Default]
AdhocOfdm=0
CountryRegion=0
WirelessMode=0
TXBurst=0
TurboRate=0
BGProtection=0
ShortSlot=0
TxRate=0
PSMode=CAM
SSID=my router name goes here
NetworkType=Infra
AuthMode=WPAPSK
EncrypType=TKIP
WPAPSK=my long pass goes here hehehe
PSMode=CAM


Now change /etc/conf.d/net to

File: in /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
modules=( "!iwconfig" )


Note: The modules line did the trick. Read /etc/conf.d/wireless.example


Now add last line to

File: /etc/modules.autoload.d/kernel-2.6
# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.#
# Note that this file is for 2.6 kernels.
#
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

# For example:
# 3c59x
rt2500


Change back to rt2500/[installed dir]/Module

# cd rt2500/xxxxxxxxx/Module
# make && make install
# ifconfig ra0 down
# modprobe rt2500

Reboot and you should be up and working.

Problems with Ralink Linux drivers

Weblinks

Retrieved from "http://www.gentoo-wiki.info/Rt2x00"

Last modified: Sat, 13 Sep 2008 22:03:00 +0000 Hits: 80,537