Thread (58 messages) 58 messages, 5 authors, 2008-09-22

Re: [PATCH] rfkill: clarify usage of rfkill_force_state() and rfkill->get_state()

From: Ivo van Doorn <hidden>
Date: 2008-09-18 17:40:39
Also in: lkml

On Thursday 18 September 2008, Henrique de Moraes Holschuh wrote:
On Thu, 18 Sep 2008, Ivo van Doorn wrote:
quoted
On Thursday 18 September 2008, Henrique de Moraes Holschuh wrote:
quoted
rfkill_force_state() is used to update the rfkill core's idea of what is
really happening RIGHT NOW to the transmitter hardware in a PUSH model.

rfkill->get_state() does the same, in a PULL model.

Neither of them change the real hardware radio state through a call to
rfkill->toggle_radio() or anything of the sort, so they must deal with the
real, current state of the hardware.

Change some documentation to make that more clear (I hope).

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <redacted>
See my other mail I just send out.
I did, and just replied to it.

But only now do I think I realised what you meant:  That even if the driver
tries to keep set txpower off separate from rfkill, if it uses the hardware
soft-rfkill bit to implement both, it cannot use that to feed information to
rfkill_force_state() directly.

Argh.
Indeed, you need to differentiate between RFKILL and RADIO states.
quoted
But I don't quite agree on this change of rfkill event interpretation.
Well, there is no intended change in interpretation, but I don't know how to
word it in a way that means "the real current hardware state as far as
rfkill is concerned".
Well my interpretation is that rfkill events and thus rfkill_force_state() calls
should be done for RFKILL state changes only. And RADIO state should be
ignored since they don't matter for rfkill.
Because suppose it is a driver doing txpower off AND software rfkill using
the *same* hardware bit (a sigle software rfkill bit).

Now it must do something like this in pseudo-code:

	1. if (the bit is disabled (i.e. SW rfkill is NOT ACTIVE)) {
		rfkill-SW-status = disabled;
	   }  else if (the bit is enabled (i.e. SW rfkill is ACTIVE)) {
		if (tx power off is NOT ACTIVE)
			rfkill-SW-status = enabled;
		else
			rfkill-SW-status = whatever the user asked
	   }

THEN, it should use rfkill-sw-status, along with the hw rfkill line status,
to synthesize the state it must pass to rfkill_force_status().

ICK.  Of course, if the driver has another way to implement txpower off that
does not clash with sw rfkill, the above is unneeded.

How would you put that into words for the rfkill documentation?
The driver is required to keep track of the userspace configuration settings,
when rfkill sends BLOCK to driver it should disable the radio, when rfkill
send UNBLOCK to the driver it should restore to the userspace configuration
settings (which can either be an enabled or disabled radio).

Ivo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help