# iwl3945 + wpa_supplicant + hardware switch

## Inside

Hi everyone!

I've got a problem with wpa_supplicant that bugs me for some time now. If I have the hardware switch turned on before I boot gentoo everything works fine, but when I switch it of and on again or switch it on after gentoo has booted wpa_supplicant can't find any network (wpa_cli status says scanning forever). 

To get it back working again I have to switch it off and kill wpa_supplicant, then switch it on again and run /etc/init.d/net.eth1 restart. 

I have hotplug, coldplug enabled in /etc/conf.d/rc, ifplugd installed and I use the iwl3945 kernel driver on gentoo-2.6.25-r8.

/etc/conf.d/net

```

dns_domain="home"

config_eth0=( "dhcp" )

dhcpcd_eth0="-t 3"

config_eth1=( "dhcp" )

modules_eth1=( "wpa_supplicant" )

wpa_supplicant_eth1="-w -Dwext"

```

wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=0

fast_reauth=1

eapol_version=1

ap_scan=1

network={

        ssid="home"

        bssid=00:0F:EA:84:56:C8

        scan_ssid=1

        proto=WPA

        key_mgmt=WPA-PSK

        pairwise=CCMP

        group=CCMP

        psk=XXXX

        priority=10

}

```

So, does anyone have any idea what I did wrong?

----------

## d2_racing

Hi, first I'm stone to see that you don't use wlan0 ?

Can you post this :

```

# lspci

# ifconfig -a

# iwconfig

# rmmod iwl3945

# modprobe iwl3945

# dmesg | tail

```

----------

## Inside

Do you think the devicename brakes any scripts? I changed that a while ago when I switched from ipw3945 to iwl3945.

lspci

```
00:00.0 Host bridge: Intel Corporation Mobile Memory Controller Hub (rev 03)

00:01.0 PCI bridge: Intel Corporation Mobile PCI Express Root Port (rev 03)

00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 03)

00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)

00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)

00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)

00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)

00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)

00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03)

00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)

00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)

00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)

00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)

00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)

00:1f.0 ISA bridge: Intel Corporation Mobile LPC Interface Controller (rev 03)

00:1f.1 IDE interface: Intel Corporation Mobile IDE Controller (rev 03)

00:1f.2 SATA controller: Intel Corporation Mobile SATA AHCI Controller (rev 03)

00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)

01:00.0 VGA compatible controller: nVidia Corporation Device 0425 (rev a1)

04:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)

06:00.0 Mass storage controller: Silicon Image, Inc. Device 3531 (rev 01)

07:04.0 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02)
```

ifconfig

```
eth0      Link encap:Ethernet  HWaddr 00:03:0d:80:73:b7  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

          Interrupt:218 Base address:0xc000 

eth1      Link encap:Ethernet  HWaddr 00:13:02:e3:2e:36  

          inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::213:2ff:fee3:2e36/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2034 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2376 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1342365 (1.2 MiB)  TX bytes:428903 (418.8 KiB)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  

          NOARP  MTU:1460  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:74 errors:0 dropped:0 overruns:0 frame:0

          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:5316 (5.1 KiB)  TX bytes:5316 (5.1 KiB)

sit0      Link encap:IPv6-in-IPv4  

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-13-02-E3-2E-36-65-74-00-00-00-00-00-00-00-00  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

```

iwconfig

```

eth1      IEEE 802.11g  ESSID:"home"  

          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:0F:EA:84:56:C8   

          Bit Rate=54 Mb/s   Tx-Power=27 dBm   

          Retry min limit:7   RTS thr:off   Fragment thr=2352 B   

          Encryption key:551C-CEF2-64B7-1D58-32B7-6047-AE0B-AB8E [4]

          Link Quality=93/100  Signal level=-37 dBm  Noise level=-71 dBm

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

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

```

dmesg after rmmod && modprobe iwl3945

```

iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.2.23k

iwl3945: Copyright(c) 2003-2007 Intel Corporation

ACPI: PCI Interrupt 0000:04:00.0[A] -> GSI 18 (level, low) -> IRQ 18

PCI: Setting latency timer of device 0000:04:00.0 to 64

iwl3945: Detected Intel PRO/Wireless 3945ABG Network Connection

iwl3945: Tunable channels: 13 802.11bg, 23 802.11a channels

phy2: Selected rate control algorithm 'iwl-3945-rs'

udev: renamed network interface wlan0 to eth1

ACPI: PCI Interrupt 0000:04:00.0[A] -> GSI 18 (level, low) -> IRQ 18

ADDRCONF(NETDEV_UP): eth1: link is not ready

```

No connection after that, so I had to run /etc/init.d/net.eth1 restart

dmesg after net.eth1 restart

```

ADDRCONF(NETDEV_UP): eth1: link is not ready

eth1: Initial auth_alg=0

eth1: authenticate with AP 00:0f:ea:84:56:c8

eth1: RX authentication from 00:0f:ea:84:56:c8 (alg=0 transaction=2 status=0)

eth1: authenticated

eth1: associate with AP 00:0f:ea:84:56:c8

eth1: RX AssocResp from 00:0f:ea:84:56:c8 (capab=0x431 status=0 aid=1)

eth1: associated

ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready

eth1: switched to short barker preamble (BSSID=00:0f:ea:84:56:c8

```

----------

## jcat

I believe proper support for both the RF kill switch and the LED is available in 2.6.26, I believe 2.6.25 is limited.

I tried testing version of 2.6.26-r1 and it does work, however there is some other strangeness going that made we want to stay with the current most recent stable versions of Gentoo Sources rather than the testing version.  So, for now I remain on 2.6.25-r7

Cheers,

jcat

----------

## Etal

I have a similar problem. If I switch it off while it's working and switch it back on again, it works. However, if I boot up with he switch off, I have to restart the network. As a solution I have a little script that does a few useful commands through sudo.

I use linux-2.6.27-rc6, and I had the same thing with 2.6.26.

----------

## d2_racing

Hi, we gonna need to clean up your previous IPW3945 installation.

First, can you post this :

```

# equery list ipw

```

If you still have something, then emerge -C [package_name]

Also, I'm sure that Udev is crazy :

```

# cat /etc/udev/rules.d/70-persistent-net.rules

```

If you have a line like this :

```

# PCI device 0x8086:0x4227 (ipw3945)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:1b:77:4f:4b:1a", NAME="eth1"

```

Comment it and also, you need to reboot your box and recreate this :

```

# cd /etc/init.d

# ln -sfn net.lo net.wlan0

```

Now, do you still have the problem ?

----------

## Inside

Jupp, it's still there. 

I had nothing left installed from the old driver.

equery list ipw

```
one inside # equery list ipw

[ Searching for package 'ipw' in all categories among: ]

 * installed packages

one inside # 
```

I changed the devicename to wlan0, but that didn't do the the trick.

old 70-persistent-net.rules

```
# This file was automatically generated by the /lib/udev/write_net_rules

# program run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x10ec:0x8168 (r8169)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:03:0d:80:73:b7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (ipw3945)

#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:02:e3:2e:36", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x4222 (iwl3945)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:02:e3:2e:36", ATTR{type}=="1", KERNEL=="wlan*", NAME="eth1"
```

new70-persistent-net.rules

```
# This file was automatically generated by the /lib/udev/write_net_rules

# program run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x10ec:0x8168 (r8169)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:03:0d:80:73:b7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (ipw3945)

#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:02:e3:2e:36", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x4222 (iwl3945)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:02:e3:2e:36", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
```

----------

## jcat

Hi,

It's nice that you got your interface names sorted out, but I don't believe that's your problem.  It's the kernel!

As in my previous post, you need to use 2.6.26 for proper RF kill switch operation.  Unless someone knows otherwise, your requirements won't be met until you start using 2.6.26 instead of 2.6.25.

Cheers,

jcat

----------

## d2_racing

In fact, you need to use the kernel 2.6.26, but the Iwl3945 really need to communicate with the wlan0 interface.

So, I think that this is part of your problem.

----------

## d2_racing

You will need this inside your kernel :

```

(M) RF switch subsystem support

   (M) Input layer to RF switch connector

(*) Wireless LAN

     (*) Wireless LAN (IEEE 802.11)

          (M) Intel Wireless Wifi Core

          (*) IWLWIFI RF kill support

          (M) Intel PRO/Wireless 3945ABG/BG Network Connection

          (*) Enable Spectrum Measurement in iwl3945 drivers

          (*) Enable LEDS features in iwl3945 driver

          (*) Enable full debugging output in iwl3945 driver

(*) LED Class Support

      (*) LED Trigger support

(*) Cryptographic algorithm manager

     (M) SHA1 digest algorithm

     (M) SHA256 digest algorithm

     (M) ECB support

     (M) CBC support

     (M) PCBC support

     (*) AES cipher algorithms

     (*) AES cipher algorithms (i586)

     (*) ARC4 cipher algorithm

     (*) Michael MIC keyed digest algorithm

```

For the rest, just post if you need help with the kernel 2.6.26.

----------

## Inside

Thanks! I tried kernel 2.6.26 but without success.

I will try it again when gentoo-sources-2.6.26 go stable.

Thanks anyway!

----------

## d2_racing

No problem  :Razz: 

----------

## Mr. Ulmo

Try this:

```
cat /sys/class/net/wlan0/device/enable
```

if it's 0

then try this:

```
echo 1 >> /sys/class/net/wlan0/device/enable
```

this should turn on the hardware.

the path is for my hardware, and you may need to tweak it a bit to get it to work

----------

