diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-10-09 20:49:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:09 -0400 |
commit | d003922dab6a66027344a787e9846ecf35a706a8 (patch) | |
tree | 1fa27e13eafd7d2cfceaeeb7c70009e29467ccfa /Documentation/rfkill.txt | |
parent | 68d2413bec7e1d97e906eafb05e78d925a5ca128 (diff) |
rfkill: add master_switch_mode and EPO lock to rfkill and rfkill-input
Add of software-based sanity to rfkill and rfkill-input so that it can
reproduce what hardware-based EPO switches do, blocking all transmitters
and locking down any further attempts to unblock them until the switch is
deactivated.
rfkill-input is responsible for issuing the EPO control requests, like
before.
While an rfkill EPO is active, all transmitters are locked to one of the
BLOCKED states and all attempts to change that through the rfkill API
(userspace and kernel) will be either ignored or return -EPERM errors.
The lock will be released upon receipt of EV_SW SW_RFKILL_ALL ON by
rfkill-input, or should modular rfkill-input be unloaded.
This makes rfkill and rfkill-input extend the operation of an existing
wireless master kill switch to all wireless devices in the system, even
those that are not under hardware or firmware control.
Since the above is the expected operational behavior for the master rfkill
switch, the EPO lock functionality is not optional.
Also, extend rfkill-input to allow for three different behaviors when it
receives an EV_SW SW_RFKILL_ALL ON input event. The user can set which
behavior he wants through the master_switch_mode parameter:
master_switch_mode = 0: EV_SW SW_RFKILL_ALL ON just unlocks rfkill
controller state changes (so that the rfkill userspace and kernel APIs can
now be used to change rfkill controller states again), but doesn't change
any of their states (so they will all remain blocked). This is the safest
mode of operation, as it requires explicit operator action to re-enable a
transmitter.
master_switch_mode = 1: EV_SW SW_RFKILL_ALL ON causes rfkill-input to
attempt to restore the system to the state before the last EV_SW
SW_RFKILL_ALL OFF event, or to the default global states if no EV_SW
SW_RFKILL_ALL OFF ever happened. This is the recommended mode of
operation for laptops.
master_switch_mode = 2: tries to unblock all rfkill controllers (i.e.
enable all transmitters) when an EV_SW SW_RFKILL_ALL ON event is received.
This is the default mode of operation, as it mimics the previous behavior
of rfkill-input.
In order to implement these features in a clean way, the entire event
handling of rfkill-input was refactored into a single worker function.
Protection against input event DoS (repeatedly firing rfkill events for
rfkill-input to process) was removed during the code refactoring. It will
be added back in a future patch.
Note that with these changes, rfkill-input doesn't need to explicitly
handle any radio types for which KEY_<radio type> or SW_<radio type> events
do not exist yet.
Code to handle EV_SW SW_{WLAN,WWAN,BLUETOOTH,WIMAX,...} was added as it
might be needed in the future (and its implementation is not that obvious),
but is currently #ifdef'd out to avoid wasting resources.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'Documentation/rfkill.txt')
-rw-r--r-- | Documentation/rfkill.txt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index b65f0799df48..4d3ee317a4a3 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -191,12 +191,20 @@ Userspace input handlers (uevents) or kernel input handlers (rfkill-input): | |||
191 | to tell the devices registered with the rfkill class to change | 191 | to tell the devices registered with the rfkill class to change |
192 | their state (i.e. translates the input layer event into real | 192 | their state (i.e. translates the input layer event into real |
193 | action). | 193 | action). |
194 | |||
194 | * rfkill-input implements EPO by handling EV_SW SW_RFKILL_ALL 0 | 195 | * rfkill-input implements EPO by handling EV_SW SW_RFKILL_ALL 0 |
195 | (power off all transmitters) in a special way: it ignores any | 196 | (power off all transmitters) in a special way: it ignores any |
196 | overrides and local state cache and forces all transmitters to the | 197 | overrides and local state cache and forces all transmitters to the |
197 | RFKILL_STATE_SOFT_BLOCKED state (including those which are already | 198 | RFKILL_STATE_SOFT_BLOCKED state (including those which are already |
198 | supposed to be BLOCKED). Note that the opposite event (power on all | 199 | supposed to be BLOCKED). |
199 | transmitters) is handled normally. | 200 | * rfkill EPO will remain active until rfkill-input receives an |
201 | EV_SW SW_RFKILL_ALL 1 event. While the EPO is active, transmitters | ||
202 | are locked in the blocked state (rfkill will refuse to unblock them). | ||
203 | * rfkill-input implements different policies that the user can | ||
204 | select for handling EV_SW SW_RFKILL_ALL 1. It will unlock rfkill, | ||
205 | and either do nothing (leave transmitters blocked, but now unlocked), | ||
206 | restore the transmitters to their state before the EPO, or unblock | ||
207 | them all. | ||
200 | 208 | ||
201 | Userspace uevent handler or kernel platform-specific drivers hooked to the | 209 | Userspace uevent handler or kernel platform-specific drivers hooked to the |
202 | rfkill notifier chain: | 210 | rfkill notifier chain: |
@@ -331,11 +339,9 @@ class to get a sysfs interface :-) | |||
331 | correct event for your switch/button. These events are emergency power-off | 339 | correct event for your switch/button. These events are emergency power-off |
332 | events when they are trying to turn the transmitters off. An example of an | 340 | events when they are trying to turn the transmitters off. An example of an |
333 | input device which SHOULD generate *_RFKILL_ALL events is the wireless-kill | 341 | input device which SHOULD generate *_RFKILL_ALL events is the wireless-kill |
334 | switch in a laptop which is NOT a hotkey, but a real switch that kills radios | 342 | switch in a laptop which is NOT a hotkey, but a real sliding/rocker switch. |
335 | in hardware, even if the O.S. has gone to lunch. An example of an input device | 343 | An example of an input device which SHOULD NOT generate *_RFKILL_ALL events by |
336 | which SHOULD NOT generate *_RFKILL_ALL events by default, is any sort of hot | 344 | default, is any sort of hot key that is type-specific (e.g. the one for WLAN). |
337 | key that does nothing by itself, as well as any hot key that is type-specific | ||
338 | (e.g. the one for WLAN). | ||
339 | 345 | ||
340 | 346 | ||
341 | 3.1 Guidelines for wireless device drivers | 347 | 3.1 Guidelines for wireless device drivers |