linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Gardner <tim.gardner@canonical.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Setting rfkill from user space
Date: Fri, 17 Jul 2009 14:58:20 -0600	[thread overview]
Message-ID: <4A60E5EC.1080700@canonical.com> (raw)

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

             reply	other threads:[~2009-07-17 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 20:58 Tim Gardner [this message]
2009-07-18  9:57 ` Setting rfkill from user space Johannes Berg
2009-07-18 10:11   ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A60E5EC.1080700@canonical.com \
    --to=tim.gardner@canonical.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).