Re: [PATCH, resend] misc: Add dell-wmi driver for hotkey control
From: Andrew Morton
Date: Tue Dec 30 2008 - 18:51:27 EST
On Sun, 28 Dec 2008 15:31:28 +0000
Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote:
> misc: add dell-wmi driver
>
> Add a WMI driver for Dell laptops. Currently it does nothing but send a
> generic input event when a button with a picture of a battery on it is
> pressed, but maybe other uses will appear over time.
>
One wonders whether this driver should really live in drivers/input/?
+#include <linux/input.h>
+static struct input_dev *dell_wmi_input_dev;
+static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
+static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
+ input_report_key(dell_wmi_input_dev, key->keycode, 1);
+ input_sync(dell_wmi_input_dev);
+ input_report_key(dell_wmi_input_dev, key->keycode, 0);
+ input_sync(dell_wmi_input_dev);
+static int __init dell_wmi_input_setup(void)
+ dell_wmi_input_dev = input_allocate_device();
+ if (!dell_wmi_input_dev)
+ dell_wmi_input_dev->name = "Dell WMI hotkeys";
+ dell_wmi_input_dev->phys = "wmi/input0";
+ dell_wmi_input_dev->id.bustype = BUS_HOST;
+ dell_wmi_input_dev->getkeycode = dell_wmi_getkeycode;
+ dell_wmi_input_dev->setkeycode = dell_wmi_setkeycode;
+ set_bit(EV_KEY, dell_wmi_input_dev->evbit);
+ set_bit(key->keycode, dell_wmi_input_dev->keybit);
+ set_bit(EV_SW, dell_wmi_input_dev->evbit);
+ set_bit(key->keycode, dell_wmi_input_dev->swbit);
+ err = input_register_device(dell_wmi_input_dev);
+ input_free_device(dell_wmi_input_dev);
+ err = dell_wmi_input_setup();
+ input_unregister_device(dell_wmi_input_dev);
+ input_unregister_device(dell_wmi_input_dev);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/