Re: interaction with rfkill
Iain
Tue Aug 04 19:17:58 2009
Roy, sorry for taking so long to reply. Given this is my work laptop, 'real' work has been getting in the way of me doing useful
stuff like this :)
Roy Marples wrote:
OK, hooking into rfkill is the wrong thing todo.
However, if the switch is toggled, the kernel should emit netlink
messages to indicate this.
Can you see if this is the case? if-linux.c, lines 1-310 are of interest.
There's an rfkill netlink message that's visible on NETLINK_KOBJECT_UEVENT, nothing obvious from NETLINK_ROUTE from 'ip monitor
all'. However if I either use the rfkill event to run 'ip link set up dev wlan0' or type that manually then I will see
NETLINK_ROUTE messages for that.
With ip monitor all running I can remove the driver for the wired nic, see the netlink messages for that and have dhcpcd react
accordingly.
However, with the rfkill switch enabled if I remove and reload the iwl3945 module, while I still see the netlink messages from ip
monitor there's nothing from dhcpcd.
dhcpcd reacts to new interface link messages sent via the kernel.
So if ifconfig UP fails with ENODEV, then I would logically expect a
kernel announcement that the interface is available when the rfkill
switch is toggled to indicate the interface is now ready.
Sorry if this is a bit long, but hopefully there's enough information here to help.
Immediately after boot, have done nothing other than load the drivers at this point, dhcpcd is not running, wpa_supplicant is
running on wlan0. I have no dhcpcd.conf or /libexec/dhcpcd-run-hooks installed so there should be nothing happening behind my back
here. dhcpcd version is from git earlier this evening.
root@craptop:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
3: wmaster0: <> mtu 0 qdisc noop state DOWN qlen 1000
link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
root@craptop:~# ip link set up dev wlan0
RTNETLINK answers: No such device
root@craptop:~/dhcpcd/git/dhcpcd# ./dhcpcd -d -B
dhcpcd: version 5.0.99 starting
dhcpcd: eth0: executing `/libexec/dhcpcd-run-hooks', reason PREINIT
dhcpcd: /libexec/dhcpcd-run-hooks: No such file or directory
dhcpcd: eth0: executing `/libexec/dhcpcd-run-hooks', reason NOCARRIER
dhcpcd: /libexec/dhcpcd-run-hooks: No such file or directory
dhcpcd: eth0: waiting for carrier
press rfkill button - no reaction from dhcpcd, nothing from ip monitor
listening to NETLINK_KOBJECT_UEVENT shows
change@/devices/platform/hp-wmi/rfkill/rfkill1
ACTION=change
DEVPATH=/devices/platform/hp-wmi/rfkill/rfkill1
SUBSYSTEM=rfkill
RFKILL_NAME=hp-wifi
RFKILL_TYPE=wlan
RFKILL_STATE=1
SEQNUM=598
root@craptop:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
3: wmaster0: <> mtu 576 qdisc noop state DOWN qlen 1000
link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
root@craptop:~# ip link set up dev wlan0
again, no reaction from dhcpcd, NETLINK_KOBJECT_UEVENT shows
add@/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::radio
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::radio
SUBSYSTEM=leds
SEQNUM=622
add@/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::assoc
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::assoc
SUBSYSTEM=leds
SEQNUM=623
add@/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::RX
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::RX
SUBSYSTEM=leds
SEQNUM=624
add@/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::TX
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:10:00.0/leds/iwl-phy0::TX
SUBSYSTEM=leds
SEQNUM=625
ip monitor shows
5: wmaster0: <UP,LOWER_UP> mtu 576 qdisc pfifo_fast state UNKNOWN
link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DORMANT
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
0.0.0.0 dev lo lladdr 00:00:00:00:00:00 NOARP
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
link/ether
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
link/ether
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
link/ether
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
link/ether
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
link/ether
[wpa_supplicant is running here so this repeats as it tries to associate]
With rfkill enabled..
root@craptop:~# rmmod iwl3945
[from ip monitor all]
Deleted 4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
Deleted 3: wmaster0: <> mtu 576 qdisc noop state DOWN
link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
root@craptop:~# modprobe iwl3945
[from ip monitor all]
5: wmaster0: <> mtu 0 qdisc noop state DOWN
link/ieee802.11 00:1c:bf:a0:13:d7 brd 00:00:00:00:00:00
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 00:1c:bf:a0:13:d7 brd ff:ff:ff:ff:ff:ff
6: wlan0: <BROADCAST,MULTICAST>
link/ether
there's no reaction to either of the above actions from dhcpcd
root@craptop:~# rmmod tg3
[from ip monitor all]
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
Deleted 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
dhcpcd: eth0: removing interface
dhcpcd: eth0: executing `/libexec/dhcpcd-run-hooks', reason STOP
dhcpcd: /libexec/dhcpcd-run-hooks: No such file or directory
root@craptop:~# modprobe tg3
[from ip monitor all]
7: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
7: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state UNKNOWN
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
7: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN
link/ether 00:1c:c4:c9:2c:97 brd ff:ff:ff:ff:ff:ff
dhcpcd: eth0: executing `/libexec/dhcpcd-run-hooks', reason PREINIT
dhcpcd: /libexec/dhcpcd-run-hooks: No such file or directory
dhcpcd: eth0: executing `/libexec/dhcpcd-run-hooks', reason NOCARRIER
dhcpcd: /libexec/dhcpcd-run-hooks: No such file or directory
dhcpcd: eth0: waiting for carrier
Archive administrator: postmaster@marples.name