linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Zhu Yi <yi.zhu@intel.com>
Cc: linux-wireless@vger.kernel.org, Dan Williams <dcbw@redhat.com>
Subject: Re: Question on rfkill double block
Date: Wed, 2 Jul 2008 16:32:02 -0300	[thread overview]
Message-ID: <20080702193202.GA20410@khazad-dum.debian.net> (raw)
In-Reply-To: <1214982208.14590.473.camel@debian.sh.intel.com>

On Wed, 02 Jul 2008, Zhu Yi wrote:
> It doesn't say what to do if both the hardware and software rfkill lines
> are active when RFKILL_STATE_UNBLOCKED is asked. Should we deactivate
> the software rfkill in this case? Otherwise below usage won't turn on
> the radio:

Well, we allow double-blocking to make sure the radio isn't unblocked by
mistake.  The bias in rfkill is to block, as that is safer.

The issue is that if we get a RFKILL_STATE_UNBLOCKED request, and we are at
RFKILL_STATE_HARD_BLOCKED, we need to return an error (we can't set the
requested state).  But since we returned an error, should we do the best we
can, or should we do nothing?

I am really not sure what would be better: to remove the double-blocking
while still returning an error, or to leave the radio as is (be it
double-blocked or just blocked by the hardware rfkill line) and return an
error.

Both would work just fine as far as the rfkill class goes, it wouldn't get
confused by either as far as I can tell (*as long as an error is
returned!*).  But we really should pick one of the two, and document that
IMHO.

My best guess is that doing a half-unblock would be less confusing to the
user, but we can ask the userspace GUI people about it ;-)  Dan?

> hardware rfkill activate
> software rfkill activate
> RFKILL_STATE_UNBLOCKED request
> hardware rfkill deactivate
> 
> Furthermore, if we permit double block, what should get_state() return?

get_state() returns RFKILL_STATE_HARD_BLOCKED when any hardware rfkill lines
are active.  If ALL hardware rfkill lines are inactive, it will return
RFKILL_STATE_SOFT_BLOCKED if any software rfkill lines are ative.

And if EVERY rfkill line is inactive, it returns RFKILL_STATE_UNBLOCKED.

This makes sense, as you are basically stuck without being able to go
anywere when in RFKILL_STATE_HARD_BLOCKED, until something external changes
the hardware rfkill lines.

> Shouldn't rfkill_state ???be bitmap instead of enum?

We could do that, too.  But a bitmap would cause trouble due to the ABI we
inherited from the rfkill in the stable kernels, so it would be cleaner to
just add a fourth state (RFKILL_STATE_DOUBLE_BLOCKED).

However, I am pretty certain we will find firmware (hardware is less likely
to be this stupid) that has erratic behaviour when RFKILL_STATE_HARD_BLOCKED
(and thus you don't really know if you managed to double-block or remove a
double-block).  In fact, that's the kind of crap I am used to fight in
thinkpad-acpi, although I sure hope thinkpads don't have this particular
quirk.

So, I pose this question:  Four states would allow us to tell the user the
radio is JUST hardware-killed or JUST software-killed for some hardware, but
does THAT enhance the user experience in any way?  Do GUIs really need that
detail?

If the answer is "yes, it is good, let's do it", I can certainly try to cook
up a patch.  But if it is "no, it wouldn't do much for the user", or if the
answer is too uncertain, I don't think we should do it.

-- 
  "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

  parent reply	other threads:[~2008-07-02 19:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02  7:03 Question on rfkill double block Zhu Yi
2008-07-02 17:03 ` Dan Williams
2008-07-04 19:55   ` Henrique de Moraes Holschuh
2008-07-07 17:11     ` Dan Williams
2008-07-07 19:48       ` Fabien Crespel
2008-07-07 20:47       ` Henrique de Moraes Holschuh
2008-07-08  5:12         ` Andy Lutomirski
2008-07-08 15:05           ` Henrique de Moraes Holschuh
2008-07-02 19:32 ` Henrique de Moraes Holschuh [this message]
2008-07-05 21:28   ` Tomas Winkler
2008-07-06  0:20     ` Henrique de Moraes Holschuh
2008-07-07  4:44       ` Andy Lutomirski
2008-07-07 16:56         ` Henrique de Moraes Holschuh
2008-07-07 18:47           ` Andrew Lutomirski
2008-07-07 19:18             ` Andrew Lutomirski
2008-07-07 21:09               ` Andrew Lutomirski
2008-07-07 21:21               ` Henrique de Moraes Holschuh
2008-07-07 20:59             ` Henrique de Moraes Holschuh
2008-07-07 17:02         ` Dan Williams

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=20080702193202.GA20410@khazad-dum.debian.net \
    --to=hmh@hmh.eng.br \
    --cc=dcbw@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yi.zhu@intel.com \
    /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).