Bug 13898 - Intel 3945ABG - problems on 2.6.30.X
Summary: Intel 3945ABG - problems on 2.6.30.X
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks: 13070
  Show dependency tree
 
Reported: 2009-08-02 21:17 UTC by Rafael J. Wysocki
Modified: 2009-09-17 22:14 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30.y
Tree: Mainline
Regression: Yes


Attachments

Description Rafael J. Wysocki 2009-08-02 21:17:19 UTC
Subject    : Intel 3945ABG - problems on 2.6.30.X
Submitter  : dienet <dienet@poczta.fm>
Date       : 2009-07-31 15:17
References : http://marc.info/?l=linux-kernel&m=124905346729959&w=4

This entry is being used for tracking a regression from 2.6.29.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Reinette Chatre 2009-08-03 21:58:21 UTC
You are disabling wireless by writing a value to a file named bluetooth - this really does not sound like something that can be relied on to always work. What are you trying to do? What platform is this?
Comment 2 dienet 2009-08-06 11:46:39 UTC
echo disable > /proc/acpi/ibm/bluetooth

This line does not change anything. I just put it there to disable bluetooth and WiFi with one key.

When seting wifi off I get:

Aug  6 13:40:24 t61 logger: Wifi off
Aug  6 13:40:24 t61 logger: /etc/rc.d/rc.inet1:  /sbin/route del default
Aug  6 13:40:24 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig eth0 down
Aug  6 13:40:24 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig wlan0 down
Aug  6 13:40:24 t61 kernel: wlan0: deauthenticating by local choice (reason=3)
Aug  6 13:40:24 t61 kernel: iwl3945: MAC is in deep sleep!
Aug  6 13:40:24 t61 last message repeated 2 times
Aug  6 13:40:24 t61 kernel: iwl3945 0000:03:00.0: PCI INT A disabled
Aug  6 13:40:24 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig lo down

This line: Aug  6 13:40:24 t61 kernel: iwl3945 0000:03:00.0: PCI INT A disabled is really OK right? So I don't need to do some echo XX > XXX in /sys. On 2.6.30 this line do not appear.
Comment 3 dienet 2009-08-06 11:55:37 UTC
On 2.6.30 to get this pci disable msg I you this script:

#!/bin/bash

state=`cat /sys/bus/pci/drivers/iwl3945/0000:03:00.0/enable`

echo $state

if [ "$state" == "1" ]; then
        logger "Wifi off"

        if [ -x /etc/rc.d/rc.inet1 ]; then
                . /etc/rc.d/rc.inet1 stop
        fi

        echo disable > /proc/acpi/ibm/bluetooth

        echo 0 > /sys/bus/pci/drivers/iwl3945/0000:03:00.0/enable

        /usr/bin/osd.sh "Wifi: [Off]"
else
        logger "Wifi on"

        echo 1 > /sys/bus/pci/drivers/iwl3945/0000:03:00.0/enable

        if [ -x /etc/rc.d/rc.inet1 ]; then
                . /etc/rc.d/rc.inet1 start
        fi

        if [ -x /etc/rc.d/rc.inet1 ]; then
                . /etc/rc.d/rc.inet1 eth0_stop
        fi

        echo disable > /proc/acpi/ibm/bluetooth

        /usr/bin/osd.sh "Wifi: [On]"
fi

And I get this:

Aug  6 13:49:55 t61 logger: Wifi off
Aug  6 13:49:55 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig eth0 down
Aug  6 13:49:55 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig wlan0 down
Aug  6 13:49:55 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig lo down
Aug  6 13:49:55 t61 kernel: iwl3945 0000:03:00.0: PCI INT A disabled
Aug  6 13:50:03 t61 logger: ACPI group ibm / action hotkey HKEY 00000080 00001005 is not defined
Aug  6 13:50:03 t61 logger: Wifi on
Aug  6 13:50:03 t61 kernel: iwl3945 0000:03:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
Aug  6 13:50:03 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig lo 127.0.0.1
Aug  6 13:50:03 t61 logger: /etc/rc.d/rc.inet1:  /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
Aug  6 13:50:05 t61 kernel: iwl3945 0000:03:00.0: Wait for START_ALIVE timeout after 2000ms.
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 mode Ad-Hoc
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 nick t61
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 channel 10
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 key ************
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 key restricted
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 rate 54M
Aug  6 13:50:08 t61 logger: /etc/acpi/wifi:  /sbin/iwconfig wlan0 essid "moj"
Aug  6 13:50:08 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig wlan0 192.168.1.6 broadcast 192.168.1.255 netmask 255.255.255.0
Aug  6 13:50:10 t61 kernel: iwl3945 0000:03:00.0: Wait for START_ALIVE timeout after 2000ms.
Aug  6 13:50:10 t61 logger: /etc/rc.d/rc.inet1:  /sbin/route add default gw 192.168.1.1 metric 1
Aug  6 13:50:10 t61 logger: SIOCADDRT: No such process
Aug  6 13:50:11 t61 logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig eth0 down

And after this wifi do not work :/
Comment 4 Reinette Chatre 2009-08-17 18:51:16 UTC
Sorry, but I still do not understand what you are trying to do here. Please read Documentation/filesystems/sysfs-pci.txt - it mentions that writing 0 to "enable" does not guarantee that all initialization is reversed. Please explain what you are trying to do then we can find a way to do it using the standard interfaces. Writing to the low level pci interface should not be necessary.

Also, as previously asked, what platform is this?
Comment 5 dienet 2009-08-17 19:52:45 UTC
I'm trying to turn off wifi, to save some watts. I have kill switch, but why no do the same with Fn-keys?

This is Bluewhite64 (x86_64)
Comment 6 Reinette Chatre 2009-08-17 20:20:21 UTC
(In reply to comment #5)
> I'm trying to turn off wifi, to save some watts. I have kill switch, but why
> no
> do the same with Fn-keys?

Why can't you use the kill switch or Fn-keys to turn off wifi?


> This is Bluewhite64 (x86_64)

What platform is this? Could you please provide laptop vendor name and model number?
Comment 7 dienet 2009-08-18 14:44:28 UTC
(In reply to comment #6)
 the same with Fn-keys?

> Why can't you use the kill switch or Fn-keys to turn off wifi?

I can use kill switch (this is supported by the kernel), but this is not so convenient as Fn-keys.

Fn-keys works as acpi events. Without a propper acpi script turning wifi off with this keys do not work.

> What platform is this? Could you please provide laptop vendor name and model
> number?

This is ThinkPad T61, Lenovo.
Comment 8 Reinette Chatre 2009-08-18 16:25:43 UTC
(In reply to comment #7)
>  
> I can use kill switch (this is supported by the kernel), but this is not so
> convenient as Fn-keys.
> 
> Fn-keys works as acpi events. Without a propper acpi script turning wifi off
> with this keys do not work.

The Fn-keys (Fn+F5 in this case) can indeed be made to turn wifi off. See recent discussion on linux-wireless mailing list ([1]). It seems that you will get desired behavior if you map that key to "238  # KEY_WLAN".

> 
> > What platform is this? Could you please provide laptop vendor name and
> model
> > number?
> 
> This is ThinkPad T61, Lenovo.

This is exactly the same laptop model that was discussed.

[1] http://thread.gmane.org/gmane.linux.kernel/869500
Comment 9 dienet 2009-09-14 17:52:28 UTC
I have:
/dev/input/event5
   bustype : BUS_HOST
   vendor  : 0x17aa
   product : 0x5054
   version : 16641
   name    : "ThinkPad Extra Buttons"
   phys    : "thinkpad_acpi/input0"
   bits ev : EV_SYN EV_KEY EV_MSC (null)

map: 32 keys, size: 31/64
0x0000 = 466  # ???
0x0001 = 152  # KEY_COFFEE
0x0002 = 236  # ???
0x0003 = 142  # KEY_SLEEP
0x0004 = 238  # ???
0x0005 = 471  # ???
0x0006 = 227  # ???
...

And I don't know how to map this key to KEY_WLAN.
Right now I'm on 2.6.31 and I can switch wifi off/on, but I think this switching with Fn key does not trun it really off - it still consumes watts.
Comment 10 Reinette Chatre 2009-09-14 18:59:05 UTC
(In reply to comment #9)
> I have:
> /dev/input/event5
>    bustype : BUS_HOST
>    vendor  : 0x17aa
>    product : 0x5054
>    version : 16641
>    name    : "ThinkPad Extra Buttons"
>    phys    : "thinkpad_acpi/input0"
>    bits ev : EV_SYN EV_KEY EV_MSC (null)
> 
> map: 32 keys, size: 31/64
> 0x0000 = 466  # ???
> 0x0001 = 152  # KEY_COFFEE
> 0x0002 = 236  # ???
> 0x0003 = 142  # KEY_SLEEP
> 0x0004 = 238  # ???
> 0x0005 = 471  # ???
> 0x0006 = 227  # ???
> ...
> 
> And I don't know how to map this key to KEY_WLAN.

There are two ways to do this:
1) Use input-kbd to change the key mappings.The map file you can provide to it is in same format as the one it prints for you.
2) Use HAL. In that thread I pointed out to you is an example, see http://thread.gmane.org/gmane.linux.kernel/869500/focus=877379

> Right now I'm on 2.6.31 and I can switch wifi off/on, but I think this
> switching with Fn key does not trun it really off - it still consumes watts.

It does not seem to be mapped to any key.
Comment 11 dienet 2009-09-14 19:47:15 UTC
0x0004 = 385  # KEY_RADIO

The same dmesg output - no output.

In /usr/include/linux/input.h I found all keys.
There is 236 ; KEY_WLAN, why input-kbd gives ??? ?
How KEY_RADIO or KEY_WLAN are connected to Wifi?
Why changing key map should poweroff wifi?
Is there a way to poweroff/poweron wifi via /sys or /proc? Now I think it's easy to write some simple script then changing key maps.
Comment 12 Reinette Chatre 2009-09-14 22:06:43 UTC
From what I understand if you have KEY_RADIO mapped then it will affect only the state of bluetooth, not wifi. If you want to toggle wifi then you need to use KEY_WIFI.

To get a clear idea what happens when you toggle the rfkill keys you should run rfkill from http://git.sipsolutions.net/rfkill.git - when you run "rfkill event" it will show you what the rfkill system sees.
Comment 13 dienet 2009-09-15 09:01:48 UTC
rfkill is workin good. Values in /sys/class/rfkill are changing.
Right now when I toggle wifi off I can save about 1W. Not bad.
Any way I see that 2.6.31 is more power saving then 2.6.29.
Comment 14 Reinette Chatre 2009-09-15 16:02:35 UTC
(In reply to comment #13)
> rfkill is workin good. Values in /sys/class/rfkill are changing.
> Right now when I toggle wifi off I can save about 1W. Not bad.
> Any way I see that 2.6.31 is more power saving then 2.6.29.

this is great news. could you please close this bug?
Comment 15 Rafael J. Wysocki 2009-09-17 22:14:31 UTC
Closing.

Note You need to log in before you can comment on or make changes to this bug.