Commit 3082a2b7b1af1b1508c1c3fa589566064f926f40
Committed by
John W. Linville
1 parent
6510b89179
Exists in
master
and in
7 other branches
rfkill: Add support for KEY_RFKILL
Add support for handling KEY_RFKILL in the rfkill input module. This simply toggles the state of all rfkill devices. The comment in rfkill.h is also updated to reflect that RFKILL_TYPE_ALL may be used inside the kernel. Signed-off-by: Matthew Garrett <mjg@redhat.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 2 changed files with 9 additions and 1 deletions Side-by-side Diff
include/linux/rfkill.h
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | /** |
30 | 30 | * enum rfkill_type - type of rfkill switch. |
31 | 31 | * |
32 | - * @RFKILL_TYPE_ALL: toggles all switches (userspace only) | |
32 | + * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) | |
33 | 33 | * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. |
34 | 34 | * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. |
35 | 35 | * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. |
net/rfkill/input.c
... | ... | @@ -212,6 +212,9 @@ |
212 | 212 | case KEY_WIMAX: |
213 | 213 | rfkill_schedule_toggle(RFKILL_TYPE_WIMAX); |
214 | 214 | break; |
215 | + case KEY_RFKILL: | |
216 | + rfkill_schedule_toggle(RFKILL_TYPE_ALL); | |
217 | + break; | |
215 | 218 | } |
216 | 219 | } else if (type == EV_SW && code == SW_RFKILL_ALL) |
217 | 220 | rfkill_schedule_evsw_rfkillall(data); |
... | ... | @@ -293,6 +296,11 @@ |
293 | 296 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, |
294 | 297 | .evbit = { BIT_MASK(EV_KEY) }, |
295 | 298 | .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) }, |
299 | + }, | |
300 | + { | |
301 | + .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, | |
302 | + .evbit = { BIT_MASK(EV_KEY) }, | |
303 | + .keybit = { [BIT_WORD(KEY_RFKILL)] = BIT_MASK(KEY_RFKILL) }, | |
296 | 304 | }, |
297 | 305 | { |
298 | 306 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT, |