Re: how to have rfkill supported by hal?



On Fri, 2007-06-22 at 18:34 +0000, yelo_3 wrote:
> >HAL should be fixed to work with ACPI-based laptops.  For now, I'd
> >suggest a small daemon that monitors ACPI events (or, have acpid callout
> >scripts write the status to a file somewhere), and then add a section to
> >the HAL rfkill script to read that file for rfkill status.
> >
> >Dan
> 
> I have acpid installed. 
> I have a script that manually changes /sys/class/net/eth1/device/rf_kill
> what else should I add to the script, to talk to hal rfkill?

I whipped something together in about 30 minutes for ipw2200 and ipw2100
users.  You don't need to add anything to that acpi-triggered script;
you need to do the following using the attachments I've provided
(locations assume Fedora):

cp 10-ipw-rfkill-switch.fdi /usr/share/hal/fdi/information/10freedesktop/
cp hal-system-ipw /usr/libexec/hal-system-ipw
chmod 755 /usr/libexec/hal-system-ipw
cd /usr/lib/hal/scripts/linux
patch -p0 < /path/to/hal-system-killswitch-get-power-linux.diff

Restart HAL, and you're good to go.

davidz/bastien: comments?  the shellscript could possibly be better of
course.

Dan

Attachment: 10-ipw-rfkill-switch.fdi
Description: application/xml

Attachment: hal-system-ipw
Description: application/shellscript

--- hal-system-killswitch-get-power-linux.ORIG	2007-06-22 22:33:24.000000000 -0400
+++ hal-system-killswitch-get-power-linux	2007-06-22 23:13:39.000000000 -0400
@@ -47,6 +47,17 @@
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $value" >&2
 	fi
+    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
+	hal-system-ipw getrfkill
+	value=$?
+	if [ "$value" = "0" ]; then
+	    exit 1
+	elif [ "$value" = "1" ]; then
+	    exit 0
+	else
+	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    echo "hal-system-ipw returned $value" >&2
+	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	echo "Access type not supported" >&2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]