[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Halevt-dev] Wifi killswitch events
From: |
Ben Rich |
Subject: |
[Halevt-dev] Wifi killswitch events |
Date: |
Tue, 26 Jan 2010 09:56:11 -0500 |
Hi,
My laptop (ThinkPad t400s) has a physical kill switch for the wifi. I
would like to execute code to connect/disconnect from wireless
networks when the switch is turned on or off. Is halevt an
appropriate tool for doing this? Specifically, I noticed that there
is a device with capability 'killswitch':
$ hal-device /org/freedesktop/Hal/devices/pci_8086_84_rfkill_phy1_wlan
udi = '/org/freedesktop/Hal/devices/pci_8086_84_rfkill_phy1_wlan'
info.vendor = 'Intel Corporation' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'rfkill' (string)
info.interfaces = { 'org.freedesktop.Hal.Device.KillSwitch' } (string list)
killswitch.type = 'wlan' (string)
killswitch.state = 1 (0x1) (int)
killswitch.access_method = 'rfkill' (string)
killswitch.name = 'phy1' (string)
info.subsystem = 'rfkill' (string)
info.product = 'phy1 wlan Killswitch' (string)
linux.sysfs_path =
'/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy1/rfkill1'
(string)
info.parent = '/org/freedesktop/Hal/devices/pci_8086_84' (string)
info.udi = '/org/freedesktop/Hal/devices/pci_8086_84_rfkill_phy1_wlan'
(string)
info.addons.singleton = { 'hald-addon-rfkill-killswitch' } (string list)
info.category = 'killswitch' (string)
info.capabilities = { 'killswitch' } (string list)
When the wifi is on, the killswitch.state property is set to 1, and
when it is off it is set to 2. So, I created the following
configuration file:
$ cat /etc/halevt/wifi_rfkill.xml
<?xml version="1.0" encoding="UTF-8"?>
<halevt:Configuration version="0.1"
xmlns:halevt="http://www.environnement.ens.fr/perso/dumas/halevt.html">
<halevt:Device match="hal.killswitch.type = wlan">
<halevt:Property name="hal.killswitch.state">
<halevt:Action value="1" exec="/etc/rc.d/net-profiles restart"/>
</halevt:Property>
</halevt:Device>
<halevt:Device match="hal.killswitch.type = wlan">
<halevt:Property name="hal.killswitch.state">
<halevt:Action value="2" exec="/etc/rc.d/net-profiles stop"/>
</halevt:Property>
</halevt:Device>
</halevt:Configuration>
At the moment this is not working. Maybe someone can tell me if I at
least have the right idea. The other thing I would like to know is
how to debug such a script. Does halevt log its actions? Many thanks
for your help.
Sincerely,
Ben Rich
- [Halevt-dev] Wifi killswitch events,
Ben Rich <=