# rt2500:unstable with ndiswrapper; rt2x00 doesn't ...[solved]

## t3k0

Hi,

I spent lots of hours trying to get mit wirelesscard with rt2500-chipset to run, but without real success, since the legacy drivers are no longer supportet by serialmonkey.com.

I tried to use the windowsdrivers from ralinktech.com with ndiswrapper. They work, but really unstable. With them the connection stays for a few minutes and then I need to kill wpa_supplicant, modprobe -r ndiswrapper, iwpriv wlan0 -a and set everything up with ifconfig and so on by hand.

When the connection breaks, the output of wpa_supplicant looks like this:

```

gentoo wpa_supplicant # wpa_supplicant -iwlan0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf

CTRL-EVENT-SCAN-RESULTS                                                                         

Trying to associate with 00:03:c9:b6:02:7d (SSID='uNSRNTZ' freq=2462 MHz)                       

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-CONNECTED - Connection to 00:03:c9:b6:02:7d completed (auth) [id=0 id_str=]          

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-CONNECTED - Connection to 00:03:c9:b6:02:7d completed (reauth) [id=0 id_str=]        

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-CONNECTED - Connection to 00:03:c9:b6:02:7d completed (reauth) [id=0 id_str=]        

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys                                        

ioctl[SIOCSIWENCODEEXT]: Invalid argument                                                       

ioctl[SIOCSIWENCODEEXT]: Invalid argument                                                       

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-CONNECTED - Connection to 00:03:c9:b6:02:7d completed (reauth) [id=0 id_str=]        

CTRL-EVENT-SCAN-RESULTS                                                                         

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

CTRL-EVENT-CONNECTED - Connection to 00:03:c9:b6:02:7d completed (reauth) [id=0 id_str=]        

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]                       

Associated with 00:03:c9:b6:02:7d                                                               

WPA: Key negotiation completed with 00:03:c9:b6:02:7d [PTK=CCMP GTK=TKIP]

```

There is no real error message, but it doesn't connect to my access point any more.

Here my wpa_supplicant.conf:

```

# This is a network block that connects to any unsecured access point.

# We give it a low priority so any defined blocks are preferred.

#network={

#       key_mgmt=NONE

#       priority=-9999999

#}

# Die folgende Zeile nicht ändern, sonst wird nichts funktionieren

ctrl_interface=/var/run/wpa_supplicant

# Sicherstellen, dass nur root die WPA Konfiguration lesen kann

ctrl_interface_group=0

# wpa_supplicant soll sich um scannen und AP Auswahl kümmern

ap_scan=1

# Einfacher Fall: WPA-PSK, wobei PSK eine ASCII Passphrase ist,

# erlauben aller gülten Chiffre

network={

        ssid="uNSRNTZ"

        scan_ssid=1

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        group=CCMP TKIP

        psk="mypsk"

# Je höher die Priorität, desto schneller werden wir verknüpft

        priority=-9999999

}

```

I asume it is correct since the connection works for a few minutes.

Since it is very annoying to stop and set everything up every few minutes I tried to use the in-kernel rt2x00 drivers with the same wpa_supplicant.conf. Unfortunately with these drivers it doesn't connect at all.

wpa_supplicant is only scanning and doesn't find my access point:

```

wpa_supplicant -iwlan0 -Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf

CTRL-EVENT-SCAN-RESULTS                                                                         

CTRL-EVENT-SCAN-RESULTS                                                                         

CTRL-EVENT-SCAN-RESULTS                                                                         

CTRL-EVENT-SCAN-RESULTS 

```

When I do iwlist wlan0 scanning I get the message: "interface doesn't support scanning".

Can you please give me a hint how to go on? If you need more information please ask.

Best regards and thanks in advance

t3k0Last edited by t3k0 on Sun Jul 12, 2009 1:30 pm; edited 1 time in total

----------

## agent_jdh

Drivers for the Ralink cards are now actually in the kernel, so use them.  They are actually the serialmonkey ones, so you don't need that ebuild (or the actual ralink driver ebuild) now.  My rt61 pci wireless card works great here with wpa_supplicant.

----------

## t3k0

I didn't use the ebuild before but the legacy rt2500 from cvs. They worked fine until they stopped the support.

 The in-kernel drivers are not the legacy drivers but the rt2x00. Unfortunately with this drivers I get no scan results. Neither with wpa_supplicant nor with iwlist wlan0 scanning. (See above)

I tried it with them build into the kernel and as modules. Both ways were not successful. Even though it seems the modules rt2x00pci, rt2x00lib and rt2500pci are loaded correctly.

----------

## agent_jdh

Did you add support for mac80211 (in the wireless section)?  Post your kernel config.

What does lsmod show?  Here's a quick snapshot of mine (just the relevant section) -

```
rt61pci                18888  0

crc_itu_t                980  1 rt61pci

rt2x00pci               3677  1 rt61pci

rt2x00lib              16312  2 rt61pci,rt2x00pci

mac80211              104248  2 rt2x00pci,rt2x00lib

r8169                  23739  0

cfg80211               22234  2 rt2x00lib,mac80211

bitrev                   772  1 r8169

crc32                   2860  2 mac80211,r8169

sg                     14448  0

mii                     3052  1 r8169

eeprom_93cx6             988  1 rt61pci
```

----------

## t3k0

Before I answer to your question I should tell the good news that I got the in-kernel 2x00-drivers running. They are a little bit slower than the windows-drivers with ndiswrapper but are more or less stable.

There seems to be a bug in the 2.60.30 kernel series. I tried both vannilla and gentoo-sources and with the *30 kernel I don't get a connection. With the same .config the drivers work with both vanilla-sources-2.6.31-rc2 and gentoo-sources-2.6.29-r5.

There is just one problem left:

Setting everything up manually in the shell works fine. But it doesn't with /etc/conf.d/net. After starting /etc/init.d/net.wlan0, I need to run wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf in a shell.

Can you please tell me what is missing in my /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" "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

#wpa_timeout_wlan0=60

config_wlan0=( "192.168.0.3" )

routes_wlan0=( "default gw 192.168.0.1" )

dns_servers_wlan0=( "192.168.0.1" )

config_eth0=( "192.168.1.12 netmask 255.255.255.0 brd 192.168.1.255" )

```

Now to your questions agent_jdh:

 *Quote:*   

> 
> 
> Did you add support for mac80211 (in the wireless section)? Post your kernel config.
> 
> 

 

Here is my .config. 

My lsmod says:

```

Module                  Size  Used by

nvidia               7217744  36

amd64_agp               8800  1

agpgart                25500  2 nvidia,amd64_agp

rt2500pci              14072  0

rt2x00pci               6348  1 rt2500pci

rt2x00lib              25320  2 rt2500pci,rt2x00pci

```

Regards,

t3k0

----------

## agent_jdh

Here's the relevant /etc/conf.d/net config for rt61 here -

```
# new wireless config for kernel driver & wpa_supplicant

modules_wlan0=( "!iwconfig" "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_wlan0=( "dhcp" )

wpa_timeout_wlan0=60

associate_timeout_wlan0=60
```

That last line was very important - otherwise it backgrounds the service and others that require the network to be up fail to start.

Btw, can you not just use dhcp and configure your router to give the same ip address to your wireless card (usually done by hostname or mac address).

Also my /etc/wpa_supplicant/wpa_supplicant.conf using wpa2psk/ccmp -

```
# first attempt with kernel driver

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

network={

        ssid="YOUR_SSID_HERE"

        scan_ssid=1

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP

        group=CCMP

        psk="YOUR_PSK_HERE"

        priority=5

}
```

----------

## t3k0

Unfortunately the associate_timeout-line didn't do it. I still need to run wpa_supplicant in a shell after boot.

I was wondering if wpa_supplicant is running directly after boot, but ps says it doesn't. Another try was to put the wpa_supplicant.conf from /etc/wpa_supplicant to /etc as it is written in /etc/conf.d/net.example. But this had no effect.

Then I tried to add the following line:

```

postup () {

          wpa_supplicant -B -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf

}

```

But this only leads to a message that wlan0 is busy. So I'm forced to kill wpa_supplicant after boot and run it again manually.

I'm using static ips because when I run dhcp in my router, I get random ips. Unfortunately there is no option in my router to assign defined ip-addresses to mac-adresses.

Here's my present /etc/conf.d/net:

```

modules=( "!iwconfig" "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_wlan0=( "192.168.0.3" )

routes_wlan0=( "default gw 192.168.0.1" )

dns_servers_wlan0=( "192.168.0.1" )

wpa_timeout_wlan0=60

associate_timeout_wlan0=60

config_eth0=( "192.168.1.12 netmask 255.255.255.0 brd 192.168.1.255" )

```

Regards

t3k0

----------

## agent_jdh

Try changing

```
modules=( "!iwconfig" "wpa_supplicant" )
```

to

```
modules_wlan0=( "!iwconfig" "wpa_supplicant" )
```

It's about the only thing I can think of/see.

----------

## t3k0

This didn't work either.

Another interesting thing I noticed: By changing the order of "!iwconfig" and "wpa_supplicant" the /etc/init.d/net.wlan0 start tries to assign a WEP-key and fails complaining no WEP-key assigned. So it seems it is using iwconfig and the wpa_supplicant module is not started.

Can you please tell me the location of your wpa_supplicant.conf and the version of your wpa_supplicant?

----------

## agent_jdh

```
[ebuild   R   ] net-wireless/wpa_supplicant-0.6.4  USE="readline ssl -dbus -debug -eap-sim -gnutls -madwifi -ps3 -qt3 -qt4" 0 kB
```

```
/etc/wpa_supplicant/wpa_supplicant.conf
```

Could you post your wpa_supplicant.conf file (all of it, minus your passkey and ssid, because I had an issue with it trying to associate with a.n.other WEP AP before my own AP)

----------

## t3k0

Now it works. A downgrade to wpa_supplicant-0.6.4 did it. There seems to be a bug in wpa_supplicant-0.6.9, too.

Here is my wpa_supplicant.conf:

```

# This is a network block that connects to any unsecured access point.

# We give it a low priority so any defined blocks are preferred.

#network={

#       key_mgmt=NONE

#       priority=-9999999

#}

# Die folgende Zeile nicht ändern, sonst wird nichts funktionieren

ctrl_interface=/var/run/wpa_supplicant

# Sicherstellen, dass nur root die WPA Konfiguration lesen kann

ctrl_interface_group=0

# wpa_supplicant soll sich um scannen und AP Auswahl kümmern

ap_scan=1

# Einfacher Fall: WPA-PSK, wobei PSK eine ASCII Passphrase ist,

# erlauben aller gülten Chiffre

network={

        ssid="myssid"

        scan_ssid=1

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        group=CCMP TKIP

        psk="mykey"

# Je höher die Priorität, desto schneller werden wir verknüpft

        priority=-9999999

}

```

Thank you very much for the help.

----------

## agent_jdh

 *t3k0 wrote:*   

> NThere seems to be a bug in wpa_supplicant-0.6.9, too.

 

File a report on bugzilla against 0.6.9

----------

## t3k0

Done.

Thanks again.

----------

