rt2500pci rfkill problem with rt2x00

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4281

Rikz

19-09-2007 12:03:17

My laptop with built-in wireless card
[code3hjqcnao]00:06.0 Network controller: RaLink RT2500 802.11g Cardbus/mini-PCI (rev 01)[/code3hjqcnao]
has got a hardware button to turn Wi-Fi radio on and off. It works under Windows XP.

Under Linux wireless card works too, I can connect to my AP and transfer data. However it works only when compiled without rfkill support. I use linux kernel 2.6.22-gentoo-r6 with the following options enabled
[code3hjqcnao]CONFIG_RFKILL=m
CONFIG_RFKILL_INPUT=m
CONFIG_INPUT_POLLDEV=m[/code3hjqcnao]
so I presume that everything needed for the rfkill functionality in kernel is turned on.

When rt2x00 driver is compiled with rfkill support, all that I can see when wpa_supplicant tries to connect to AP is
[code3hjqcnao]# wpa_supplicant -ira0 -Dwext -dd -c /etc/wpa_supplicant/wpa_supplicant.conf
Initializing interface 'ra0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface_group='wheel' (DEPRECATED)
eapol_version=1
Line: 11 - start of a new network block
key_mgmt: 0x4
Line: 15 - start of a new network block
ssid - hexdump_ascii(len=4):
52 69 6b 7a Rikz
key_mgmt: 0x2
PSK - hexdump(len=32): [REMOVED]
Line: 24 - start of a new network block
ssid - hexdump_ascii(len=8):
57 69 72 65 6c 65 73 73 Wireless
key_mgmt: 0x2
PSK (ASCII passphrase) - hexdump_ascii(len=12): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 0
id=0 ssid=''
id=1 ssid='Rikz'
id=2 ssid='Wireless'
Initializing interface (2) 'ra0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
capabilities: key_mgmt 0xf enc 0xf
WEXT: Operstate: linkmode=1, operstate=5
Own MAC address: 00:13:d3:84:c2:1d
wpa_driver_wext_set_wpa
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_countermeasures
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 4 value 0x0 - wpa_driver_wext_set_drop_unencrypted
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 5 value 0x1 - Setting scan request: 0 sec 100000 usec
Added interface ra0
RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
Wireless event: cmd=0x8b06 len=8
Ignore event for foreign ifindex 2
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'ra0' added
State: DISCONNECTED -> SCANNING
Starting AP scan (broadcast SSID)
Trying to get current scan results first without requesting a new scan to speed up initial association
Received 0 bytes of scan results (0 BSSes)
Scan results: 0
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 0 sec 0 usec
Starting AP scan (broadcast SSID)
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
Wireless event: cmd=0x8b19 len=8
ioctl[SIOCGIWSCAN]: Resource temporarily unavailable
Scan results: -1
Failed to get scan results
Failed to get scan results - try scanning again
Setting scan request: 1 sec 0 usec
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
Wireless event: cmd=0x8b19 len=8
Received 0 bytes of scan results (0 BSSes)
Scan results: 0
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 5 sec 0 usec
Starting AP scan (broadcast SSID)
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
Wireless event: cmd=0x8b19 len=8
Received 0 bytes of scan results (0 BSSes)
Scan results: 0
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 5 sec 0 usec
Starting AP scan (broadcast SSID)
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
Wireless event: cmd=0x8b19 len=8
Received 0 bytes of scan results (0 BSSes)
Scan results: 0
Selecting BSS from priority group 0
Try to find WPA-enabled AP
Try to find non-WPA AP
No suitable AP found.
Setting scan request: 5 sec 0 usec
CTRL-EVENT-TERMINATING - signal 2 received
Removing interface ra0
State: SCANNING -> DISCONNECTED
wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)
WEXT: Operstate: linkmode=-1, operstate=5
No keys have been configured - skip key clearing
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wpa_driver_wext_set_wpa
wpa_driver_wext_set_drop_unencrypted
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 5 value 0x0 - wpa_driver_wext_set_countermeasures
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 4 value 0x0 - No keys have been configured - skip key clearing
Cancelling scan request
Cancelling authentication timeout
WEXT: Operstate: linkmode=0, operstate=6
[/code3hjqcnao]

I thought that I should just turn hardware button on, but when I press it, nothing happens. dmesg doesn't report anything and there are no new messages in /var/log/messages

Another fact that I forgot to mention yet is that kernel panic occurs when I run 'rmmod rt2500pci' if rt2x00 driver is compiled with 'rfkill' support. If the driver is compiled without rfkill support, I can rmmod it successfully.

My config file for rt2x00
[code3hjqcnao]# Config file generated by portage
CONFIG_RT2X00=y
CONFIG_RT2X00_ASM=n
CONFIG_EEPROM_93CX6=y
CONFIG_EEPROM_93CX6_ASM=n
CONFIG_RT2400PCI=n
CONFIG_RT2400PCI_RFKILL=y
CONFIG_RT2500PCI=y
CONFIG_RT2500PCI_RFKILL=y
CONFIG_RT2500USB=n
CONFIG_RT2500USB_RFKILL=y
CONFIG_RT61PCI=n
CONFIG_RT61PCI_RFKILL=y
CONFIG_RT73USB=n
CONFIG_RT73USB_RFKILL=y
[/code3hjqcnao]

As I already said, I use rt2x00 driver from CVS with unpatches mac80211 stack from 2.6.22 kernel. To make rt2x00 compile on this kernel I execute
[code3hjqcnao]sed -i -e 's/ rt2x00dev->interface.id,//g' rt2x00mac.c
echo '#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10)' >> rt2x00.h
[/code3hjqcnao]

Are any information messages printed to syslog when rfkill switch is detected? Or when the button is pressed? I see no, but I don't know the right behavior.

IvD

19-09-2007 17:53:13

You seem to have DEBUG output disabled, please emerge rt2x00 with the "debug" useflag.
Also could you use sysrq to obtain a stacktrace of the crash when rmmoding rt2500pci?

Rikz

21-09-2007 17:32:10

Not much debug output even with 'debug' USE flag.
[code2f2nuvim]PCI: Enabling device 0000:00:06.0 (0010 -> 0012)
ACPI: PCI Interrupt 0000:00:06.0[A] -> GSI 18 (level, low) -> IRQ 18
phy0 -> rt2500pci_validate_eeprom: EEPROM recovery - NIC: 0xfff0
phy0 -> rt2500pci_validate_eeprom: EEPROM recovery - Calibrate offset: 0xff79
phy0 -> rt2x00_set_chip: Info - Chipset detected - rt: 0201, rf: 0003, rev: 00000004.
[/code2f2nuvim]

Did I miss some messages?

Right now I'm having troubles with kdump kernel as I've never made crashdumps before. Using the manual from /usr/src/linux/Documentation/kdump/kdump.txt I get
[code2f2nuvim]# kexec -p /usr/src/linux-2.6.23-rc7/arch/i386/boot/bzImage --elf32-core-headers
Could not find a free area of memory of 9000 bytes...
locate_hole failed[/code2f2nuvim]

I'll try to solve it as soon as possible, but maybe some screen shots can help you? They are ugly, but for now that is all that I can show.

Rikz

22-09-2007 08:40:59

Kernel panic happens only when rt2500pci driver is in use as I've noticed. I mean when /etc/init.d/net.ra0 service started and wpa_supplicant tries to make a connection.

I know that it is not a good idea to unload a module when some program uses it, but the kernel panic is not a good result of rmmod anyway.

However kernel panic when unloading module is not the worst problem for me. Actually I don't unload any drivers is they work well. I'd really like to make rt2500pci working with rfkill switch. Here is a part of lsmod
[code24cu192j]rc80211_simple 4480 1
rt2500pci 14464 0
rt2x00pci 5248 1 rt2500pci
rt2x00lib 10816 2 rt2500pci,rt2x00pci
rfkill 5008 2 rt2x00lib
input_polldev 3144 1 rt2x00lib
mac80211 138632 4 rc80211_simple,rt2500pci,rt2x00pci,rt2x00lib
cfg80211 4360 1 mac80211
eeprom_93cx6 1728 1 rt2500pci
[/code24cu192j]

Rikz

13-10-2007 18:37:37

Now I use rt2500pci module from 2.6.23-git3. I can associate with AP and so on, but rfkill still doesn't work. No matter if the hardware switch is on or off, Wi-Fi radio is always on and I can transfer data in both cases.

Here's a part of my dmesg

[code36dzx0dz]phy0 -> rt2500pci_validate_eeprom: EEPROM recovery - NIC: 0xfff0
phy0 -> rt2500pci_validate_eeprom: EEPROM recovery - Calibrate offset: 0xff79
phy0 -> rt2x00_set_chip: Info - Chipset detected - rt: 0201, rf: 0003, rev: 00000004.
Marking TSC unstable due to: possible TSC halt in C2.
Time: acpi_pm clocksource has been installed.
snd_via82xx: Unknown symbol snd_mpu401_uart_interrupt
snd_via82xx: Unknown symbol snd_mpu401_uart_new
phy0: Selected rate control algorithm 'simple'
ACPI: PCI Interrupt 0000:00:10.4[C] -> Link [ALKD] -> GSI 21 (level, low) -> IRQ 19
ehci_hcd 0000:00:10.4: EHCI Host Controller
ehci_hcd 0000:00:10.4: new USB bus registered, assigned bus number 3
ehci_hcd 0000:00:10.4: irq 19, io mem 0xd0002000
ehci_hcd 0000:00:10.4: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 4 ports detected
Yenta: CardBus bridge found at 0000:00:0c.0 [1524:1410]
Yenta: Using CSCINT to route CSC interrupts to PCI
Yenta: Routing CardBus interrupts to PCI
Yenta TI: socket 0000:00:0c.0, mfunc 0x01021002, devctl 0x44
Yenta: ISA IRQ mask 0x08f0, PCI irq 16
Socket status: 30000006
ACPI: PCI Interrupt Link [ALKC] disabled and referenced, BIOS bug
ACPI: PCI Interrupt Link [ALKC] BIOS reported IRQ 0, using IRQ 22
ACPI: PCI Interrupt Link [ALKC] enabled at IRQ 22
ACPI: PCI Interrupt 0000:00:11.6[C] -> Link [ALKC] -> GSI 22 (level, low) -> IRQ 21
PCI: Setting latency timer of device 0000:00:11.6 to 64
EXT3 FS on sda7, internal journal
kjournald starting. Commit interval 20 seconds
EXT3 FS on sda8, internal journal
EXT3-fs: mounted filesystem with writeback data mode.
fuse init (API version 7.8)
Adding 1004020k swap on /dev/sda6. Priority:-1 extents:1 across:1004020k
ACPI: PCI interrupt for device 0000:00:06.0 disabled
ACPI: PCI Interrupt 0000:00:06.0[A] -> GSI 18 (level, low) -> IRQ 20
phy1 -> rt2500pci_validate_eeprom: EEPROM recovery - NIC: 0xfff0
phy1 -> rt2500pci_validate_eeprom: EEPROM recovery - Calibrate offset: 0xff79
phy1 -> rt2x00_set_chip: Info - Chipset detected - rt: 0201, rf: 0003, rev: 00000004.
phy1: Selected rate control algorithm 'simple'
udev: renamed network interface wlan0 to ra0
input: Unspecified device as /devices/virtual/input/input6
phy1 -> rt2500pci_init_bbp: Debug - Start initialization from EEPROM...
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x0f, value: 0x30.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x11, value: 0x32.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x15, value: 0x0d.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x16, value: 0x0d.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x35, value: 0x10.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x36, value: 0x10.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x3d, value: 0x6a.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x3e, value: 0x10.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x23, value: 0x50.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x29, value: 0x60.
phy1 -> rt2500pci_init_bbp: Debug - BBP: 0x36, value: 0x18.
phy1 -> rt2500pci_init_bbp: Debug - ...End initialization from EEPROM.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 0 - CWmin: 4, CWmax: 10, Aifs: 2.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 1 - CWmin: 4, CWmax: 10, Aifs: 2.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 7 - CWmin: 5, CWmax: 10, Aifs: 2.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 0 - CWmin: 5, CWmax: 10, Aifs: 2.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 1 - CWmin: 5, CWmax: 10, Aifs: 2.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX ring 7 - CWmin: 6, CWmax: 10, Aifs: 2.
ra0: Initial auth_alg=0
ra0: authenticate with AP 00:19:5b:2d:54:69
ra0: RX authentication from 00:19:5b:2d:54:69 (alg=0 transaction=2 status=0)
ra0: authenticated
ra0: associate with AP 00:19:5b:2d:54:69
ra0: RX AssocResp from 00:19:5b:2d:54:69 (capab=0x31 status=0 aid=1)
ra0: associated
ra0: switched to short barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection enabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to long barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection disabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to short barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection enabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to long barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection disabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to short barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection enabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to long barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection disabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to short barker preamble (BSSID=00:19:5b:2d:54:69)
ra0: CTS protection enabled (BSSID=00:19:5b:2d:54:69)
ra0: switched to long barker preamble (BSSID=00:19:5b:2d:54:69)
[/code36dzx0dz]

IvD

13-10-2007 22:38:54

Did you enable CONFIG_RFKILL_INPUT or only CONFIG_RFKILL in your kernel?
If you only have CONFIG_RFKILL enabled, then the behavior is correct since that means a userspace tool must listed to the input devices and act accordingly. At the moment work is in progress to make hald support rfkill.
But you could also create your own script that listens to event, or at least check what the rfkill sysfs entries are telling.

You will not need userspace support when you enable CONFIG_RFKILL_INPUT since then everything will be handled inside the kernel. You could still check the sysfs entries to see if the status is being toggled or not.

Rikz

14-10-2007 15:20:50

I have both of this options enabled as modules (=m)
[code3lg7zfh6]# cat /usr/src/linux-2.6.23-git3/.config|grep RFKILL
CONFIG_RFKILL=m
CONFIG_RFKILL_INPUT=m
CONFIG_RT2X00_LIB_RFKILL=y
CONFIG_RT2500PCI_RFKILL=y
[/code3lg7zfh6]

I've noticed that rfkill-input module is not loaded by default. I loaded it with 'modprobe rfkill-input' but nothing changed. Here's full lsmod from 2.6.23-git3

[code3lg7zfh6]Module Size Used by
aes_generic 26944 0
aes_i586 32768 1
rt2500pci 18880 0
rfkill_input 3264 0
snd_pcm_oss 36320 0
snd_mixer_oss 14144 1 snd_pcm_oss
snd_seq_oss 28992 0
snd_seq_midi_event 6144 1 snd_seq_oss
snd_seq 45840 4 snd_seq_oss,snd_seq_midi_event
fuse 39572 2
speedstep_centrino 4936 0
freq_table 3396 1 speedstep_centrino
arc4 1664 2
ecb 2560 2
blkcipher 5636 1 ecb
cryptomgr 2752 0
rc80211_simple 3328 1
rt2x00pci 7104 1 rt2500pci
snd_via82xx_modem 10760 0
rt2x00lib 17344 2 rt2500pci,rt2x00pci
rfkill 5264 3 rfkill_input,rt2x00lib
ehci_hcd 29644 0
snd_via82xx 21780 0
uhci_hcd 22476 0
fan 3652 0
input_polldev 3144 1 rt2x00lib
snd_ac97_codec 94692 2 snd_via82xx_modem,snd_via82xx
battery 9928 0
usbcore 125164 3 ehci_hcd,uhci_hcd
ac 3844 0
mac80211 110476 4 rt2500pci,rc80211_simple,rt2x00pci,rt2x00lib
ac97_bus 1664 1 snd_ac97_codec
cfg80211 10504 1 mac80211
snd_pcm 63560 4 snd_pcm_oss,snd_via82xx_modem,snd_via82xx,snd_ac97_codec
thermal 14492 0
processor 26864 1 thermal
snd_timer 19268 2 snd_seq,snd_pcm
via_rhine 20808 0
snd_page_alloc 7496 3 snd_via82xx_modem,snd_via82xx,snd_pcm
yenta_socket 22668 0
rsrc_nonstatic 9024 1 yenta_socket
pcmcia_core 32464 2 yenta_socket,rsrc_nonstatic
evdev 7616 4
via_agp 7872 1
button 6032 0
snd_mpu401_uart 6528 1 snd_via82xx
snd_rawmidi 19232 1 snd_mpu401_uart
snd_seq_device 6284 3 snd_seq_oss,snd_seq,snd_rawmidi
snd 43684 12 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_via82xx_modem,snd_via82xx,snd_ac97_codec,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device
eeprom_93cx6 1728 1 rt2500pci
soundcore 6048 1 snd
mii 4416 1 via_rhine
agpgart 26480 1 via_agp[/code3lg7zfh6]

IvD

14-10-2007 15:41:05

But what do the rfkill sysfs entries indicate?
Does the state correctly change in there?
Does the rfkill input device report anything when the key is pressed?

Rikz

14-10-2007 17:06:58

But what do the rfkill sysfs entries indicate?
Does the state correctly change in there?
Does the rfkill input device report anything when the key is pressed?[/quote2liqxtr3]

One rfkill device is found
[code2liqxtr3]# find /sys -name "rfkill"
/sys/devices/pci0000:00/0000:00:06.0/rfkill
/sys/class/rfkill
/sys/module/rfkill
[/code2liqxtr3]

[code2liqxtr3]laptop rfkill0 # ls
claim device name power state subsystem type uevent
laptop rfkill0 # pwd
/sys/devices/pci0000:00/0000:00:06.0/rfkill/rfkill0
laptop rfkill0 # cat state
1
laptop rfkill0 # cat state
1
laptop rfkill0 # cat state
1
laptop rfkill0 # cat claim
0laptop rfkill0 # cat name
rt2500pci
laptop rfkill0 # cat type
wlan
laptop rfkill0 # cat uevent
[/code2liqxtr3]
I switched the rfkill button between three 'cat state' commands. Dmesg doesn't report anything about rfkill when the button is pressed.

IvD

14-10-2007 17:16:22

Did you wait 1 second or longer between each button press?

Could you apply the attached patch, make sure debug output has been enabled for rt2x00 and try again?
This patch will add an additional debug statement that is printed whenever the hardware is polled. I am curios if either the polling is failing or the register reading is failing.

Also as a second check could you enable DEBUGFS go to the rt2x00 debugfs entries and do

echo 72 > csr_offset
cat csr_value

-> Press button

cat csr_value

If correct, the csr_value file will contain 2 differrent values.

Rikz

14-10-2007 17:42:46

I've waited for several seconds after pressing the button - state doesn't change. Even with your patch, there's no additional output in dmesg when I press the button.

However the second check gave some results
[code2dgbcfi3]laptop rt2500pci # echo 72 > csr_offset
laptop rt2500pci # cat csr_value
0x00000001
laptop rt2500pci # cat csr_value
0x00000000
[/code2dgbcfi3]

I switched the rfkill button between two cat's, as you said.

IvD

14-10-2007 17:49:42

Ok this means that the register correctly detects the button presses, but for some reason the polling is not being kicked in.
What is the contents of the debugfs file dev_flags?

Rikz

14-10-2007 17:51:31

[code2d2nk3en]# cat dev_flags
0x0000032f
[/code2d2nk3en]

btw, I forgot to mention - with 2.6.23-git3 I have no problem with unloading rt2500pci module anymore. Thanks for the work on including rt2x00 driver to vanilla kernel!

IvD

14-10-2007 17:51:35

Also usefull try

echo 16 > eeprom_offset
cat eeprom_value

Rikz

14-10-2007 17:52:11

[code2cnalfi7]laptop rt2500pci # echo 16 > eeprom_offset
laptop rt2500pci # cat eeprom_value
0x1c16
[/code2cnalfi7]

IvD

14-10-2007 18:13:39

Ok, that all looks good. The eeprom indicates that the HW button is present, and the flags also indicate that this is the case.

I found the problem, apparently input-polldev doesn't create an input device, and because rt2x00 doesn't allocate one either it doesn't start the polling.
I'll have a patch for this within a few minutes.

IvD

14-10-2007 18:30:33

Fix committed to CVS & Git

Rikz

14-10-2007 19:37:41

With this patch http//git.kernel.org/?p=linux/kernel/g ... 8c79419f5b

I can see that rfkill state now changes successfully
[code1gmjw2ii]laptop rfkill2 # cat state
0
laptop rfkill2 # cat state
1
[/code1gmjw2ii]

But I get another strage things
1) when I 'modprobe rt2500pci' with rfkill switched off (cat state says '0') I can associate with AP. Then, when I turn rfkill button on, nothing changes. Then again when I turn it off - the signal goes down to zero and I cannot transfer data anymore. IMHO this behavior is not completely correct.

2) I'm not sure that 'iwconfig' utility shows the status of my card correctly.

[code1gmjw2ii]laptop ~ # iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

ra0 IEEE 802.11b ESSID:"Rikz"
Mode:Managed Frequency:2.437 GHz Access Point: 00:19:5B:2D:54:69
Bit Rate=1 Mb/s Tx-Power=27 dBm
Retry min limit:7 RTS thr:off Fragment thr=2346 B
Encryption key:18EA-5FCA-78DB-5407-1154-D517-91DB-B3E8-08E1-AC11-F22B-9842-8B79-555D-5BFC-1AA1 [3]
Link Quality=74/100 Signal level=-32 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

laptop ~ # iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

ra0 IEEE 802.11g ESSID:"Rikz"
Mode:Managed Frequency:2.427 GHz Access Point: 00:19:5B:2D:54:69
Tx-Power=27 dBm
Retry min limit:7 RTS thr:off Fragment thr=2346 B
Encryption key:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0[/code1gmjw2ii]

Here are two outputs from running 'iwconfig' when button is switched on, and when the radio is off. I wonder if iwconfig should display such information instead of just saying that ra0 radio is off and Tx-Power off.

IvD

14-10-2007 21:04:13

I have committed a fix to resolve that initial state problem you reported.

About iwconfig, I think the current approach is correct, iwconfig also reports all information when the interface is down. So it is safe to assume it should report the same information when the radio is down.
However the tx-power should indeed be set to "off" I think, but rt2x00 cannot report the radio state to mac80211 so it is a bit tricky on how that should be achieved...

Rikz

14-10-2007 21:20:24

Thank you very much for the fix!

I have another question about rt2x00 driver, but it is not related to rfkill (I hope) and I'll make another topic for it.