Skip to contentSkip to conversation

misc: Add dell-wmi driver for hotkey control

PATCH RESEND In review Matthew Garrett 3 participants 4 messages Dec 28, 2008 – Jan 1, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 misc: Add dell-wmi driver for hotkey control

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.

MAINTAINERS +5 -0
index 618c1ef..fe2c17e 100644
@@ -1371,6 +1371,11 @@ P:	Doug Warzecha
 M:	[email protected]
 S:	Maintained
 
+DELL WMI EXTRAS DRIVER
+P:	Matthew Garrett
+M:	[email protected]
+S:	Maintained
+
 DEVICE NUMBER REGISTRY
 P:	Torben Mathiasen
 M:	[email protected]
drivers/misc/Kconfig +10 -0
index fee7304..5837544 100644
@@ -227,6 +227,16 @@ config HP_WMI
          To compile this driver as a module, choose M here: the module will
          be called hp-wmi.
 
+config DELL_WMI
+       tristate "Dell WMI extras"
+       depends on ACPI_WMI
+       depends on INPUT
+       help
+         Say Y here if you want to support WMI-based hotkeys on Dell laptops.
+
+         To compile this driver as a module, choose M here: the module will
+         be called dell-wmi.
+
 config ICS932S401
 	tristate "Integrated Circuits ICS932S401"
 	depends on I2C && EXPERIMENTAL
drivers/misc/Makefile +1 -0
index 817f7f5..5b47819 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_ATMEL_PWM)		+= atmel_pwm.o
 obj-$(CONFIG_ATMEL_SSC)		+= atmel-ssc.o
 obj-$(CONFIG_ATMEL_TCLIB)	+= atmel_tclib.o
 obj-$(CONFIG_HP_WMI)		+= hp-wmi.o
+obj-$(CONFIG_DELL_WMI)		+= dell-wmi.o
 obj-$(CONFIG_ICS932S401)	+= ics932s401.o
 obj-$(CONFIG_TC1100_WMI)	+= tc1100-wmi.o
 obj-$(CONFIG_LKDTM)		+= lkdtm.o
drivers/misc/dell-wmi.c new file +210 -0

210 lines not on this page · raw message

Signature · 1 line
Matthew Garrett | [email protected]
#1 lore raw
Quoted 6 lines · On Sun, 28 Dec 2008 15:31:28 +0000 Matthew Garrett <[email protected]> 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);

#2 lore raw
Quoted 1 line · Andrew Morton

One wonders whether this driver should really live in drivers/input/?

Mm. There's certainly an argument for that given its current functionality, but the Dell WMI interface also exposes a bunch of other functionality - we just don't know how to use any of it right now. Moving it later might be more confusing.

Signature · 1 line
Matthew Garrett | [email protected]
reviewer
#3 lore raw
Quoted 2 lines
Quoted 2 lines

One wonders whether this driver should really live in drivers/input/?

It will live in drivers/platform/x86, per the earlier patch series that moved the platform drivers out of drivers/misc.

thanks,
-- Len Brown, Intel Open Source Technology Center