Re: [PATCH 1/3] Allow resizing and replacing report descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 06.08.2010 21:03, Nikolai Kondrashov wrote:
> Update hid_driver's report_fixup prototype to allow changing report
> descriptor size and/or returning completely different report descriptor.
> Update existing usage accordingly.
> 
> This is to give more freedom in descriptor fixup and to allow having a whole
> fixed descriptor in the code for the sake of readability.
> 
> Signed-off-by: Nikolai Kondrashov <spbnick-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx>
>[...]
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 42a0f1d..0a34fb0 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -626,8 +626,8 @@ struct hid_driver {
>  	int (*event)(struct hid_device *hdev, struct hid_field *field,
>  			struct hid_usage *usage, __s32 value);
>  
> -	void (*report_fixup)(struct hid_device *hdev, __u8 *buf,
> -			unsigned int size);
> +	__u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
> +			unsigned int *size);
>  
>  	int (*input_mapping)(struct hid_device *hdev,
>  			struct hid_input *hidinput, struct hid_field *field,
>From [PATCH 3/3]
>+static __u8 wp4030u_rdesc_fixed[] = {
>+	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
>[...]


Would not it make sense to declare the returned buffer from report_fixup const? With the desired new definition (no buffer copy/return private reference) you should never want anyone to change the returned buffer content afterwards. Of course, const would propagate a bit into hid-core.c (hid_parse_report, fetch_item).

Regards,
Robert Schedel
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux