aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/hid/hid-cypress.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2010-08-06 23:03:06 +0400
committerJiri Kosina <jkosina@suse.cz>2010-08-09 19:52:42 +0200
commit73e4008ddddc84d5f2499c17012b340a0dae153e (patch)
treed3adfa8c5792e71c21cb7a9cd18517cce9c92685 /drivers/hid/hid-cypress.c
parentMerge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial (diff)
downloadwireguard-linux-73e4008ddddc84d5f2499c17012b340a0dae153e.tar.xz
wireguard-linux-73e4008ddddc84d5f2499c17012b340a0dae153e.zip
HID: allow resizing and replacing report descriptors
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@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-cypress.c')
-rw-r--r--drivers/hid/hid-cypress.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index 998b6f443d7d..4cd0e2345991 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -31,16 +31,16 @@
* Some USB barcode readers from cypress have usage min and usage max in
* the wrong order
*/
-static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
- unsigned int rsize)
+static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *rsize)
{
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
unsigned int i;
if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
- return;
+ return rdesc;
- for (i = 0; i < rsize - 4; i++)
+ for (i = 0; i < *rsize - 4; i++)
if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
__u8 tmp;
@@ -50,6 +50,7 @@ static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[i + 3] = rdesc[i + 1];
rdesc[i + 1] = tmp;
}
+ return rdesc;
}
static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,