]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
rfkill: Add support for KEY_RFKILL
authorMatthew Garrett <mjg@redhat.com>
Tue, 16 Feb 2010 21:36:25 +0000 (16:36 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 2 Mar 2010 19:28:49 +0000 (14:28 -0500)
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>
include/linux/rfkill.h
net/rfkill/input.c

index 97059d08a626cb70b2db4c39d7f7c9a17b800213..4f82326eb2945f2cd275bbcff64151a06ca6ccb4 100644 (file)
@@ -29,7 +29,7 @@
 /**
  * enum rfkill_type - type of rfkill switch.
  *
- * @RFKILL_TYPE_ALL: toggles all switches (userspace only)
+ * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
  * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
  * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
  * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
index a7295ad5f9cb1bf1757b506337239cd792a9d001..3713d7ecab96b85ccde3024a763aa100e94ca683 100644 (file)
@@ -212,6 +212,9 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
                case KEY_WIMAX:
                        rfkill_schedule_toggle(RFKILL_TYPE_WIMAX);
                        break;
+               case KEY_RFKILL:
+                       rfkill_schedule_toggle(RFKILL_TYPE_ALL);
+                       break;
                }
        } else if (type == EV_SW && code == SW_RFKILL_ALL)
                rfkill_schedule_evsw_rfkillall(data);
@@ -294,6 +297,11 @@ static const struct input_device_id rfkill_ids[] = {
                .evbit = { BIT_MASK(EV_KEY) },
                .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) },
        },
+       {
+               .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
+               .evbit = { BIT_MASK(EV_KEY) },
+               .keybit = { [BIT_WORD(KEY_RFKILL)] = BIT_MASK(KEY_RFKILL) },
+       },
        {
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT,
                .evbit = { BIT(EV_SW) },