* [PATCH, RFC] HP WMI hotkey driver
[not found] <20071218235137.12838.75397.stgit@localhost>
@ 2007-12-26 22:48 ` Matthew Garrett
2008-01-03 16:58 ` Dmitry Torokhov
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Garrett @ 2007-12-26 22:48 UTC (permalink / raw)
To: Carlos Corbacho; +Cc: linux-acpi, Len Brown, Alexey Starikovskiy, linux-input
This adds a driver for hotkey events generated through the WMI subsystem
on some recent HP laptops. Mine only has a single key that works this
way, so I'd be interested in getting some feedback from anyone else who
has a recent HP machine which doesn't send hotkey events through the
keyboard controller. It depends on Carlos's WMI patches, plus a couple
of bugfixes I've suggested on linux-acpi (limit the memcpy into bus_id
to 20 bytes and make sure it's null terminated, and invert the sense in
wmi_register_notify so it's actually possible to register a callback.
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 8f5c7b9..2f96736 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -183,4 +183,13 @@ config HP_SDC_RTC
Say Y here if you want to support the built-in real time clock
of the HP SDC controller.
+config INPUT_HP_WMI
+ tristate "HP WMI hotkey interface"
+ depends on ACPI_WMI
+ help
+ Say Y here if you want to support WMI-based hotkeys on HP laptops.
+
+ To compile this driver as a module, choose M here: the module will
+ be called hp_wmi.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 3585b50..1bc3b15 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
+obj-$(CONFIG_INPUT_HP_WMI) += hp_wmi.o
\ No newline at end of file
diff --git a/drivers/input/misc/hp_wmi.c b/drivers/input/misc/hp_wmi.c
new file mode 100644
index 0000000..17c7d4b
--- /dev/null
+++ b/drivers/input/misc/hp_wmi.c
@@ -0,0 +1,189 @@
+/*
+ * HP WMI hotkeys
+ *
+ * Copyright (C) 2007 Matthew Garrett <mjg59@srcf.ucam.org>
+ *
+ * Portions based on wistron_btns.c:
+ * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
+ * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
+ * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/input.h>
+#include <acpi/acpi_drivers.h>
+
+MODULE_AUTHOR("Matthew Garrett");
+MODULE_DESCRIPTION("HP laptop WMI hotkeys driver");
+MODULE_LICENSE("GPL");
+
+MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
+
+#define HPWMI_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
+
+struct key_entry {
+ char type; /* See KE_* below */
+ u8 code;
+ union {
+ u16 keycode; /* For KE_KEY */
+ struct { /* For KE_SW */
+ u8 code;
+ u8 value;
+ } sw;
+ };
+};
+
+enum {KE_KEY, KE_END };
+
+static struct key_entry hp_wmi_keymap[] = {
+ { KE_KEY, 0x04, {KEY_HELP} },
+ { KE_END, 0 }
+};
+
+static struct input_dev *hp_wmi_input_dev;
+
+static struct key_entry *hp_wmi_get_entry_by_scancode (int code)
+{
+ struct key_entry *key;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++)
+ if (code == key->code)
+ return key;
+
+ return NULL;
+}
+
+static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
+{
+ struct key_entry *key;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++)
+ if (key->type == KE_KEY && keycode == key->keycode)
+ return key;
+
+ return NULL;
+}
+
+static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+{
+ struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
+
+ if (key && key->type == KE_KEY) {
+ *keycode = key->keycode;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
+{
+ struct key_entry *key;
+
+ int old_keycode;
+
+ if (keycode < 0 || keycode > KEY_MAX)
+ return -EINVAL;
+
+ key = hp_wmi_get_entry_by_scancode(scancode);
+ if (key && key->type == KE_KEY) {
+ old_keycode = key->keycode;
+ key->keycode = keycode;
+ set_bit(keycode, dev->keybit);
+ if (!hp_wmi_get_entry_by_keycode(old_keycode))
+ clear_bit(old_keycode, dev->keybit);
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+void hp_wmi_notify (u32 value, void* context)
+{
+ struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
+ static struct key_entry *key;
+ union acpi_object *obj;
+
+ wmi_get_event_data (value, &response);
+
+ obj = (union acpi_object *) response.pointer;
+
+ if (obj && obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == 8) {
+ key = hp_wmi_get_entry_by_scancode
+ (*((u8 *) obj->buffer.pointer));
+ if (key) {
+ input_report_key (hp_wmi_input_dev, key->keycode, 1);
+ input_sync (hp_wmi_input_dev);
+ input_report_key (hp_wmi_input_dev, key->keycode, 0);
+ input_sync (hp_wmi_input_dev);
+ } else
+ printk (KERN_INFO "HP WMI: Unknown key pressed\n");
+ } else
+ printk (KERN_INFO "HP WMI: Unknown response received\n");
+
+ return;
+}
+
+static int __init hp_wmi_init(void)
+{
+ int err;
+ const struct key_entry *key;
+
+ if (!wmi_has_guid(HPWMI_GUID)) {
+ printk ("Unable to locate guid\n");
+ return -ENODEV;
+ }
+
+ err = wmi_install_notify_handler (hp_wmi_notify, NULL);
+ if (err)
+ return err;
+
+ hp_wmi_input_dev = input_allocate_device();
+
+ hp_wmi_input_dev->name = "HP WMI hotkeys";
+ hp_wmi_input_dev->phys = "wmi/input0";
+ hp_wmi_input_dev->id.bustype = BUS_HOST;
+ hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
+ hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++) {
+ set_bit(EV_KEY, hp_wmi_input_dev->evbit);
+ set_bit(key->keycode, hp_wmi_input_dev->keybit);
+ }
+
+ err = input_register_device (hp_wmi_input_dev);
+
+ if (err) {
+ input_free_device (hp_wmi_input_dev);
+ return err;
+ }
+
+ return 0;
+}
+
+static void __exit hp_wmi_exit(void)
+{
+ wmi_remove_notify_handler();
+ input_unregister_device (hp_wmi_input_dev);
+ input_free_device (hp_wmi_input_dev);
+}
+
+module_init(hp_wmi_init);
+module_exit(hp_wmi_exit);
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver
2007-12-26 22:48 ` [PATCH, RFC] HP WMI hotkey driver Matthew Garrett
@ 2008-01-03 16:58 ` Dmitry Torokhov
2008-01-14 17:41 ` [PATCH, RFC] HP WMI hotkey driver, RFKill query? Matthew Garrett
0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2008-01-03 16:58 UTC (permalink / raw)
To: Matthew Garrett
Cc: Carlos Corbacho, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
Hi Matthew,
On Dec 26, 2007 5:48 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> + } else
> + printk (KERN_INFO "HP WMI: Unknown response received\n");
> +
> + return;
No need for empty returns.
> +}
> +
> +static int __init hp_wmi_init(void)
> +{
> + int err;
> + const struct key_entry *key;
> +
> + if (!wmi_has_guid(HPWMI_GUID)) {
> + printk ("Unable to locate guid\n");
> + return -ENODEV;
> + }
> +
> + err = wmi_install_notify_handler (hp_wmi_notify, NULL);
> + if (err)
> + return err;
> +
> + hp_wmi_input_dev = input_allocate_device();
> +
> + hp_wmi_input_dev->name = "HP WMI hotkeys";
> + hp_wmi_input_dev->phys = "wmi/input0";
> + hp_wmi_input_dev->id.bustype = BUS_HOST;
> + hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
> + hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
> +
There is no sysfs device to attach the input device to, by any chance?
> + for (key = hp_wmi_keymap; key->type != KE_END; key++) {
> + set_bit(EV_KEY, hp_wmi_input_dev->evbit);
> + set_bit(key->keycode, hp_wmi_input_dev->keybit);
> + }
> +
> + err = input_register_device (hp_wmi_input_dev);
> +
> + if (err) {
> + input_free_device (hp_wmi_input_dev);
> + return err;
> + }
> +
> + return 0;
> +}
> +
> +static void __exit hp_wmi_exit(void)
> +{
> + wmi_remove_notify_handler();
> + input_unregister_device (hp_wmi_input_dev);
> + input_free_device (hp_wmi_input_dev);
Do not call input_free_device after input_unregister_device, it may
cause freeing already freed memory.
--
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-03 16:58 ` Dmitry Torokhov
@ 2008-01-14 17:41 ` Matthew Garrett
2008-01-14 18:27 ` Carlos Corbacho
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Garrett @ 2008-01-14 17:41 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Carlos Corbacho, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Thu, Jan 03, 2008 at 11:58:02AM -0500, Dmitry Torokhov wrote:
> There is no sysfs device to attach the input device to, by any chance?
Not as far as I can tell, but I may be misinterpreting this. Carlos?
I've fixed up the other bits and updated it to match the latest WMI
code. I've also added a couple of extra key events. The main one I'm
worried about is KEY_WLAN. The button automatically disables the
hardware, so it's not required that userspace do anything - however, it
would be nice for network-manager to get the additional notification. Is
KEY_WLAN the correct thing to be sending here? There's the added
confusion of it also triggering the removal of the bluetooth hardware,
but since the entire device vanishes in that case I think userspace will
already notice.
Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 8f5c7b9..6a6dd9a 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -183,4 +183,13 @@ config HP_SDC_RTC
Say Y here if you want to support the built-in real time clock
of the HP SDC controller.
+config INPUT_HP_WMI
+ tristate "HP WMI hotkey interface"
+ depends on ACPI_WMI
+ help
+ Say Y here if you want to support WMI-based hotkeys on HP laptops.
+
+ To compile this driver as a module, choose M here: the module will
+ be called hp_wmiinput.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 3585b50..8a3bf11 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
+obj-$(CONFIG_INPUT_HP_WMI) += hp_wmiinput.o
\ No newline at end of file
diff --git a/drivers/input/misc/hp_wmiinput.c b/drivers/input/misc/hp_wmiinput.c
new file mode 100644
index 0000000..85da258
--- /dev/null
+++ b/drivers/input/misc/hp_wmiinput.c
@@ -0,0 +1,191 @@
+/*
+ * HP WMI hotkeys
+ *
+ * Copyright (C) 2007 Matthew Garrett <mjg59@srcf.ucam.org>
+ *
+ * Portions based on wistron_btns.c:
+ * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
+ * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
+ * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/input.h>
+#include <acpi/acpi_drivers.h>
+
+MODULE_AUTHOR("Matthew Garrett");
+MODULE_DESCRIPTION("HP laptop WMI hotkeys driver");
+MODULE_LICENSE("GPL");
+
+MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
+
+#define HPWMI_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
+
+struct key_entry {
+ char type; /* See KE_* below */
+ u8 code;
+ union {
+ u16 keycode; /* For KE_KEY */
+ struct { /* For KE_SW */
+ u8 code;
+ u8 value;
+ } sw;
+ };
+};
+
+enum {KE_KEY, KE_END };
+
+static struct key_entry hp_wmi_keymap[] = {
+ /* 0x01 seems to be docking stations? */
+ { KE_KEY, 0x02, {KEY_BRIGHTNESSUP} },
+ { KE_KEY, 0x03, {KEY_BRIGHTNESSDOWN} },
+ { KE_KEY, 0x04, {KEY_HELP} },
+ { KE_KEY, 0x05, {KEY_WLAN} },
+ { KE_END, 0 }
+};
+
+static struct input_dev *hp_wmi_input_dev;
+
+static struct key_entry *hp_wmi_get_entry_by_scancode (int code)
+{
+ struct key_entry *key;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++)
+ if (code == key->code)
+ return key;
+
+ return NULL;
+}
+
+static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
+{
+ struct key_entry *key;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++)
+ if (key->type == KE_KEY && keycode == key->keycode)
+ return key;
+
+ return NULL;
+}
+
+static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+{
+ struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
+
+ if (key && key->type == KE_KEY) {
+ *keycode = key->keycode;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
+{
+ struct key_entry *key;
+
+ int old_keycode;
+
+ if (keycode < 0 || keycode > KEY_MAX)
+ return -EINVAL;
+
+ key = hp_wmi_get_entry_by_scancode(scancode);
+ if (key && key->type == KE_KEY) {
+ old_keycode = key->keycode;
+ key->keycode = keycode;
+ set_bit(keycode, dev->keybit);
+ if (!hp_wmi_get_entry_by_keycode(old_keycode))
+ clear_bit(old_keycode, dev->keybit);
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+void hp_wmi_notify (u32 value, void* context)
+{
+ struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
+ static struct key_entry *key;
+ union acpi_object *obj;
+
+ wmi_get_event_data (value, &response);
+
+ obj = (union acpi_object *) response.pointer;
+
+ if (obj && obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == 8) {
+ int eventcode = *((u8 *) obj->buffer.pointer);
+ key = hp_wmi_get_entry_by_scancode (eventcode);
+ if (key) {
+ input_report_key (hp_wmi_input_dev, key->keycode, 1);
+ input_sync (hp_wmi_input_dev);
+ input_report_key (hp_wmi_input_dev, key->keycode, 0);
+ input_sync (hp_wmi_input_dev);
+ } else
+ printk (KERN_INFO "HP WMI: Unknown key pressed - %x\n",
+ eventcode);
+ } else
+ printk (KERN_INFO "HP WMI: Unknown response received\n");
+}
+
+static int __init hp_wmi_init(void)
+{
+ int err;
+ const struct key_entry *key;
+
+ if (!wmi_has_guid(HPWMI_GUID)) {
+ printk ("Unable to locate guid\n");
+ return -ENODEV;
+ }
+
+ err = wmi_install_notify_handler (HPWMI_GUID, hp_wmi_notify, NULL);
+ if (err)
+ return err;
+
+ hp_wmi_input_dev = input_allocate_device();
+
+ hp_wmi_input_dev->name = "HP WMI hotkeys";
+ hp_wmi_input_dev->phys = "wmi/input0";
+ hp_wmi_input_dev->id.bustype = BUS_HOST;
+ hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
+ hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
+
+ for (key = hp_wmi_keymap; key->type != KE_END; key++) {
+ set_bit(EV_KEY, hp_wmi_input_dev->evbit);
+ set_bit(key->keycode, hp_wmi_input_dev->keybit);
+ }
+
+ err = input_register_device (hp_wmi_input_dev);
+
+ if (err) {
+ input_free_device (hp_wmi_input_dev);
+ return err;
+ }
+
+ return 0;
+}
+
+static void __exit hp_wmi_exit(void)
+{
+ wmi_remove_notify_handler(HPWMI_GUID);
+ input_unregister_device (hp_wmi_input_dev);
+}
+
+module_init(hp_wmi_init);
+module_exit(hp_wmi_exit);
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-14 17:41 ` [PATCH, RFC] HP WMI hotkey driver, RFKill query? Matthew Garrett
@ 2008-01-14 18:27 ` Carlos Corbacho
2008-01-14 22:25 ` Carlos Corbacho
0 siblings, 1 reply; 10+ messages in thread
From: Carlos Corbacho @ 2008-01-14 18:27 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dmitry Torokhov, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Monday 14 January 2008 17:41:07 Matthew Garrett wrote:
> On Thu, Jan 03, 2008 at 11:58:02AM -0500, Dmitry Torokhov wrote:
>
> > There is no sysfs device to attach the input device to, by any chance?
>
> Not as far as I can tell, but I may be misinterpreting this. Carlos?
Correct. What, if anything, should/ could WMI export here?
-Carlos
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-14 18:27 ` Carlos Corbacho
@ 2008-01-14 22:25 ` Carlos Corbacho
2008-01-15 20:54 ` Dmitry Torokhov
0 siblings, 1 reply; 10+ messages in thread
From: Carlos Corbacho @ 2008-01-14 22:25 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dmitry Torokhov, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Monday 14 January 2008 18:27:33 Carlos Corbacho wrote:
> On Monday 14 January 2008 17:41:07 Matthew Garrett wrote:
> > On Thu, Jan 03, 2008 at 11:58:02AM -0500, Dmitry Torokhov wrote:
> > > There is no sysfs device to attach the input device to, by any chance?
> >
> > Not as far as I can tell, but I may be misinterpreting this. Carlos?
What would be better - to have WMI itself as the parent device, or should I
add something like this to WMI:
wmi_get_dev(const char *guid, struct device *dev)
to return the virtual device associated with a GUID, and then allow that to be
used as the parent? (trade off is that this driver would then become
dependent on the WMI sysfs patch going in as well, rather than just on the
in-kernel WMI support).
-Carlos
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-14 22:25 ` Carlos Corbacho
@ 2008-01-15 20:54 ` Dmitry Torokhov
2008-01-16 1:38 ` Carlos Corbacho
0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2008-01-15 20:54 UTC (permalink / raw)
To: Carlos Corbacho
Cc: Matthew Garrett, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Mon, Jan 14, 2008 at 10:25:10PM +0000, Carlos Corbacho wrote:
> On Monday 14 January 2008 18:27:33 Carlos Corbacho wrote:
> > On Monday 14 January 2008 17:41:07 Matthew Garrett wrote:
> > > On Thu, Jan 03, 2008 at 11:58:02AM -0500, Dmitry Torokhov wrote:
> > > > There is no sysfs device to attach the input device to, by any chance?
> > >
> > > Not as far as I can tell, but I may be misinterpreting this. Carlos?
>
> What would be better - to have WMI itself as the parent device, or should I
> add something like this to WMI:
>
> wmi_get_dev(const char *guid, struct device *dev)
>
> to return the virtual device associated with a GUID, and then allow that to be
> used as the parent? (trade off is that this driver would then become
> dependent on the WMI sysfs patch going in as well, rather than just on the
> in-kernel WMI support).
>
If there is a [planned] WMI sysfs device then I think input device should
use it to form proper sysfs hierarchy. What are the roadblocks for getting
WMI sysfs in?
--
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-15 20:54 ` Dmitry Torokhov
@ 2008-01-16 1:38 ` Carlos Corbacho
2008-01-16 1:49 ` Matthew Garrett
2008-02-07 3:54 ` Len Brown
0 siblings, 2 replies; 10+ messages in thread
From: Carlos Corbacho @ 2008-01-16 1:38 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthew Garrett, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Tuesday 15 January 2008 20:54:29 Dmitry Torokhov wrote:
> If there is a [planned] WMI sysfs device then I think input device should
> use it to form proper sysfs hierarchy. What are the roadblocks for getting
> WMI sysfs in?
The question is, would exporting the GUID virtual device and using that as the
parent make more sense? So, in the case of hp-wmi, it only uses the GUID
95F24279-4D7B-4334-9387-ACCDC67EF61C, so should we use the virtual device
associated with that GUID as the parent, or just have WMI itself as the
parent device? I'm really not sure which would be the better way to go.
Unfortunately, as you can see, a GUID is a 36 character string, which is
longer than the current 20 byte length of bus_id in a 'struct device'; so
either we have to have a temporary hack to shorten the GUID length when
creating the device, or wait for bus_id to switch to a variable length
(although it's not certain if this change will hit 2.6.25, or will be put off
until 2.6.26).
-Carlos
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-16 1:38 ` Carlos Corbacho
@ 2008-01-16 1:49 ` Matthew Garrett
2008-02-07 3:54 ` Len Brown
1 sibling, 0 replies; 10+ messages in thread
From: Matthew Garrett @ 2008-01-16 1:49 UTC (permalink / raw)
To: Carlos Corbacho
Cc: Dmitry Torokhov, linux-acpi, Len Brown, Alexey Starikovskiy,
linux-input
On Wed, Jan 16, 2008 at 01:38:35AM +0000, Carlos Corbacho wrote:
> The question is, would exporting the GUID virtual device and using that as the
> parent make more sense? So, in the case of hp-wmi, it only uses the GUID
> 95F24279-4D7B-4334-9387-ACCDC67EF61C, so should we use the virtual device
> associated with that GUID as the parent, or just have WMI itself as the
> parent device? I'm really not sure which would be the better way to go.
It's possible for a driver to bind itself to multiple GUIDs, and I guess
it's /potentially/ possible for a machine to have multiple event GUIDs.
I'm not sure whether those should be created as separate input devices,
or whether it would make sense for a driver to bind them into a single
input driver. If the latter, wmi probably ought to be the parent?
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-01-16 1:38 ` Carlos Corbacho
2008-01-16 1:49 ` Matthew Garrett
@ 2008-02-07 3:54 ` Len Brown
2008-02-08 15:26 ` Carlos Corbacho
1 sibling, 1 reply; 10+ messages in thread
From: Len Brown @ 2008-02-07 3:54 UTC (permalink / raw)
To: Carlos Corbacho
Cc: Dmitry Torokhov, Matthew Garrett, linux-acpi, Alexey Starikovskiy,
linux-input
On Tuesday 15 January 2008 20:38, Carlos Corbacho wrote:
> On Tuesday 15 January 2008 20:54:29 Dmitry Torokhov wrote:
> > If there is a [planned] WMI sysfs device then I think input device should
> > use it to form proper sysfs hierarchy. What are the roadblocks for getting
> > WMI sysfs in?
>
> The question is, would exporting the GUID virtual device and using that as the
> parent make more sense? So, in the case of hp-wmi, it only uses the GUID
> 95F24279-4D7B-4334-9387-ACCDC67EF61C, so should we use the virtual device
> associated with that GUID as the parent, or just have WMI itself as the
> parent device? I'm really not sure which would be the better way to go.
Why not used generic names like dev0, dev1 etc.
and have the guid be an attribute?
> Unfortunately, as you can see, a GUID is a 36 character string, which is
> longer than the current 20 byte length of bus_id in a 'struct device'; so
> either we have to have a temporary hack to shorten the GUID length when
> creating the device, or wait for bus_id to switch to a variable length
> (although it's not certain if this change will hit 2.6.25, or will be put off
> until 2.6.26).
>
> -Carlos
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH, RFC] HP WMI hotkey driver, RFKill query?
2008-02-07 3:54 ` Len Brown
@ 2008-02-08 15:26 ` Carlos Corbacho
0 siblings, 0 replies; 10+ messages in thread
From: Carlos Corbacho @ 2008-02-08 15:26 UTC (permalink / raw)
To: Len Brown
Cc: Dmitry Torokhov, Matthew Garrett, linux-acpi, Alexey Starikovskiy,
linux-input
On Thursday 07 February 2008 03:54:24 Len Brown wrote:
> > The question is, would exporting the GUID virtual device and using that
> > as the parent make more sense? So, in the case of hp-wmi, it only uses
> > the GUID 95F24279-4D7B-4334-9387-ACCDC67EF61C, so should we use the
> > virtual device associated with that GUID as the parent, or just have WMI
> > itself as the parent device? I'm really not sure which would be the
> > better way to go.
>
> Why not used generic names like dev0, dev1 etc.
> and have the guid be an attribute?
Well, we'll have the virtual devices for the GUIDs anyway once I re-spin the
relevant patch, so would it not be better to just reuse those, rather than
start adding new virtual devices?
-Carlos
--
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-02-08 15:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20071218235137.12838.75397.stgit@localhost>
2007-12-26 22:48 ` [PATCH, RFC] HP WMI hotkey driver Matthew Garrett
2008-01-03 16:58 ` Dmitry Torokhov
2008-01-14 17:41 ` [PATCH, RFC] HP WMI hotkey driver, RFKill query? Matthew Garrett
2008-01-14 18:27 ` Carlos Corbacho
2008-01-14 22:25 ` Carlos Corbacho
2008-01-15 20:54 ` Dmitry Torokhov
2008-01-16 1:38 ` Carlos Corbacho
2008-01-16 1:49 ` Matthew Garrett
2008-02-07 3:54 ` Len Brown
2008-02-08 15:26 ` Carlos Corbacho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).