# [SOLVED] iwl4965 problem with rfkill in a Compal IFL91

## marcv

Hi. I have some problems with wifi in a new Compal IFL91 laptop. The wireless card is an Intel 4965, which should be supported, but I have never been able to connect to a wireless network. I'm running a 2.6.25-gentoo kernel patched with the compal-laptop module, which should not be a problem since I only use it for debugging purposes. There are two RF kill switches: a hard switch, which appears to do something, and a key. Both of them generate keyboard events when toggled.

With an unmodified install, this is the dmesg output:

```

iwl4965: Intel(R) Wireless WiFi Link 4965AGN driver for Linux, 1.2.26kd

iwl4965: Copyright(c) 2003-2008 Intel Corporation

ACPI: PCI Interrupt 0000:0a:00.0[A] -> GSI 16 (level, low) -> IRQ 16

PCI: Setting latency timer of device 0000:0a:00.0 to 64

iwl4965: Detected Intel Wireless WiFi Link 4965AGN

iwl4965: Tunable channels: 13 802.11bg, 19 802.11a channels

phy1: Selected rate control algorithm 'iwl-4965-rs'

input: 4965AGN as /class/input/input10

ACPI: PCI Interrupt 0000:0a:00.0[A] -> GSI 16 (level, low) -> IRQ 16

iwl4965: Radio disabled by HW RF Kill switch

```

However, while fiddling with the embedded memory controller, I found that setting bits 6 and 7 from byte 0xBB yielded a different result:

```

iwl4965: Intel(R) Wireless WiFi Link 4965AGN driver for Linux, 1.2.26kd

iwl4965: Copyright(c) 2003-2008 Intel Corporation

ACPI: PCI Interrupt 0000:0a:00.0[A] -> GSI 16 (level, low) -> IRQ 16

PCI: Setting latency timer of device 0000:0a:00.0 to 64

iwl4965: Detected Intel Wireless WiFi Link 4965AGN

iwl4965: Tunable channels: 13 802.11bg, 19 802.11a channels

phy5: Selected rate control algorithm 'iwl-4965-rs'

input: 4965AGN as /class/input/input14

ACPI: PCI Interrupt 0000:0a:00.0[A] -> GSI 16 (level, low) -> IRQ 16

wlan0: Initial auth_alg=0

wlan0: authenticate with AP d2:7d:a1:8a:ba:3a

wlan0: authenticate with AP d2:7d:a1:8a:ba:3a

wlan0: authenticate with AP d2:7d:a1:8a:ba:3a

wlan0: authentication with AP d2:7d:a1:8a:ba:3a timed out

iwl4965: Error sending REPLY_TX_PWR_TABLE_CMD: enqueue_hcmd failed: -5

iwl4965: Error sending REPLY_RXON: enqueue_hcmd failed: -5

iwl4965: Error setting new configuration (-5).

iwl4965: WARNING: Requesting MAC access during RFKILL wakes up NIC

```

It looks that the wifi card scans for access points but since the embedded memory is in a strange state, the card is finally killed. In some cases, even dchpcd is launched, but this seems to happen at random. What makes me think that the embedded memory is not correctly set is that when bits 6 and 7 are set, the rfkill bits listed in the DSDT (0..5) are completely ignored.

I also recall having seen debug messages similar to this topic, in some tracing step.

Can anybody suggest me what to try next? I may be missing something obvious, but I'm really stuck after two weeks trying to solve this.

----------

## marcv

Well, I managed to make it work after an intense afternoon. With memory address 0xBB set to 0xD1, disabling the rc script and manually entering the following commands, I could associate to an access point. In fact, I'm writing via wireless now!

```

iwconfig wlan0 txpower 15

ifconfig wlan0 up

iwlist wlan0 scanning

iwconfig wlan0 essid BLAH

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

dhcpcd wlan0

```

This is a reminder rather than a guide. I will trace which commands, patches and configs are actually needed and post more detailed information tomorrow. What to learn: a computer will not work unless you threaten smashing it.

----------

## marcv

This is a works-for-me guide on how to make wireless work in a Compal IFL91 laptop.

Using the 2.6.25-gentoo-r1 kernel, patch it with the compal-laptop module, version 0.2.5. Patch it again to enable raw embedded controller memory writing:

```

--- a/drivers/misc/compal-laptop.c   2008-04-17 17:42:38.000000000 +0200

+++ b/drivers/misc/compal-laptop.c   2008-05-01 20:50:42.000000000 +0200

@@ -197,6 +197,22 @@

    return sprintf(buf, "%i\n", result);

 }

 

+static ssize_t store_raw(struct device *dev,

+   struct device_attribute *attr, const char *buf, size_t count)

+{

+   int value;

+   u8 reg;

+

+   if (sscanf(buf, "%i", &value) != 1 ||

+      (value < 0 || value > 0xFF))

+      return -EINVAL;

+

+   reg=(u8)value;

+   ec_write(COMPAL_EC_COMMAND_WIRELESS, reg);

+

+   return count;

+}

+

 static ssize_t show_bluetooth(struct device *dev,

    struct device_attribute *attr, char *buf)

 {

@@ -270,7 +286,7 @@

 static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);

 static DEVICE_ATTR(bluetooth, 0644, show_bluetooth, store_bluetooth_state);

 static DEVICE_ATTR(wlan, 0644, show_wlan, store_wlan_state);

-static DEVICE_ATTR(raw, 0444, show_raw, NULL);

+static DEVICE_ATTR(raw, 0644, show_raw, store_raw);

 

 static struct attribute *compal_attributes[] = {

    &dev_attr_lcd_level.attr,

```

Make and install the new kernel image and load module compal-laptop. Now annotate the value of ec memory byte 0xBB in case things go bad. Then set bit 7 (where 209 is actually 128 + the output from cat):

```

cat /sys/devices/platform/compal-laptop/raw

echo 209 > /sys/devices/platform/compal-laptop/raw

```

The interface has to be brought up before scanning. A way to ensure this is adding a preup function to /etc/conf.d/net:

```

preup() {

   if [[ ${iface} == "wlan0" ]]; then

      ifconfig wlan0 up

   fi

   return 0

}

```

And this should make it. Reboot and hope nothing sets on fire. Please notice that this is an experimental procedure. Reports and/or a better way to do it would be appreciated.

----------

## gforum

is it possible that compal specific changes will be merged into the kernel, like there are toshiba fixes and the likes?

----------

## marcv

They are already in the -mm tree (2.6.25) and afaik there are plans for inclusion in the mainline kernel in the near future.

----------

