* [PATCH v2 0/6] hid: Introduce device groups
@ 2012-04-22 6:05 Henrik Rydberg
2012-04-22 6:05 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw)
To: Jiri Kosina
Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty,
linux-input, linux-kernel, Henrik Rydberg
Hi all,
Here is the second version of the extension to the device-driver
matching mechanism. The previous version did not work well with
out-of-tree drivers. The default group handling was backwards, so I
had better list the right behavior here for easier review. For
starters, drivers belong to one of these groups:
HID_GROUP_ANY - The default for all drivers. Matches any device.
HID_GROUP_GENERIC - The generic drivers. Matches generic devices only.
HID_GROUP_MULTITOUCH - The MT driver. Matches MT devices only.
A HID device is placed in one of the above groups during device
add. The logic is determined by the hid core. It does not matter to
userland which group a device belongs to, because all out-of-tree
drivers and all dynamic device ids belong to the default group, which
matches any device. The device groups only steer udev to the right
module, without loss of generality. In fact, switching drivers in
userland is simplified.
A known outstanding issue is the rebinding of a hid device to a driver
that affects the report parsing. I am currently testing a patchset for
it, which should go in before this one. However, since it is largely
orthogonal, and it seems the present patchset does the right thing
with regards to everything else, I thought I'd give it another spin
first.
The patches apply to 3.4-rc3; final version will apply for next.
Enjoy,
Henrik
Henrik Rydberg (6):
hid: Add device group to modalias
hid: Parse the device before adding it
hid: Create a generic device group
hid: Allow bus wildcard matching
hid-multitouch: Switch to device groups
hid-multitouch: Remove remnant quirk handling
drivers/hid/hid-core.c | 130 ++++++++++++++-------------------------
drivers/hid/hid-input.c | 11 ----
drivers/hid/hid-multitouch.c | 3 +-
drivers/hid/usbhid/hid-core.c | 2 +-
include/linux/hid.h | 20 +++---
include/linux/mod_devicetable.h | 4 +-
net/bluetooth/hidp/core.c | 2 +-
scripts/mod/file2alias.c | 5 +-
8 files changed, 71 insertions(+), 106 deletions(-)
--
1.7.10
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 1/6] hid: Add device group to modalias 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 2/6] hid: Parse the device before adding it Henrik Rydberg ` (4 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg HID devices are only partially presented to userland. Hotplugged devices emit events containing a modalias based on the basic bus, vendor and product entities. However, in practise a hid device can depend on details such as a single usb interface or a particular item in a report descriptor. This patch adds a device group to the hid device id, and broadcasts it using uevent and the device modalias. The module alias generation is modified to match. As a consequence, a device with a non-zero group will be processed by the corresponding group driver instead of by the generic hid driver. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 24 ++++++++++++++++++++++-- include/linux/hid.h | 1 + include/linux/mod_devicetable.h | 3 ++- scripts/mod/file2alias.c | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 4da66b4..3ed13b4 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1159,6 +1159,7 @@ static bool hid_match_one_id(struct hid_device *hdev, const struct hid_device_id *id) { return id->bus == hdev->bus && + (id->group == HID_GROUP_ANY || id->group == hdev->group) && (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && (id->product == HID_ANY_ID || id->product == hdev->product); } @@ -1631,6 +1632,7 @@ static ssize_t store_new_id(struct device_driver *drv, const char *buf, return -ENOMEM; dynid->id.bus = bus; + dynid->id.group = HID_GROUP_ANY; dynid->id.vendor = vendor; dynid->id.product = product; dynid->id.driver_data = driver_data; @@ -1751,6 +1753,23 @@ static int hid_device_remove(struct device *dev) return 0; } +static ssize_t modalias_show(struct device *dev, struct device_attribute *a, + char *buf) +{ + struct hid_device *hdev = container_of(dev, struct hid_device, dev); + int len; + + len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n", + hdev->bus, hdev->group, hdev->vendor, hdev->product); + + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; +} + +static struct device_attribute hid_dev_attrs[] = { + __ATTR_RO(modalias), + __ATTR_NULL, +}; + static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) { struct hid_device *hdev = container_of(dev, struct hid_device, dev); @@ -1768,8 +1787,8 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) return -ENOMEM; - if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", - hdev->bus, hdev->vendor, hdev->product)) + if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X", + hdev->bus, hdev->group, hdev->vendor, hdev->product)) return -ENOMEM; return 0; @@ -1777,6 +1796,7 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) static struct bus_type hid_bus_type = { .name = "hid", + .dev_attrs = hid_dev_attrs, .match = hid_bus_match, .probe = hid_device_probe, .remove = hid_device_remove, diff --git a/include/linux/hid.h b/include/linux/hid.h index 3a95da6..85871f7 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -474,6 +474,7 @@ struct hid_device { /* device report descriptor */ unsigned maxcollection; /* Number of parsed collections */ unsigned maxapplication; /* Number of applications */ __u16 bus; /* BUS ID */ + __u16 group; /* Report group */ __u32 vendor; /* Vendor ID */ __u32 product; /* Product ID */ __u32 version; /* HID version */ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 501da4c..55ed0b0 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -132,10 +132,11 @@ struct usb_device_id { #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define HID_ANY_ID (~0) +#define HID_GROUP_ANY 0x0000 struct hid_device_id { __u16 bus; - __u16 pad1; + __u16 group; __u32 vendor; __u32 product; kernel_ulong_t driver_data diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8e730cc..fe967ce 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -336,10 +336,12 @@ static int do_hid_entry(const char *filename, struct hid_device_id *id, char *alias) { id->bus = TO_NATIVE(id->bus); + id->group = TO_NATIVE(id->group); id->vendor = TO_NATIVE(id->vendor); id->product = TO_NATIVE(id->product); sprintf(alias, "hid:b%04X", id->bus); + ADD(alias, "g", id->group != HID_GROUP_ANY, id->group); ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); ADD(alias, "p", id->product != HID_ANY_ID, id->product); -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/6] hid: Parse the device before adding it 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 3/6] hid: Create a generic device group Henrik Rydberg ` (3 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg The hid bus is populated by devices created by the usb and bluetooth subsystems. The hid device is then broadcast to userland via uevents. Currently, the parsing of the hid reports is done during probe of the hid device, after the device has been broadcast. In order to allow for the report descriptors to influence the device properties, it is desirable to parse the device _before_ it is broadcast to userland. Specific in-kernel device drivers, in particular those with report fixup routines, are not affected by this patch. Out-of-tree drivers with fixups is a known issue still to be addressed. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 3ed13b4..5378cf6 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -662,7 +662,7 @@ int hid_parse_report(struct hid_device *device, __u8 *start, hid_parser_reserved }; - if (device->driver->report_fixup) + if (device->driver && device->driver->report_fixup) start = device->driver->report_fixup(device, start, &size); device->rdesc = kmemdup(start, size, GFP_KERNEL); @@ -2095,6 +2095,17 @@ int hid_add_device(struct hid_device *hdev) && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE))) return -ENODEV; + /* + * Parse generically handled devices early to allow for + * report-defined device groups. + */ + if (hid_ignore_special_drivers || + !hid_match_id(hdev, hid_have_special_driver)) { + ret = hid_parse(hdev); + if (ret) + return ret; + } + /* XXX hack, any other cleaner solution after the driver core * is converted to allow more than 20 bytes as the device name? */ dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/6] hid: Create a generic device group 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 2/6] hid: Parse the device before adding it Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 4/6] hid: Allow bus wildcard matching Henrik Rydberg ` (2 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg Devices that do not have a special driver are handled by the generic driver. This patch does the same thing using device groups; Instead of forcing a particular driver, the appropriate driver is picked up by udev. As a consequence, one can now move a device from generic to specific handling by a simple rebind. By adding a new device id to the generic driver, the same thing can be done in reverse. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 14 ++++++-------- drivers/hid/usbhid/hid-core.c | 2 +- include/linux/hid.h | 17 +++++++++++------ net/bluetooth/hidp/core.c | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 5378cf6..32a40879 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1685,14 +1685,7 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv) !strncmp(hdrv->name, "hid-multitouch", 14)) return 1; - if (!hid_match_device(hdev, hdrv)) - return 0; - - /* generic wants all that don't have specialized driver */ - if (!strncmp(hdrv->name, "generic-", 8) && !hid_ignore_special_drivers) - return !hid_match_id(hdev, hid_have_special_driver); - - return 1; + return hid_match_device(hdev, hdrv) != NULL; } static int hid_device_probe(struct device *dev) @@ -2104,6 +2097,11 @@ int hid_add_device(struct hid_device *hdev) ret = hid_parse(hdev); if (ret) return ret; + /* + * Generic handler picks up all non-assigned devices. + */ + if (hdev->group == HID_GROUP_ANY) + hdev->group = HID_GROUP_GENERIC; } /* XXX hack, any other cleaner solution after the driver core diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 5bf91db..9abf718 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1505,7 +1505,7 @@ static struct usb_driver hid_driver = { }; static const struct hid_device_id hid_usb_table[] = { - { HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) }, + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, HID_ANY_ID, HID_ANY_ID) }, { } }; diff --git a/include/linux/hid.h b/include/linux/hid.h index 85871f7..96197f7 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -325,6 +325,11 @@ struct hid_item { #define HID_QUIRK_NO_INPUT_SYNC 0x80000000 /* + * HID device groups + */ +#define HID_GROUP_GENERIC 0x0001 + +/* * This is the global environment of the parser. This information is * persistent for main-items. The global environment can be saved and * restored with PUSH/POP statements. @@ -579,12 +584,12 @@ struct hid_descriptor { struct hid_class_descriptor desc[1]; } __attribute__ ((packed)); -#define HID_DEVICE(b, ven, prod) \ - .bus = (b), \ - .vendor = (ven), .product = (prod) - -#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) -#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) +#define HID_DEVICE(b, g, ven, prod) \ + .bus = (b), .group = (g), .vendor = (ven), .product = (prod) +#define HID_USB_DEVICE(ven, prod) \ + .bus = BUS_USB, .vendor = (ven), .product = (prod) +#define HID_BLUETOOTH_DEVICE(ven, prod) \ + .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod) #define HID_REPORT_ID(rep) \ .report_type = (rep) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index d478be1..b6fa982 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -1196,7 +1196,7 @@ int hidp_get_conninfo(struct hidp_conninfo *ci) } static const struct hid_device_id hidp_table[] = { - { HID_BLUETOOTH_DEVICE(HID_ANY_ID, HID_ANY_ID) }, + { HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_GENERIC, HID_ANY_ID, HID_ANY_ID) }, { } }; -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 4/6] hid: Allow bus wildcard matching 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg ` (2 preceding siblings ...) 2012-04-22 6:05 ` [PATCH v2 3/6] hid: Create a generic device group Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 5/6] hid-multitouch: Switch to device groups Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 6/6] hid-multitouch: Remove remnant quirk handling Henrik Rydberg 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg Most HID drivers do not need to know what bus driver is in use. A generic group driver can drive any hid device, and the device list should not need to be duplicated for each new bus. This patch adds wildcard matching to the HID bus, simplifying device list handling for group drivers. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 2 +- include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 32a40879..5546426 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1158,7 +1158,7 @@ EXPORT_SYMBOL_GPL(hid_input_report); static bool hid_match_one_id(struct hid_device *hdev, const struct hid_device_id *id) { - return id->bus == hdev->bus && + return (id->bus == HID_BUS_ANY || id->bus == hdev->bus) && (id->group == HID_GROUP_ANY || id->group == hdev->group) && (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && (id->product == HID_ANY_ID || id->product == hdev->product); diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 55ed0b0..5db9382 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -132,6 +132,7 @@ struct usb_device_id { #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define HID_ANY_ID (~0) +#define HID_BUS_ANY 0xffff #define HID_GROUP_ANY 0x0000 struct hid_device_id { diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index fe967ce..056de31 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -340,7 +340,8 @@ static int do_hid_entry(const char *filename, id->vendor = TO_NATIVE(id->vendor); id->product = TO_NATIVE(id->product); - sprintf(alias, "hid:b%04X", id->bus); + sprintf(alias, "hid:"); + ADD(alias, "b", id->bus != HID_BUS_ANY, id->bus); ADD(alias, "g", id->group != HID_GROUP_ANY, id->group); ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); ADD(alias, "p", id->product != HID_ANY_ID, id->product); -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 5/6] hid-multitouch: Switch to device groups 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg ` (3 preceding siblings ...) 2012-04-22 6:05 ` [PATCH v2 4/6] hid: Allow bus wildcard matching Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 6/6] hid-multitouch: Remove remnant quirk handling Henrik Rydberg 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg Switch the driver over to device group handling. As a consequence, generic hid will no longer match multitouch devices, and udev will automatically load hid-multitouch instead. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 62 +++--------------------------------------- drivers/hid/hid-input.c | 4 --- drivers/hid/hid-multitouch.c | 2 ++ include/linux/hid.h | 1 + 4 files changed, 7 insertions(+), 62 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 5546426..748e871 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -209,6 +209,10 @@ static int hid_add_usage(struct hid_parser *parser, unsigned usage) parser->collection_stack_ptr ? parser->collection_stack[parser->collection_stack_ptr - 1] : 0; parser->local.usage_index++; + + if (usage == HID_DG_CONTACTID) + parser->device->group = HID_GROUP_MULTITOUCH; + return 0; } @@ -1315,13 +1319,10 @@ EXPORT_SYMBOL_GPL(hid_disconnect); /* a list of devices for which there is a specialized driver on HID bus */ static const struct hid_device_id hid_have_special_driver[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, - { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, USB_DEVICE_ID_ACTIONSTAR_1011) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, @@ -1386,60 +1387,32 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, - { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) }, { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_FRUCTEL, USB_DEVICE_ID_GAMETEL_MT_MODE) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, - { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH, USB_DEVICE_ID_GOODTOUCH_000f) }, { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6650) }, { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ILITEK, USB_DEVICE_ID_ILITEK_MULTITOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS, USB_DEVICE_ID_IRTOUCH_INFRARED_USB) }, { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, @@ -1448,7 +1421,6 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MULTITOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, @@ -1481,8 +1453,6 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LUMIO, USB_DEVICE_ID_CRYSTALTOUCH_DUAL) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, @@ -1514,15 +1484,8 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT780) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT880) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_PCI) }, { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, - { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, @@ -1539,9 +1502,6 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) }, { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, @@ -1555,16 +1515,12 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UNITEC, USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, @@ -1579,16 +1535,6 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX2) }, - { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 002781c..62d13ee 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -638,10 +638,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel map_key_clear(BTN_STYLUS2); break; - case 0x51: /* ContactID */ - device->quirks |= HID_QUIRK_MULTITOUCH; - goto unknown; - default: goto unknown; } break; diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 1d5b941..06153ee 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -999,6 +999,8 @@ static const struct hid_device_id mt_devices[] = { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, + /* Generic MT device */ + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, { } }; MODULE_DEVICE_TABLE(hid, mt_devices); diff --git a/include/linux/hid.h b/include/linux/hid.h index 96197f7..978b744 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -328,6 +328,7 @@ struct hid_item { * HID device groups */ #define HID_GROUP_GENERIC 0x0001 +#define HID_GROUP_MULTITOUCH 0x0002 /* * This is the global environment of the parser. This information is -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 6/6] hid-multitouch: Remove remnant quirk handling 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg ` (4 preceding siblings ...) 2012-04-22 6:05 ` [PATCH v2 5/6] hid-multitouch: Switch to device groups Henrik Rydberg @ 2012-04-22 6:05 ` Henrik Rydberg 5 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-22 6:05 UTC (permalink / raw) To: Jiri Kosina Cc: Dmitry Torokhov, Benjamin Tissoires, Stephane Chatty, linux-input, linux-kernel, Henrik Rydberg With device groups in place, the temporary HID_QUIRK_MULTITOUCH quirk is no longer used and can be removed. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 15 ++------------- drivers/hid/hid-input.c | 7 ------- drivers/hid/hid-multitouch.c | 1 - include/linux/hid.h | 1 - 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 748e871..9ec2557 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1239,10 +1239,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, connect_mask & HID_CONNECT_HIDINPUT_FORCE)) hdev->claimed |= HID_CLAIMED_INPUT; - if (hdev->quirks & HID_QUIRK_MULTITOUCH) { - /* this device should be handled by hid-multitouch, skip it */ - return -ENODEV; - } if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && !hdev->hiddev_connect(hdev, @@ -1627,10 +1623,6 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv) struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); struct hid_device *hdev = container_of(dev, struct hid_device, dev); - if ((hdev->quirks & HID_QUIRK_MULTITOUCH) && - !strncmp(hdrv->name, "hid-multitouch", 14)) - return 1; - return hid_match_device(hdev, hdrv) != NULL; } @@ -1648,11 +1640,8 @@ static int hid_device_probe(struct device *dev) if (!hdev->driver) { id = hid_match_device(hdev, hdrv); if (id == NULL) { - if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) && - !strncmp(hdrv->name, "hid-multitouch", 14))) { - ret = -ENODEV; - goto unlock; - } + ret = -ENODEV; + goto unlock; } hdev->driver = hdrv; diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 62d13ee..7b43186 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1204,13 +1204,6 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) } } - if (hid->quirks & HID_QUIRK_MULTITOUCH) { - /* generic hid does not know how to handle multitouch devices */ - if (hidinput) - goto out_cleanup; - goto out_unwind; - } - if (hidinput && input_register_device(hidinput->input)) goto out_cleanup; diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 06153ee..125c1e7 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -654,7 +654,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) * that emit events over several HID messages. */ hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; - hdev->quirks &= ~HID_QUIRK_MULTITOUCH; td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); if (!td) { diff --git a/include/linux/hid.h b/include/linux/hid.h index 978b744..51626dd 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -317,7 +317,6 @@ struct hid_item { #define HID_QUIRK_BADPAD 0x00000020 #define HID_QUIRK_MULTI_INPUT 0x00000040 #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 -#define HID_QUIRK_MULTITOUCH 0x00000100 #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 0/6] hid: Introduce device groups @ 2012-04-23 10:07 Henrik Rydberg 2012-04-23 10:07 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg 0 siblings, 1 reply; 8+ messages in thread From: Henrik Rydberg @ 2012-04-23 10:07 UTC (permalink / raw) To: Jiri Kosina; +Cc: Dmitry Torokhov, linux-input, linux-kernel, Henrik Rydberg Hi Jiri, Here is the third version of the extension to the device-driver matching mechanism. AFAICT, there are no outstanding issues. I think we are getting close. :-) Building on the report fixup patches, this patchset brings a bit of transparency to the hid bus, by the addition of device groups. This allows a more versatile handling of hid drivers in userland, and simplifies the logic in the kernel. In particular, there can be one generic module per device group, and those modules are handled automatically by udev. Dynamic rebinding of drivers is fully supported. For instance, to load a special out-of-tree driver instead of the a generic one, simply unbind the device and load the new module. One can also keep _all_ generic drivers as modules, significantly simplifying the process of adding and testing new features. And, of course, auto-loading of new multitouch drivers works, since that was what triggered this patchset to begin with. :-) The second patch contains a simple descriptor scanner that is new. The last patch unifies the generic drivers into a single, loadable module. Enjoy, Henrik Henrik Rydberg (6): hid: Add device group to modalias hid: Scan the device for group info before adding it hid: Allow bus wildcard matching hid: Create a generic device group hid-multitouch: Switch to device groups hid: Create a common generic driver drivers/hid/Kconfig | 12 +++ drivers/hid/Makefile | 2 + drivers/hid/hid-core.c | 172 ++++++++++++++++++++------------------- drivers/hid/hid-generic.c | 53 ++++++++++++ drivers/hid/hid-input.c | 11 --- drivers/hid/hid-multitouch.c | 3 +- drivers/hid/usbhid/hid-core.c | 16 ---- include/linux/hid.h | 20 +++-- include/linux/mod_devicetable.h | 4 +- net/bluetooth/hidp/core.c | 27 +----- scripts/mod/file2alias.c | 5 +- 11 files changed, 180 insertions(+), 145 deletions(-) create mode 100644 drivers/hid/hid-generic.c -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/6] hid: Add device group to modalias 2012-04-23 10:07 [PATCH v3 0/6] hid: Introduce device groups Henrik Rydberg @ 2012-04-23 10:07 ` Henrik Rydberg 0 siblings, 0 replies; 8+ messages in thread From: Henrik Rydberg @ 2012-04-23 10:07 UTC (permalink / raw) To: Jiri Kosina; +Cc: Dmitry Torokhov, linux-input, linux-kernel, Henrik Rydberg HID devices are only partially presented to userland. Hotplugged devices emit events containing a modalias based on the basic bus, vendor and product entities. However, in practise a hid device can depend on details such as a single usb interface or a particular item in a report descriptor. This patch adds a device group to the hid device id, and broadcasts it using uevent and the device modalias. The module alias generation is modified to match. As a consequence, a device with a non-zero group will be processed by the corresponding group driver instead of by the generic hid driver. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- drivers/hid/hid-core.c | 24 ++++++++++++++++++++++-- include/linux/hid.h | 1 + include/linux/mod_devicetable.h | 3 ++- scripts/mod/file2alias.c | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 9ed4ff3..cfcb69e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1222,6 +1222,7 @@ static bool hid_match_one_id(struct hid_device *hdev, const struct hid_device_id *id) { return id->bus == hdev->bus && + (id->group == HID_GROUP_ANY || id->group == hdev->group) && (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && (id->product == HID_ANY_ID || id->product == hdev->product); } @@ -1694,6 +1695,7 @@ static ssize_t store_new_id(struct device_driver *drv, const char *buf, return -ENOMEM; dynid->id.bus = bus; + dynid->id.group = HID_GROUP_ANY; dynid->id.vendor = vendor; dynid->id.product = product; dynid->id.driver_data = driver_data; @@ -1817,6 +1819,23 @@ static int hid_device_remove(struct device *dev) return 0; } +static ssize_t modalias_show(struct device *dev, struct device_attribute *a, + char *buf) +{ + struct hid_device *hdev = container_of(dev, struct hid_device, dev); + int len; + + len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n", + hdev->bus, hdev->group, hdev->vendor, hdev->product); + + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; +} + +static struct device_attribute hid_dev_attrs[] = { + __ATTR_RO(modalias), + __ATTR_NULL, +}; + static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) { struct hid_device *hdev = container_of(dev, struct hid_device, dev); @@ -1834,8 +1853,8 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) return -ENOMEM; - if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", - hdev->bus, hdev->vendor, hdev->product)) + if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X", + hdev->bus, hdev->group, hdev->vendor, hdev->product)) return -ENOMEM; return 0; @@ -1843,6 +1862,7 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) static struct bus_type hid_bus_type = { .name = "hid", + .dev_attrs = hid_dev_attrs, .match = hid_bus_match, .probe = hid_device_probe, .remove = hid_device_remove, diff --git a/include/linux/hid.h b/include/linux/hid.h index d8e7cc7..a0e27dd 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -476,6 +476,7 @@ struct hid_device { /* device report descriptor */ unsigned maxcollection; /* Number of parsed collections */ unsigned maxapplication; /* Number of applications */ __u16 bus; /* BUS ID */ + __u16 group; /* Report group */ __u32 vendor; /* Vendor ID */ __u32 product; /* Product ID */ __u32 version; /* HID version */ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 501da4c..55ed0b0 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -132,10 +132,11 @@ struct usb_device_id { #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define HID_ANY_ID (~0) +#define HID_GROUP_ANY 0x0000 struct hid_device_id { __u16 bus; - __u16 pad1; + __u16 group; __u32 vendor; __u32 product; kernel_ulong_t driver_data diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8e730cc..fe967ce 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -336,10 +336,12 @@ static int do_hid_entry(const char *filename, struct hid_device_id *id, char *alias) { id->bus = TO_NATIVE(id->bus); + id->group = TO_NATIVE(id->group); id->vendor = TO_NATIVE(id->vendor); id->product = TO_NATIVE(id->product); sprintf(alias, "hid:b%04X", id->bus); + ADD(alias, "g", id->group != HID_GROUP_ANY, id->group); ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); ADD(alias, "p", id->product != HID_ANY_ID, id->product); -- 1.7.10 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-04-23 10:03 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-22 6:05 [PATCH v2 0/6] hid: Introduce device groups Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 2/6] hid: Parse the device before adding it Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 3/6] hid: Create a generic device group Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 4/6] hid: Allow bus wildcard matching Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 5/6] hid-multitouch: Switch to device groups Henrik Rydberg 2012-04-22 6:05 ` [PATCH v2 6/6] hid-multitouch: Remove remnant quirk handling Henrik Rydberg 2012-04-23 10:07 [PATCH v3 0/6] hid: Introduce device groups Henrik Rydberg 2012-04-23 10:07 ` [PATCH v2 1/6] hid: Add device group to modalias Henrik Rydberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®