Commit 73e4008d authored by Nikolai Kondrashov's avatar Nikolai Kondrashov Committed by Jiri Kosina

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: default avatarNikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 3cfc2c42
...@@ -246,17 +246,18 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field, ...@@ -246,17 +246,18 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field,
/* /*
* MacBook JIS keyboard has wrong logical maximum * MacBook JIS keyboard has wrong logical maximum
*/ */
static void apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
struct apple_sc *asc = hid_get_drvdata(hdev); struct apple_sc *asc = hid_get_drvdata(hdev);
if ((asc->quirks & APPLE_RDESC_JIS) && rsize >= 60 && if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
rdesc[53] == 0x65 && rdesc[59] == 0x65) { rdesc[53] == 0x65 && rdesc[59] == 0x65) {
dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report "
"descriptor\n"); "descriptor\n");
rdesc[53] = rdesc[59] = 0xe7; rdesc[53] = rdesc[59] = 0xe7;
} }
return rdesc;
} }
static void apple_setup_input(struct input_dev *input) static void apple_setup_input(struct input_dev *input)
......
...@@ -26,15 +26,16 @@ ...@@ -26,15 +26,16 @@
* Cherry Cymotion keyboard have an invalid HID report descriptor, * Cherry Cymotion keyboard have an invalid HID report descriptor,
* that needs fixing before we can parse it. * that needs fixing before we can parse it.
*/ */
static void ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
dev_info(&hdev->dev, "fixing up Cherry Cymotion report " dev_info(&hdev->dev, "fixing up Cherry Cymotion report "
"descriptor\n"); "descriptor\n");
rdesc[11] = rdesc[16] = 0xff; rdesc[11] = rdesc[16] = 0xff;
rdesc[12] = rdesc[17] = 0x03; rdesc[12] = rdesc[17] = 0x03;
} }
return rdesc;
} }
#define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -651,7 +651,7 @@ int hid_parse_report(struct hid_device *device, __u8 *start, ...@@ -651,7 +651,7 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
}; };
if (device->driver->report_fixup) if (device->driver->report_fixup)
device->driver->report_fixup(device, start, size); start = device->driver->report_fixup(device, start, &size);
device->rdesc = kmemdup(start, size, GFP_KERNEL); device->rdesc = kmemdup(start, size, GFP_KERNEL);
if (device->rdesc == NULL) if (device->rdesc == NULL)
......
...@@ -31,16 +31,16 @@ ...@@ -31,16 +31,16 @@
* Some USB barcode readers from cypress have usage min and usage max in * Some USB barcode readers from cypress have usage min and usage max in
* the wrong order * the wrong order
*/ */
static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
unsigned int i; unsigned int i;
if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) 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) { if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
__u8 tmp; __u8 tmp;
...@@ -50,6 +50,7 @@ static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -50,6 +50,7 @@ static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[i + 3] = rdesc[i + 1]; rdesc[i + 3] = rdesc[i + 1];
rdesc[i + 1] = tmp; rdesc[i + 1] = tmp;
} }
return rdesc;
} }
static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
......
...@@ -20,14 +20,15 @@ ...@@ -20,14 +20,15 @@
#include "hid-ids.h" #include "hid-ids.h"
static void elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
dev_info(&hdev->dev, "Fixing up Elecom BM084 " dev_info(&hdev->dev, "Fixing up Elecom BM084 "
"report descriptor.\n"); "report descriptor.\n");
rdesc[47] = 0x00; rdesc[47] = 0x00;
} }
return rdesc;
} }
static const struct hid_device_id elecom_devices[] = { static const struct hid_device_id elecom_devices[] = {
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
* - report size 8 count 1 must be size 1 count 8 for button bitfield * - report size 8 count 1 must be size 1 count 8 for button bitfield
* - change the button usage range to 4-7 for the extra buttons * - change the button usage range to 4-7 for the extra buttons
*/ */
static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 74 && if (*rsize >= 74 &&
rdesc[61] == 0x05 && rdesc[62] == 0x08 && rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
rdesc[63] == 0x19 && rdesc[64] == 0x08 && rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
rdesc[65] == 0x29 && rdesc[66] == 0x0f && rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
...@@ -40,6 +40,7 @@ static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -40,6 +40,7 @@ static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[72] = 0x01; rdesc[72] = 0x01;
rdesc[74] = 0x08; rdesc[74] = 0x08;
} }
return rdesc;
} }
static const struct hid_device_id kye_devices[] = { static const struct hid_device_id kye_devices[] = {
......
...@@ -41,25 +41,26 @@ ...@@ -41,25 +41,26 @@
* above the logical maximum described in descriptor. This extends * above the logical maximum described in descriptor. This extends
* the original value of 0x28c of logical maximum to 0x104d * the original value of 0x28c of logical maximum to 0x104d
*/ */
static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
if ((quirks & LG_RDESC) && rsize >= 90 && rdesc[83] == 0x26 && if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
rdesc[84] == 0x8c && rdesc[85] == 0x02) { rdesc[84] == 0x8c && rdesc[85] == 0x02) {
dev_info(&hdev->dev, "fixing up Logitech keyboard report " dev_info(&hdev->dev, "fixing up Logitech keyboard report "
"descriptor\n"); "descriptor\n");
rdesc[84] = rdesc[89] = 0x4d; rdesc[84] = rdesc[89] = 0x4d;
rdesc[85] = rdesc[90] = 0x10; rdesc[85] = rdesc[90] = 0x10;
} }
if ((quirks & LG_RDESC_REL_ABS) && rsize >= 50 && if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
rdesc[32] == 0x81 && rdesc[33] == 0x06 && rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
rdesc[49] == 0x81 && rdesc[50] == 0x06) { rdesc[49] == 0x81 && rdesc[50] == 0x06) {
dev_info(&hdev->dev, "fixing up rel/abs in Logitech " dev_info(&hdev->dev, "fixing up rel/abs in Logitech "
"report descriptor\n"); "report descriptor\n");
rdesc[33] = rdesc[50] = 0x02; rdesc[33] = rdesc[50] = 0x02;
} }
return rdesc;
} }
#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -33,18 +33,19 @@ ...@@ -33,18 +33,19 @@
* Microsoft Wireless Desktop Receiver (Model 1028) has * Microsoft Wireless Desktop Receiver (Model 1028) has
* 'Usage Min/Max' where it ought to have 'Physical Min/Max' * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
*/ */
static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
if ((quirks & MS_RDESC) && rsize == 571 && rdesc[557] == 0x19 && if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
rdesc[559] == 0x29) { rdesc[559] == 0x29) {
dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver "
"Model 1028 report descriptor\n"); "Model 1028 report descriptor\n");
rdesc[557] = 0x35; rdesc[557] = 0x35;
rdesc[559] = 0x45; rdesc[559] = 0x45;
} }
return rdesc;
} }
#define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -22,14 +22,15 @@ ...@@ -22,14 +22,15 @@
#include "hid-ids.h" #include "hid-ids.h"
static void mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
dev_info(&hdev->dev, "fixing up button/consumer in HID report " dev_info(&hdev->dev, "fixing up button/consumer in HID report "
"descriptor\n"); "descriptor\n");
rdesc[30] = 0x0c; rdesc[30] = 0x0c;
} }
return rdesc;
} }
#define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -19,14 +19,15 @@ ...@@ -19,14 +19,15 @@
#include "hid-ids.h" #include "hid-ids.h"
static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
"report descriptor.\n"); "report descriptor.\n");
rdesc[55] = 0x92; rdesc[55] = 0x92;
} }
return rdesc;
} }
static const struct hid_device_id ortek_devices[] = { static const struct hid_device_id ortek_devices[] = {
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#include "hid-ids.h" #include "hid-ids.h"
/* Petalynx Maxter Remote has maximum for consumer page set too low */ /* Petalynx Maxter Remote has maximum for consumer page set too low */
static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
rdesc[41] == 0x00 && rdesc[59] == 0x26 && rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
rdesc[60] == 0xf9 && rdesc[61] == 0x00) { rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report "
...@@ -34,6 +34,7 @@ static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -34,6 +34,7 @@ static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[60] = 0xfa; rdesc[60] = 0xfa;
rdesc[40] = 0xfa; rdesc[40] = 0xfa;
} }
return rdesc;
} }
#define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -740,10 +740,10 @@ int pcmidi_snd_terminate(struct pcmidi_snd *pm) ...@@ -740,10 +740,10 @@ int pcmidi_snd_terminate(struct pcmidi_snd *pm)
/* /*
* PC-MIDI report descriptor for report id is wrong. * PC-MIDI report descriptor for report id is wrong.
*/ */
static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize == 178 && if (*rsize == 178 &&
rdesc[111] == 0x06 && rdesc[112] == 0x00 && rdesc[111] == 0x06 && rdesc[112] == 0x00 &&
rdesc[113] == 0xff) { rdesc[113] == 0xff) {
dev_info(&hdev->dev, "fixing up pc-midi keyboard report " dev_info(&hdev->dev, "fixing up pc-midi keyboard report "
...@@ -751,6 +751,7 @@ static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -751,6 +751,7 @@ static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[144] = 0x18; /* report 4: was 0x10 report count */ rdesc[144] = 0x18; /* report 4: was 0x10 report count */
} }
return rdesc;
} }
static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi,
......
...@@ -61,10 +61,10 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev, ...@@ -61,10 +61,10 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev,
"descriptor\n", rsize); "descriptor\n", rsize);
} }
static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && if (*rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 &&
rdesc[177] == 0x75 && rdesc[178] == 0x30 && rdesc[177] == 0x75 && rdesc[178] == 0x30 &&
rdesc[179] == 0x95 && rdesc[180] == 0x01 && rdesc[179] == 0x95 && rdesc[180] == 0x01 &&
rdesc[182] == 0x40) { rdesc[182] == 0x40) {
...@@ -74,24 +74,25 @@ static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -74,24 +74,25 @@ static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[180] = 0x06; rdesc[180] = 0x06;
rdesc[182] = 0x42; rdesc[182] = 0x42;
} else } else
if (rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 && if (*rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 &&
rdesc[194] == 0x25 && rdesc[195] == 0x12) { rdesc[194] == 0x25 && rdesc[195] == 0x12) {
samsung_irda_dev_trace(hdev, 203); samsung_irda_dev_trace(hdev, 203);
rdesc[193] = 0x1; rdesc[193] = 0x1;
rdesc[195] = 0xf; rdesc[195] = 0xf;
} else } else
if (rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 && if (*rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 &&
rdesc[126] == 0x25 && rdesc[127] == 0x11) { rdesc[126] == 0x25 && rdesc[127] == 0x11) {
samsung_irda_dev_trace(hdev, 135); samsung_irda_dev_trace(hdev, 135);
rdesc[125] = 0x1; rdesc[125] = 0x1;
rdesc[127] = 0xe; rdesc[127] = 0xe;
} else } else
if (rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 && if (*rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 &&
rdesc[162] == 0x25 && rdesc[163] == 0x01) { rdesc[162] == 0x25 && rdesc[163] == 0x01) {
samsung_irda_dev_trace(hdev, 171); samsung_irda_dev_trace(hdev, 171);
rdesc[161] = 0x1; rdesc[161] = 0x1;
rdesc[163] = 0x3; rdesc[163] = 0x3;
} }
return rdesc;
} }
#define samsung_kbd_mouse_map_key_clear(c) \ #define samsung_kbd_mouse_map_key_clear(c) \
...@@ -130,11 +131,12 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, ...@@ -130,11 +131,12 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
return 1; return 1;
} }
static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product)
samsung_irda_report_fixup(hdev, rdesc, rsize); rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize);
return rdesc;
} }
static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi, static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
......
...@@ -31,17 +31,18 @@ struct sony_sc { ...@@ -31,17 +31,18 @@ struct sony_sc {
}; };
/* Sony Vaio VGX has wrongly mouse pointer declared as constant */ /* Sony Vaio VGX has wrongly mouse pointer declared as constant */
static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
struct sony_sc *sc = hid_get_drvdata(hdev); struct sony_sc *sc = hid_get_drvdata(hdev);
if ((sc->quirks & VAIO_RDESC_CONSTANT) && if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report "
"descriptor\n"); "descriptor\n");
rdesc[55] = 0x06; rdesc[55] = 0x06;
} }
return rdesc;
} }
/* /*
......
...@@ -22,16 +22,17 @@ ...@@ -22,16 +22,17 @@
#include "hid-ids.h" #include "hid-ids.h"
static void sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
rdesc[106] == 0x03) { rdesc[106] == 0x03) {
dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop "
"report descriptor\n"); "report descriptor\n");
rdesc[105] = rdesc[110] = 0x03; rdesc[105] = rdesc[110] = 0x03;
rdesc[106] = rdesc[111] = 0x21; rdesc[106] = rdesc[111] = 0x21;
} }
return rdesc;
} }
#define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ #define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
......
...@@ -27,10 +27,10 @@ struct zc_device { ...@@ -27,10 +27,10 @@ struct zc_device {
* Zydacron remote control has an invalid HID report descriptor, * Zydacron remote control has an invalid HID report descriptor,
* that needs fixing before we can parse it. * that needs fixing before we can parse it.
*/ */
static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int rsize) unsigned int *rsize)
{ {
if (rsize >= 253 && if (*rsize >= 253 &&
rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff && rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff &&
rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff && rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff &&
rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) { rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) {
...@@ -40,6 +40,7 @@ static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -40,6 +40,7 @@ static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c; rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c;
rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00; rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00;
} }
return rdesc;
} }
#define zc_map_key_clear(c) \ #define zc_map_key_clear(c) \
......
...@@ -626,8 +626,8 @@ struct hid_driver { ...@@ -626,8 +626,8 @@ struct hid_driver {
int (*event)(struct hid_device *hdev, struct hid_field *field, int (*event)(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value); struct hid_usage *usage, __s32 value);
void (*report_fixup)(struct hid_device *hdev, __u8 *buf, __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
unsigned int size); unsigned int *size);
int (*input_mapping)(struct hid_device *hdev, int (*input_mapping)(struct hid_device *hdev,
struct hid_input *hidinput, struct hid_field *field, struct hid_input *hidinput, struct hid_field *field,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment