lkml.org 
[lkml]   [2012]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] hid: Parse the device before adding it
Date
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 device drivers, in particular those with report fixup
routines, are not affected by this patch.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/hid/hid-core.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f5a9660..1c4db36 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);
@@ -2093,6 +2093,16 @@ 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_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


\
 
 \ /
  Last update: 2012-04-19 00:01    [W:0.560 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site