Re: Awkward rfkill corner cases

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Henrique de Moraes Holschuh
Date: Tuesday, August 19, 2008 - 7:30 pm

On Wed, 20 Aug 2008, Matthew Garrett wrote:

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.


Ok.


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 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).


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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/2] eeepc-laptop: Fix user after free, Matthew Garrett, (Mon Aug 4, 10:08 am)
[PATCH 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Mon Aug 4, 10:15 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Mon Aug 4, 10:36 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Ivo van Doorn, (Mon Aug 4, 10:53 am)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Mon Aug 4, 2:21 pm)
Re: [PATCH 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Mon Aug 4, 2:29 pm)
[PATCH v2 1/2] eeepc-laptop: Fix user after free, Matthew Garrett, (Wed Aug 6, 2:23 am)
[PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Wed Aug 6, 2:25 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Andrew Morton, (Tue Aug 19, 2:58 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 4:13 am)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 4:09 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 4:24 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 6:18 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Matthew Garrett, (Tue Aug 19, 6:28 pm)
Re: [PATCH v2 2/2] eeepc-laptop: Use standard interfaces, Henrique de Moraes H ..., (Tue Aug 19, 6:32 pm)
Awkward rfkill corner cases, Matthew Garrett, (Tue Aug 19, 6:42 pm)
Re: Awkward rfkill corner cases, Henrique de Moraes H ..., (Tue Aug 19, 7:30 pm)