From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
corentincj@iksaif.net, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org
Subject: Re: Awkward rfkill corner cases
Date: Tue, 19 Aug 2008 23:30:28 -0300 [thread overview]
Message-ID: <20080820023027.GH29336@khazad-dum.debian.net> (raw)
In-Reply-To: <20080820014211.GA7592@srcf.ucam.org>
On Wed, 20 Aug 2008, Matthew Garrett wrote:
> One completely unrelated question. In the following situation (relevant
> to Dells, not the Eee)
>
> * The system has a key (not a switch) that in firmware disables the
> hardware (HARD_BLOCKED)
Ick. I sure hope you can query the firmware, so that you can look at it as
if it were a switch instead of a key (and look at the key press event as a
"switch changed state" event -- never mind it is difficult to hook to that
event right now)?
I mean, trying to deal with firmware/hardware that changes states on its own
in any other basis than "it is a switch", is error prone. You miss one
event, you go out of sync. That's bad.
> * That key generates an event through the keyboard controller, but not
> through any other obviously detectable means
Ok.
> * The radio control is also controllable through software (SOFT_BLOCKED)
>
> Should pressing the key generate a KEY_WLAN event?
Frankly? I think so. It would be nice if you could hook the key as a "hint
that the rfkill controller may have changed state" on the driver, and ALSO
as a normal input device (so that it can command more than just that one
WLAN radio).
But I think it would be EVEN BETTER if you could somehow suppress that KEY_*
event, and synthesize an EV_SW SW_WLAN in its place (you will have to ask
Dmitry to add it, since it is a first use) instead. If you cannot, KEY_WLAN
will have to make do.
> I note that rfkill-input will, if the device is in HARD_BLOCKED state,
> attempt to set it to UNBLOCKED. This sounds like generating the keycode
I have some patches in flight that will make rfkill-input smarter about it.
But that's just an enhancement. The current way it operates is annoying,
but last time I checked, it doesn't blow up.
Just return -EPERM on your device driver's toggle_radio() callback if you
are at HARD_BLOCKED and someone asks you to go to UNBLOCKED. That is what
the API calls for (if it is not clear enough, we can improve the docs).
> is the wrong thing to do, since it'll cause rfkill-input to try to undo
> the change that's just been made. However, if the key isn't mapped
> there's no obvious way for any of the stack to determine that a change
> has been made and propagate that to userspace. What should we be doing
> here?
Never worry about propagating rfkill state to userspace in a driver. rfkill
will do it by itself using uevents, that code has already been accepted.
The rfkill class will do it for all rfkill controllers, and rfkill input may
be taught to do it later if userspace people ask for it (nobody did it yet
because it is not very useful, since what you want is reports of what really
IS happening to the radios, and those come from the rfkill class. All
rfkill-input could tell userspace is what it is *trying* to change radio
states, but not whether they did really happen).
The reason why you'd want to send a KEY_WLAN event (or, if you can, an EV_SW
SW_WLAN event) is to change that key from something that controls an
specific WLAN radio, to something that can *potentially* control every WLAN
radio attached to the box. It is *not* done to report status to userspace
[unless you meat report state to something in userspace that is doing what
rfkill-input does in the kernel, but we haven't enhanced rfkill-input and
rfkill to export all states needed for such an userspace implementation
yet].
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
next prev parent reply other threads:[~2008-08-20 2:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 17:08 [PATCH 1/2] eeepc-laptop: Fix user after free Matthew Garrett
2008-08-04 17:15 ` [PATCH 2/2] eeepc-laptop: Use standard interfaces Matthew Garrett
2008-08-04 17:53 ` Ivo van Doorn
2008-08-04 17:36 ` Matthew Garrett
2008-08-04 21:21 ` Henrique de Moraes Holschuh
2008-08-04 21:29 ` Henrique de Moraes Holschuh
2008-08-06 9:23 ` [PATCH v2 1/2] eeepc-laptop: Fix user after free Matthew Garrett
2008-08-06 9:25 ` [PATCH v2 2/2] eeepc-laptop: Use standard interfaces Matthew Garrett
2008-08-19 9:58 ` Andrew Morton
2008-08-19 11:13 ` Matthew Garrett
2008-08-19 23:09 ` Henrique de Moraes Holschuh
2008-08-19 23:24 ` Matthew Garrett
2008-08-20 1:18 ` Henrique de Moraes Holschuh
2008-08-20 1:28 ` Matthew Garrett
2008-08-20 1:32 ` Henrique de Moraes Holschuh
2008-08-20 1:42 ` Awkward rfkill corner cases Matthew Garrett
2008-08-20 2:30 ` Henrique de Moraes Holschuh [this message]
2008-10-08 20:50 ` [PATCH v2 2/2] eeepc-laptop: Use standard interfaces Len Brown
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=20080820023027.GH29336@khazad-dum.debian.net \
--to=hmh@hmh.eng.br \
--cc=akpm@linux-foundation.org \
--cc=corentincj@iksaif.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.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