Re: [PATCH 2/6] hid: Scan the device for group info before addingit

From: Jiri Kosina
Date: Tue Apr 24 2012 - 08:31:20 EST


On Mon, 23 Apr 2012, Henrik Rydberg wrote:

> In order to allow the report descriptor to influence the hid device
> properties, one needs to parse the descriptor early, without reference
> to any driver. Scan the descriptor for group information during device
> add, before the device has been broadcast to userland. The device
> modalias will contain group information which can be used to
> differentiate between modules. For starters, just handle the generic
> group.
>
> Signed-off-by: Henrik Rydberg <rydberg@xxxxxxxxxxx>
> ---
> drivers/hid/hid-core.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/hid.h | 5 ++++
> 2 files changed, 67 insertions(+)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index cfcb69e..f932cd5 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -658,6 +658,58 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
> return NULL;
> }
>
> +static void hid_scan_usage(struct hid_device *hid, u32 usage)
> +{
> +}
> +
> +/*
> + * Scan a report descriptor before the device is added to the bus.
> + * Sets device groups and other properties that determine what driver
> + * to load.
> + */
> +static int hid_scan_report(struct hid_device *hid)
> +{
> + unsigned int page = 0, delim = 0;
> + __u8 *start = hid->dev_rdesc;
> + __u8 *end = start + hid->dev_rsize;

Where do these dev_rdesc and dev_rsize come from? Your patchset doesn't
seem to be changing the corresponding struct device members (which are
rdesc and rsize currently), right?

--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/