diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-06-23 16:46:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-26 14:21:22 -0400 |
commit | 5005657cbd0fd6f277f807c0612a6b6d4396a02c (patch) | |
tree | e6ed81f07a1a85ed2c440ac8631ca19cc77907c1 /Documentation/rfkill.txt | |
parent | dc288520a21879c6540f3249e9532c5e032da4e8 (diff) |
rfkill: rename the rfkill_state states and add block-locked state
The current naming of rfkill_state causes a lot of confusion: not only the
"kill" in rfkill suggests negative logic, but also the fact that rfkill cannot
turn anything on (it can just force something off or stop forcing something
off) is often forgotten.
Rename RFKILL_STATE_OFF to RFKILL_STATE_SOFT_BLOCKED (transmitter is blocked
and will not operate; state can be changed by a toggle_radio request), and
RFKILL_STATE_ON to RFKILL_STATE_UNBLOCKED (transmitter is not blocked, and may
operate).
Also, add a new third state, RFKILL_STATE_HARD_BLOCKED (transmitter is blocked
and will not operate; state cannot be changed through a toggle_radio request),
which is used by drivers to indicate a wireless transmiter was blocked by a
hardware rfkill line that accepts no overrides.
Keep the old names as #defines, but document them as deprecated. This way,
drivers can be converted to the new names *and* verified to actually use rfkill
correctly one by one.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'Documentation/rfkill.txt')
-rw-r--r-- | Documentation/rfkill.txt | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index cf230c1ad9ef..5316cea95ce0 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -60,9 +60,20 @@ The second option provides an rfkill input handler. This handler will listen to | |||
60 | all rfkill key events and will toggle the radio accordingly. With this option | 60 | all rfkill key events and will toggle the radio accordingly. With this option |
61 | enabled userspace could either do nothing or simply perform monitoring tasks. | 61 | enabled userspace could either do nothing or simply perform monitoring tasks. |
62 | 62 | ||
63 | When a rfkill switch is in the RFKILL_STATE_ON, the wireless transmitter (radio | 63 | When a rfkill switch is in the RFKILL_STATE_UNBLOCKED, the wireless transmitter |
64 | TX circuit for example) is *enabled*. When the rfkill switch is in the | 64 | (radio TX circuit for example) is *enabled*. When the rfkill switch is in the |
65 | RFKILL_STATE_OFF, the wireless transmitter is to be *blocked* from operating. | 65 | RFKILL_STATE_SOFT_BLOCKED or RFKILL_STATE_HARD_BLOCKED, the wireless |
66 | transmitter is to be *blocked* from operating. | ||
67 | |||
68 | RFKILL_STATE_SOFT_BLOCKED indicates that a call to toggle_radio() can change | ||
69 | that state. RFKILL_STATE_HARD_BLOCKED indicates that a call to toggle_radio() | ||
70 | will not be able to change the state and will return with a suitable error if | ||
71 | attempts are made to set the state to RFKILL_STATE_UNBLOCKED. | ||
72 | |||
73 | RFKILL_STATE_HARD_BLOCKED is used by drivers to signal that the device is | ||
74 | locked in the BLOCKED state by a hardwire rfkill line (typically an input pin | ||
75 | that, when active, forces the transmitter to be disabled) which the driver | ||
76 | CANNOT override. | ||
66 | 77 | ||
67 | Full rfkill functionality requires two different subsystems to cooperate: the | 78 | Full rfkill functionality requires two different subsystems to cooperate: the |
68 | input layer and the rfkill class. The input layer issues *commands* to the | 79 | input layer and the rfkill class. The input layer issues *commands* to the |
@@ -122,10 +133,10 @@ Userspace input handlers (uevents) or kernel input handlers (rfkill-input): | |||
122 | action). | 133 | action). |
123 | * rfkill-input implements EPO by handling EV_SW SW_RFKILL_ALL 0 | 134 | * rfkill-input implements EPO by handling EV_SW SW_RFKILL_ALL 0 |
124 | (power off all transmitters) in a special way: it ignores any | 135 | (power off all transmitters) in a special way: it ignores any |
125 | overrides and local state cache and forces all transmitters to | 136 | overrides and local state cache and forces all transmitters to the |
126 | the OFF state (including those which are already supposed to be | 137 | RFKILL_STATE_SOFT_BLOCKED state (including those which are already |
127 | OFF). Note that the opposite event (power on all transmitters) | 138 | supposed to be BLOCKED). Note that the opposite event (power on all |
128 | is handled normally. | 139 | transmitters) is handled normally. |
129 | 140 | ||
130 | Userspace uevent handler or kernel platform-specific drivers hooked to the | 141 | Userspace uevent handler or kernel platform-specific drivers hooked to the |
131 | rfkill notifier chain: | 142 | rfkill notifier chain: |
@@ -284,6 +295,19 @@ You should: | |||
284 | YOU CAN ACCESS state DIRECTLY) | 295 | YOU CAN ACCESS state DIRECTLY) |
285 | - rfkill_register() | 296 | - rfkill_register() |
286 | 297 | ||
298 | The only way to set a device to the RFKILL_STATE_HARD_BLOCKED state is through | ||
299 | a suitable return of get_state() or through rfkill_force_state(). | ||
300 | |||
301 | When a device is in the RFKILL_STATE_HARD_BLOCKED state, the only way to switch | ||
302 | it to a different state is through a suitable return of get_state() or through | ||
303 | rfkill_force_state(). | ||
304 | |||
305 | If toggle_radio() is called to set a device to state RFKILL_STATE_SOFT_BLOCKED | ||
306 | when that device is already at the RFKILL_STATE_HARD_BLOCKED state, it should | ||
307 | not return an error. Instead, it should try to double-block the transmitter, | ||
308 | so that its state will change from RFKILL_STATE_HARD_BLOCKED to | ||
309 | RFKILL_STATE_SOFT_BLOCKED should the hardware blocking cease. | ||
310 | |||
287 | Please refer to the source for more documentation. | 311 | Please refer to the source for more documentation. |
288 | 312 | ||
289 | =============================================================================== | 313 | =============================================================================== |
@@ -322,13 +346,27 @@ change by writing to the "state" attribute in order for anything to happen. | |||
322 | 346 | ||
323 | Take particular care to implement EV_SW SW_RFKILL_ALL properly. When that | 347 | Take particular care to implement EV_SW SW_RFKILL_ALL properly. When that |
324 | switch is set to OFF, *every* rfkill device *MUST* be immediately put into the | 348 | switch is set to OFF, *every* rfkill device *MUST* be immediately put into the |
325 | OFF state, no questions asked. | 349 | RFKILL_STATE_SOFT_BLOCKED state, no questions asked. |
326 | 350 | ||
327 | The following sysfs entries will be created: | 351 | The following sysfs entries will be created: |
328 | 352 | ||
329 | name: Name assigned by driver to this key (interface or driver name). | 353 | name: Name assigned by driver to this key (interface or driver name). |
330 | type: Name of the key type ("wlan", "bluetooth", etc). | 354 | type: Name of the key type ("wlan", "bluetooth", etc). |
331 | state: Current state of the key. 1: On, 0: Off. | 355 | state: Current state of the transmitter |
356 | 0: RFKILL_STATE_SOFT_BLOCKED | ||
357 | transmitter is forced off, but you can override it | ||
358 | by a write to the state attribute, or through input | ||
359 | events (if rfkill-input is loaded). | ||
360 | 1: RFKILL_STATE_UNBLOCKED | ||
361 | transmiter is NOT forced off, and may operate if | ||
362 | all other conditions for such operation are met | ||
363 | (such as interface is up and configured, etc). | ||
364 | 2: RFKILL_STATE_HARD_BLOCKED | ||
365 | transmitter is forced off by something outside of | ||
366 | the driver's control. | ||
367 | |||
368 | You cannot set a device to this state through | ||
369 | writes to the state attribute. | ||
332 | claim: 1: Userspace handles events, 0: Kernel handles events | 370 | claim: 1: Userspace handles events, 0: Kernel handles events |
333 | 371 | ||
334 | Both the "state" and "claim" entries are also writable. For the "state" entry | 372 | Both the "state" and "claim" entries are also writable. For the "state" entry |