aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-06-23 16:46:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-26 14:21:22 -0400
commit5005657cbd0fd6f277f807c0612a6b6d4396a02c (patch)
treee6ed81f07a1a85ed2c440ac8631ca19cc77907c1 /Documentation
parentdc288520a21879c6540f3249e9532c5e032da4e8 (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')
-rw-r--r--Documentation/rfkill.txt56
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
60all rfkill key events and will toggle the radio accordingly. With this option 60all rfkill key events and will toggle the radio accordingly. With this option
61enabled userspace could either do nothing or simply perform monitoring tasks. 61enabled userspace could either do nothing or simply perform monitoring tasks.
62 62
63When a rfkill switch is in the RFKILL_STATE_ON, the wireless transmitter (radio 63When a rfkill switch is in the RFKILL_STATE_UNBLOCKED, the wireless transmitter
64TX 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
65RFKILL_STATE_OFF, the wireless transmitter is to be *blocked* from operating. 65RFKILL_STATE_SOFT_BLOCKED or RFKILL_STATE_HARD_BLOCKED, the wireless
66transmitter is to be *blocked* from operating.
67
68RFKILL_STATE_SOFT_BLOCKED indicates that a call to toggle_radio() can change
69that state. RFKILL_STATE_HARD_BLOCKED indicates that a call to toggle_radio()
70will not be able to change the state and will return with a suitable error if
71attempts are made to set the state to RFKILL_STATE_UNBLOCKED.
72
73RFKILL_STATE_HARD_BLOCKED is used by drivers to signal that the device is
74locked in the BLOCKED state by a hardwire rfkill line (typically an input pin
75that, when active, forces the transmitter to be disabled) which the driver
76CANNOT override.
66 77
67Full rfkill functionality requires two different subsystems to cooperate: the 78Full rfkill functionality requires two different subsystems to cooperate: the
68input layer and the rfkill class. The input layer issues *commands* to the 79input 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
130Userspace uevent handler or kernel platform-specific drivers hooked to the 141Userspace uevent handler or kernel platform-specific drivers hooked to the
131rfkill notifier chain: 142rfkill 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
298The only way to set a device to the RFKILL_STATE_HARD_BLOCKED state is through
299a suitable return of get_state() or through rfkill_force_state().
300
301When a device is in the RFKILL_STATE_HARD_BLOCKED state, the only way to switch
302it to a different state is through a suitable return of get_state() or through
303rfkill_force_state().
304
305If toggle_radio() is called to set a device to state RFKILL_STATE_SOFT_BLOCKED
306when that device is already at the RFKILL_STATE_HARD_BLOCKED state, it should
307not return an error. Instead, it should try to double-block the transmitter,
308so that its state will change from RFKILL_STATE_HARD_BLOCKED to
309RFKILL_STATE_SOFT_BLOCKED should the hardware blocking cease.
310
287Please refer to the source for more documentation. 311Please 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
323Take particular care to implement EV_SW SW_RFKILL_ALL properly. When that 347Take particular care to implement EV_SW SW_RFKILL_ALL properly. When that
324switch is set to OFF, *every* rfkill device *MUST* be immediately put into the 348switch is set to OFF, *every* rfkill device *MUST* be immediately put into the
325OFF state, no questions asked. 349RFKILL_STATE_SOFT_BLOCKED state, no questions asked.
326 350
327The following sysfs entries will be created: 351The 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
334Both the "state" and "claim" entries are also writable. For the "state" entry 372Both the "state" and "claim" entries are also writable. For the "state" entry