linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC v2 1/8] modpost: add support for hid
@ 2008-04-27 11:48 Jiri Slaby
  2008-04-27 11:49 ` [RFC v2 2/8] HID: make a bus from hid code Jiri Slaby
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jiri Slaby @ 2008-04-27 11:48 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Dmitry Torokhov, linux-input, marcel, mit-devel, linux-kernel,
	anssi.hannula, Jiri Slaby

Hi,
	
I respun the patches, here comes the turn two.

v1..v2 diff:
- generating hid aliases in uevent, so that we can handle
  MODULE_DEVICE_TABLE(hid) directly. This also solves bluetooth modules
  autoloading. It needed rework of matching and hid_device_id table
  structure. BT and USB designator is needed for each table entry, that
  means three things: 1) bigger tables, 2) mod aliases might be handled
  smoothly, 3) tables might be mixed BT and USB or any other subsystem
  -- no longer table per subsystem is needed (but still possible).
- some bug fixes and cleanups

KNOWN ISSUES
- bus_id is ugly
- IGNORE_MOUSE leaves hid device allocated to wait for incoming driver
  (it's unbounded)
- report parsing is done only once. When a device needs special
  processing and e.g. generic driver grabbed the device before, the device
  is already parsed and unbind followed by bind to another driver won't
  trigger the new driver's report_fixup().
- untested with BT devices
- compat autoload method still missing

--

Generate aliases for hid device modules to support autoloading.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 include/linux/hid.h             |    1 +
 include/linux/mod_devicetable.h |    9 +++++++++
 scripts/mod/file2alias.c        |   18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index d951ec4..fe28e44 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -69,6 +69,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/list.h>
+#include <linux/mod_devicetable.h> /* hid_device_id */
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <linux/input.h>
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 139d49d..abb5da3 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,15 @@ struct usb_device_id {
 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS	0x0100
 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL	0x0200
 
+#define HID_ANY_ID				(~0)
+
+struct hid_device_id {
+	__u16 bus;
+	__u32 vendor;
+	__u32 product;
+	kernel_ulong_t driver_data;
+};
+
 /* s390 CCW devices */
 struct ccw_device_id {
 	__u16	match_flags;	/* which fields to match against */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 769b69d..03d5c8e 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -199,6 +199,20 @@ static void do_usb_table(void *symval, unsigned long size,
 		do_usb_entry_multi(symval + i, mod);
 }
 
+/* Looks like: hid:bNvNpN */
+static int do_hid_entry(const char *filename,
+			     struct hid_device_id *id, char *alias)
+{
+	id->vendor = TO_NATIVE(id->vendor);
+	id->product = TO_NATIVE(id->product);
+
+	sprintf(alias, "hid:b%04X", id->bus);
+	ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
+	ADD(alias, "p", id->product != HID_ANY_ID, id->product);
+
+	return 1;
+}
+
 /* Looks like: ieee1394:venNmoNspNverN */
 static int do_ieee1394_entry(const char *filename,
 			     struct ieee1394_device_id *id, char *alias)
@@ -642,6 +656,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 	else if (sym_is(symname, "__mod_usb_device_table"))
 		/* special case to handle bcdDevice ranges */
 		do_usb_table(symval, sym->st_size, mod);
+	else if (sym_is(symname, "__mod_hid_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct hid_device_id), "hid",
+			 do_hid_entry, mod);
 	else if (sym_is(symname, "__mod_ieee1394_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct ieee1394_device_id), "ieee1394",
-- 
1.5.4.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-05-06 21:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-27 11:48 [RFC v2 1/8] modpost: add support for hid Jiri Slaby
2008-04-27 11:49 ` [RFC v2 2/8] HID: make a bus from hid code Jiri Slaby
2008-05-06 21:25   ` Jiri Slaby
2008-04-27 11:49 ` [RFC v2 3/8] HID: hid, make parsing event driven Jiri Slaby
2008-04-27 11:49 ` [RFC v2 4/8] HID: move ids into separate file Jiri Slaby
2008-04-27 11:49 ` [RFC v2 5/8] HID: move usage input mapping to hid.h Jiri Slaby
2008-04-27 11:49 ` [RFC v2 6/8] HID: move logitech report quirks Jiri Slaby
2008-04-27 11:49 ` [RFC v2 7/8] HID: move ignore quirks Jiri Slaby
2008-04-27 11:49 ` [RFC v2 8/8] HID: move apple quirks Jiri Slaby

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).