Skip to content

Commit 1c24113

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina: - a partial revert of exponent parsing changes to make "Unit" exponent item work properly again, by Nikolai Kondrashov - a few new device IDs additions piggy-backing, by AceLan Kao and David Herrmann * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: wiimote: add LEGO-wiimote VID HID: Fix unit exponent parsing again HID: usbhid: quirk for SiS Touchscreen HID: usbhid: quirk for Synaptics Large Touchccreen
2 parents 19eddab + 86b8416 commit 1c24113

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

drivers/hid/hid-core.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static s32 item_sdata(struct hid_item *item)
319319

320320
static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
321321
{
322-
__u32 raw_value;
322+
__s32 raw_value;
323323
switch (item->tag) {
324324
case HID_GLOBAL_ITEM_TAG_PUSH:
325325

@@ -370,10 +370,11 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
370370
return 0;
371371

372372
case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT:
373-
/* Units exponent negative numbers are given through a
374-
* two's complement.
375-
* See "6.2.2.7 Global Items" for more information. */
376-
raw_value = item_udata(item);
373+
/* Many devices provide unit exponent as a two's complement
374+
* nibble due to the common misunderstanding of HID
375+
* specification 1.11, 6.2.2.7 Global Items. Attempt to handle
376+
* both this and the standard encoding. */
377+
raw_value = item_sdata(item);
377378
if (!(raw_value & 0xfffffff0))
378379
parser->global.unit_exponent = hid_snto32(raw_value, 4);
379380
else
@@ -1870,6 +1871,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
18701871

18711872
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
18721873
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
1874+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO2, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
18731875
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
18741876
{ }
18751877
};

drivers/hid/hid-ids.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@
633633
#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003
634634

635635
#define USB_VENDOR_ID_NINTENDO 0x057e
636+
#define USB_VENDOR_ID_NINTENDO2 0x054c
636637
#define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306
637638
#define USB_DEVICE_ID_NINTENDO_WIIMOTE2 0x0330
638639

@@ -792,6 +793,8 @@
792793
#define USB_DEVICE_ID_SYNAPTICS_COMP_TP 0x0009
793794
#define USB_DEVICE_ID_SYNAPTICS_WTP 0x0010
794795
#define USB_DEVICE_ID_SYNAPTICS_DPAD 0x0013
796+
#define USB_DEVICE_ID_SYNAPTICS_LTS1 0x0af8
797+
#define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
795798

796799
#define USB_VENDOR_ID_THINGM 0x27b8
797800
#define USB_DEVICE_ID_BLINK1 0x01ed
@@ -919,4 +922,7 @@
919922
#define USB_VENDOR_ID_PRIMAX 0x0461
920923
#define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05
921924

925+
#define USB_VENDOR_ID_SIS 0x0457
926+
#define USB_DEVICE_ID_SIS_TS 0x1013
927+
922928
#endif

drivers/hid/hid-input.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static int hidinput_setkeycode(struct input_dev *dev,
192192
return -EINVAL;
193193
}
194194

195+
195196
/**
196197
* hidinput_calc_abs_res - calculate an absolute axis resolution
197198
* @field: the HID report field to calculate resolution for
@@ -234,23 +235,17 @@ __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
234235
case ABS_MT_TOOL_Y:
235236
case ABS_MT_TOUCH_MAJOR:
236237
case ABS_MT_TOUCH_MINOR:
237-
if (field->unit & 0xffffff00) /* Not a length */
238-
return 0;
239-
unit_exponent += hid_snto32(field->unit >> 4, 4) - 1;
240-
switch (field->unit & 0xf) {
241-
case 0x1: /* If centimeters */
238+
if (field->unit == 0x11) { /* If centimeters */
242239
/* Convert to millimeters */
243240
unit_exponent += 1;
244-
break;
245-
case 0x3: /* If inches */
241+
} else if (field->unit == 0x13) { /* If inches */
246242
/* Convert to millimeters */
247243
prev = physical_extents;
248244
physical_extents *= 254;
249245
if (physical_extents < prev)
250246
return 0;
251247
unit_exponent -= 1;
252-
break;
253-
default:
248+
} else {
254249
return 0;
255250
}
256251
break;

drivers/hid/hid-wiimote-core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,8 @@ static void wiimote_init_set_type(struct wiimote_data *wdata,
834834
goto done;
835835
}
836836

837-
if (vendor == USB_VENDOR_ID_NINTENDO) {
837+
if (vendor == USB_VENDOR_ID_NINTENDO ||
838+
vendor == USB_VENDOR_ID_NINTENDO2) {
838839
if (product == USB_DEVICE_ID_NINTENDO_WIIMOTE) {
839840
devtype = WIIMOTE_DEV_GEN10;
840841
goto done;
@@ -1855,6 +1856,8 @@ static void wiimote_hid_remove(struct hid_device *hdev)
18551856
static const struct hid_device_id wiimote_hid_devices[] = {
18561857
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
18571858
USB_DEVICE_ID_NINTENDO_WIIMOTE) },
1859+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO2,
1860+
USB_DEVICE_ID_NINTENDO_WIIMOTE) },
18581861
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
18591862
USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
18601863
{ }

drivers/hid/usbhid/hid-quirks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ static const struct hid_blacklist {
110110
{ USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT },
111111
{ USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT },
112112
{ USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
113+
{ USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
114+
{ USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS },
115+
{ USB_VENDOR_ID_SIS, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS },
113116

114117
{ 0, 0 }
115118
};

0 commit comments

Comments
 (0)