# --SOLVED-- broadcom-sta: can't set wep key

## VanFanel

Hello guys

I've seen there have been similar threads in the past and I've been reading them but they reffer to old kernels with different options, so I must open this one.

I'm on a Mc Mini with BCM4328, kernel 2.6.36.

I'm using the broadcom-sta drivers. They seem to work well, according to dmesg and iwconfig:

```

commodore linux # dmesg |grep eth1

eth1: Broadcom BCM4328 802.11 Hybrid Wireless Controller 5.100.82.38

commodore linux # iwconfig eth1 txpower on

commodore linux # iwconfig eth1           

eth1      IEEE 802.11abgn  ESSID:""  Nickname:""

          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   

          Bit Rate:130 Mb/s   Tx-Power:24 dBm   

          Retry min limit:7   RTS thr:off   Fragment thr:off

          Power Managementmode:All packets received

          Link Quality=5/5  Signal level=0 dBm  Noise level=0 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

```

I can also scan for networks:

```

commodore linux # iwlist eth1 scan

eth1      Scan completed :

          Cell 01 - Address: 00:02:CF:4D:D7:B9

                    ESSID:"WLAN_94"

                    Mode:Managed

                    Frequency:2.452 GHz (Channel 9)

                    Quality:3/5  Signal level:-68 dBm  Noise level:-92 dBm

                    Encryption key:on

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s

                              6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s

                              36 Mb/s; 48 Mb/s; 54 Mb/s

          Cell 02 - Address: 00:23:F8:C9:30:AC

                    ESSID:"WLAN_CD"

                    Mode:Managed

                    Frequency:2.462 GHz (Channel 11)

                    Quality:0/5  Signal level:-93 dBm  Noise level:-92 dBm

                    Encryption key:on

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s

                              6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s

                              36 Mb/s; 48 Mb/s; 54 Mb/s

```

However, I can't set the WEP encryption key.

```

commodore linux # iwconfig eth1 key s:12341234

Error for wireless request "Set Encode" (8B2A) :

    SET failed on device eth1 ; Invalid argument.

```

I supposed some encryption stuff could be missing from the kernel, but I believe it isn't, correct me otherwise:

```

commodore linux # cat .config | grep 80211

CONFIG_CFG80211=y

# CONFIG_NL80211_TESTMODE is not set

# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set

# CONFIG_CFG80211_REG_DEBUG is not set

# CONFIG_CFG80211_DEFAULT_PS is not set

# CONFIG_CFG80211_INTERNAL_REGDB is not set

# CONFIG_CFG80211_WEXT is not set

CONFIG_LIB80211=y

CONFIG_LIB80211_CRYPT_WEP=y

CONFIG_LIB80211_CRYPT_CCMP=y

CONFIG_LIB80211_CRYPT_TKIP=y

# CONFIG_LIB80211_DEBUG is not set

CONFIG_MAC80211=y

CONFIG_MAC80211_HAS_RC=y

# CONFIG_MAC80211_RC_PID is not set

CONFIG_MAC80211_RC_MINSTREL=y

CONFIG_MAC80211_RC_MINSTREL_HT=y

CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y

CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"

# CONFIG_MAC80211_MESH is not set

# CONFIG_MAC80211_LEDS is not set

# CONFIG_MAC80211_DEBUG_MENU is not set

# CONFIG_MAC80211_HWSIM is not set

```

Any ideas, please? I don't know what else to try, I'm sure someone has had this problem with recent kernel...

thanksLast edited by VanFanel on Wed Dec 29, 2010 8:34 pm; edited 1 time in total

----------

## VanFanel

Ok, for other people's sake, I'm posting the final solution to this. It took me a lot of trial and error, so I hope it serves others in my situation  :Smile: 

DON'T lose your time trying to set the wep encryption with iwconfig. It just won't work. Use WPA_Supplicant instead. It's very lightweigh, too. You don't need any sucking GUI programs to connect, so don't fear and read on  :Very Happy: 

First of all, DON'T install the broadcom-sta driver manually. I did so, and it really doesn't check all the needed kernel options, while the ebulid script does. The ebuild will force you to activate/deactivate the correct IEE80211 options and extensions, and won't install otherwise (wich eliminates A LOT of trial and error that needs kernel recompilation again and again..)

I was manually installing from the hybrid package in broadcom's site because:

-The in-kernel bcm43xx driver was spitting an INVALID PHY error on me (dmesg helped here) so it wouldn't load.

-The simple "emerge broadcom-sta" didn't work yesterday (nor does it work today, there's a bug filed). It happens because broadcom crew deletes every old versoin from their FTP and there is no ebuild for the new version. 

The bug is already noticed, and the solution to install the latest version from emerge is here:

https://bugs.gentoo.org/349646

BUT this situation should be fixed soon, so you shouldn't need to fiddle with temporary ebuilds. 

So I went aand used that solution, and finally emerged broadcom-sta.

After that, make sure to run: 

```
update-modules -f
```

and get sure iwconfig reports about the eth1 interface.

Now, emerge wpa_supplicant, and edit the following files to suit your own needs. These are my relevant files (note I use fixed ip in the local network, mybe you should go for DHCP instead), for reference:

```

commodore ~ # cat /etc/wpa_supplicant/wpa_supplicant.conf 

ctrl_interface=/var/run/wpa_supplicant 

ctrl_interface_group=0 

ap_scan=1 

update_config=1 

network={

   ssid="WLAN_94"

   scan_ssid=1

   priority=5

   key_mgmt=NONE

   wep_key0=5a303030324346353534343934

   wep_tx_keyidx=0

}

commodore ~ # cat /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 :]!).

config_eth0=("192.168.3.19 netmask 255.255.255.0")

routes_eth0=("default gw 192.168.3.1")

#WPA_SUPPLICANT 

modules=( "wpa_supplicant" ) 

wpa_supplicant_eth1="-Dwext" 

#config_eth1=( "dhcp" )

config_eth1=("192.168.1.44 netmask 255.255.255.0")

routes_eth1=("default gw 192.168.1.1")

commodore ~ # cat /etc/resolv.conf 

# /etc/resolv.conf.head can replace this line

nameserver 192.168.1.1

```

Don't you forget to cp /etc/init.d/net.eth0 to /etc/init.d/net.eth1, since you won't have a launch script for the eth1 interface until you do so  :Smile: 

Now, I just had to /etc/init.d/net.eth1 start, and after a while, I was here reporting my success  without any wires  :Very Happy: 

PD: I know my WEP key is up there. I don't give a shit, if you're manually configuring your wireless network interface, I'm sure it would take you five minutes to crak it up anyway  :Very Happy: 

regards

----------

## ghrueff

Your solution worked great.  Thank-you.

I had the exact same problem only a different broadcom card and it is working.

06:00.0 Network controller: Broadcom Corporation Device 4353 (rev 01)

The only thing I had to do was convert my passphrase into a hexadecimal key.  This is very easy with python...

$ python

>>> import binascii

>>> binascii.hexlify("yourpassphrase")

'hexkeyhere'

>>> quit()

or you can do it manually with...

$ man ascii

----------

## el_Salmon

It works for me too in my Apple Mac mini. Thank you very much!

----------

## ringosc

I'm on 2.6.37-r1, finally got it working. 

thanks a lot  :Smile: 

----------

