* Setting rfkill from user space @ 2009-07-17 20:58 Tim Gardner 2009-07-18 9:57 ` Johannes Berg 0 siblings, 1 reply; 3+ messages in thread From: Tim Gardner @ 2009-07-17 20:58 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org Johannes, Because the rfkill sysfs info moved around, I've been working on a program for the Debian acpi-support package that can be used to perform 2 operations; 1) discover if there are any wireless devices powered on, and 2) toggle the states of all wireless devices (at the same time). git://kernel.ubuntu.com/rtg/rfkill I'm a bit confused about what idx is in the event structure. Other then ascending (though not monotonically), idx appears to have no real value to user space. I see in the rfkill driver where its being assigned, and it appears to be an rfkill instance number that describes a relationship to a device. For example: Here is the output before toggling and right after a boot: rtg@xps1330:~$ ./rfkill bluetooth 0 UNBLOCKED soft:0 hard:0 wlan 1 UNBLOCKED soft:0 hard:0 bluetooth 2 UNBLOCKED soft:0 hard:0 wlan 3 UNBLOCKED soft:0 hard:0 UNBLOCKED After toggling to BLOCKED: rtg@xps1330:~$ sudo ./rfkill 1 [sudo] password for rtg: rtg@xps1330:~$ ./rfkill wlan 1 SOFT_BLOCKED soft:1 hard:0 bluetooth 2 SOFT_BLOCKED soft:1 hard:0 wlan 3 HARD_BLOCKED soft:1 hard:1 BLOCKED After toggling to UNBLOCKED: rtg@xps1330:~$ sudo ./rfkill 0 rtg@xps1330:~$ ./rfkill wlan 1 HARD_BLOCKED soft:0 hard:1 bluetooth 2 HARD_BLOCKED soft:0 hard:1 wlan 3 UNBLOCKED soft:0 hard:0 bluetooth 4 UNBLOCKED soft:0 hard:0 UNBLOCKED This laptop only has one wlan and one bluetooth device. Why the extra index values? rtg -- Tim Gardner tim.gardner@canonical.com ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Setting rfkill from user space 2009-07-17 20:58 Setting rfkill from user space Tim Gardner @ 2009-07-18 9:57 ` Johannes Berg 2009-07-18 10:11 ` Marcel Holtmann 0 siblings, 1 reply; 3+ messages in thread From: Johannes Berg @ 2009-07-18 9:57 UTC (permalink / raw) To: tim.gardner; +Cc: linux-wireless@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 2713 bytes --] On Fri, 2009-07-17 at 14:58 -0600, Tim Gardner wrote: > Johannes, > > Because the rfkill sysfs info moved around, I've been working on a > program for the Debian acpi-support package that can be used to perform > 2 operations; 1) discover if there are any wireless devices powered on, > and 2) toggle the states of all wireless devices (at the same time). > > git://kernel.ubuntu.com/rtg/rfkill Oh, I'm sorry, we already had http://git.sipsolutions.net/rfkill.git/, I really should have publicised that more (and wasn't around when you asked the question yesterday). > I'm a bit confused about what idx is in the event structure. Other then > ascending (though not monotonically), idx appears to have no real value > to user space. I see in the rfkill driver where its being assigned, and > it appears to be an rfkill instance number that describes a relationship > to a device. For example: Well, the index is just a unique identifier for each rfkill instance, like the network interface index for instance. Yes, it doesn't really have any value, but if you hot-plug rfkill instances (e.g. with a USB wireless device) then you may want to know it's now a new instance. > Here is the output before toggling and right after a boot: > > rtg@xps1330:~$ ./rfkill > bluetooth 0 UNBLOCKED soft:0 hard:0 > wlan 1 UNBLOCKED soft:0 hard:0 > bluetooth 2 UNBLOCKED soft:0 hard:0 > wlan 3 UNBLOCKED soft:0 hard:0 > UNBLOCKED > > After toggling to BLOCKED: > > rtg@xps1330:~$ sudo ./rfkill 1 > [sudo] password for rtg: > rtg@xps1330:~$ ./rfkill > wlan 1 SOFT_BLOCKED soft:1 hard:0 > bluetooth 2 SOFT_BLOCKED soft:1 hard:0 > wlan 3 HARD_BLOCKED soft:1 hard:1 > BLOCKED > > After toggling to UNBLOCKED: > > rtg@xps1330:~$ sudo ./rfkill 0 > rtg@xps1330:~$ ./rfkill > wlan 1 HARD_BLOCKED soft:0 hard:1 > bluetooth 2 HARD_BLOCKED soft:0 hard:1 > wlan 3 UNBLOCKED soft:0 hard:0 > bluetooth 4 UNBLOCKED soft:0 hard:0 > UNBLOCKED > > This laptop only has one wlan and one bluetooth device. Why the extra > index values? You mean, why the extra wlan? Well, if you poke sysfs (which our tool does) you'll notice that you have different instances, in my case (no laptop wireless button): # ./rfkill list 11: hci0: Bluetooth Soft blocked: no Hard blocked: no 12: phy3: Wireless LAN Soft blocked: no Hard blocked: no So I have 'hci0' and 'phy3', which is a cfg80211 device. You will, additionally, have something like 'acer-wireless' or 'hp-wireless' or whatever, which is the platform's rfkill. That's also why you see 'hard blocked' in your case, because your platform's soft-block is wired up to your wireless card's hard block. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 801 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Setting rfkill from user space 2009-07-18 9:57 ` Johannes Berg @ 2009-07-18 10:11 ` Marcel Holtmann 0 siblings, 0 replies; 3+ messages in thread From: Marcel Holtmann @ 2009-07-18 10:11 UTC (permalink / raw) To: Johannes Berg; +Cc: tim.gardner, linux-wireless@vger.kernel.org Hi Johannes, > > Because the rfkill sysfs info moved around, I've been working on a > > program for the Debian acpi-support package that can be used to perform > > 2 operations; 1) discover if there are any wireless devices powered on, > > and 2) toggle the states of all wireless devices (at the same time). > > > > git://kernel.ubuntu.com/rtg/rfkill > > Oh, I'm sorry, we already had http://git.sipsolutions.net/rfkill.git/, I > really should have publicised that more (and wasn't around when you > asked the question yesterday). I saw this post yesterday, but didn't realize they wrote their own tool. Regards Marcel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-18 10:12 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-17 20:58 Setting rfkill from user space Tim Gardner 2009-07-18 9:57 ` Johannes Berg 2009-07-18 10:11 ` Marcel Holtmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).