On Mon, 2007-06-25 at 16:09 +0200, dragoran wrote: > > > On 6/25/07, yelo_3 <yelo_3 yahoo it> wrote: > > ok, but this does not solve the problem of multiple > killswitches (will > > show up with multiple cards) because both will have > > /org/freedesktop/Hal/devices/ipw_wlan_switch as uid. > Yes the previous shell script didn't solve the problem... > sorry. This might mean that the UDI should contain the > interface name as you were saying > The C code misses the setrfkill section, and a !=null check > when you fopen the file. > > ok here is a new version. > it implements setrfkill too and uses g_strdup_printf instead of > sprintf. I don't think argc == 3 is valid for the setrfkill check, since the number of args will still be 2... I'd just put a check before the libhal_ctx_init() that does: if (argc != 2) { fprintf (stderr, "Usage: ipwWirelessCtl [getrfkill] [setrfkill [1|0]]\n"); return -1; } or something like that, and get rid of the argc checks for getrfkill and setrfkill. I think we should actually just reparent the device to be a child of Computer. I also think the script should just rfkill _everything_, and that it should return '1' if _any_ ipw radios are off. This script is really only a stopgap until the _real_ kernel rfkill interfaces are complete, and then most these problems go away. So instead of trying to overengineer the whole thing, I think it should work like this: a) .fdi file adds _one_ rfkill device if any ipw cards are found b) 'ipwWirelessCtl getrfkill' checks all ipw devices for rfkill status, and if one of them is killed, it returns 1 c) 'ipwWirelessCtl setrfkill 1' kills _all_ ipw devices, while 'ipwWirelessCtl 0' re-enables _all_ ipw devices Sound OK? That way we also don't have to figure out how to unique-ify the device name, which the future kernel patches will handle for us. I've attached an updated .fdi file for ipw devices that excludes Dells, and makes only _one_ killswitch device. Dan
Attachment:
10-ipw-rfkill-switch.fdi
Description: application/xml