Skip to content

Commit 3e097d1

Browse files
author
Jiri Kosina
committed
Merge branches 'for-4.2/upstream-fixes-devm-fixed' and 'for-4.3/upstream' into for-linus
2 parents 0be0171 + c9b5772 commit 3e097d1

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

drivers/hid/hid-core.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
427427
{
428428
__u32 data;
429429
unsigned n;
430+
__u32 count;
430431

431432
data = item_udata(item);
432433

@@ -490,6 +491,24 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
490491
if (item->size <= 2)
491492
data = (parser->global.usage_page << 16) + data;
492493

494+
count = data - parser->local.usage_minimum;
495+
if (count + parser->local.usage_index >= HID_MAX_USAGES) {
496+
/*
497+
* We do not warn if the name is not set, we are
498+
* actually pre-scanning the device.
499+
*/
500+
if (dev_name(&parser->device->dev))
501+
hid_warn(parser->device,
502+
"ignoring exceeding usage max\n");
503+
data = HID_MAX_USAGES - parser->local.usage_index +
504+
parser->local.usage_minimum - 1;
505+
if (data <= 0) {
506+
hid_err(parser->device,
507+
"no more usage index available\n");
508+
return -1;
509+
}
510+
}
511+
493512
for (n = parser->local.usage_minimum; n <= data; n++)
494513
if (hid_add_usage(parser, n)) {
495514
dbg_hid("hid_add_usage failed\n");

drivers/hid/hid-ids.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@
922922
#define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688
923923

924924
#define USB_VENDOR_ID_TPV 0x25aa
925-
#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN 0x8883
925+
#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882
926+
#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883
926927

927928
#define USB_VENDOR_ID_TURBOX 0x062a
928929
#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201

drivers/hid/hid-input.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
11661166

11671167
input_event(input, usage->type, usage->code, value);
11681168

1169-
if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY))
1169+
if ((field->flags & HID_MAIN_ITEM_RELATIVE) &&
1170+
usage->type == EV_KEY && value) {
1171+
input_sync(input);
11701172
input_event(input, usage->type, usage->code, 0);
1173+
}
11711174
}
11721175

11731176
void hidinput_report_event(struct hid_device *hid, struct hid_report *report)

drivers/hid/usbhid/hid-core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void hid_io_error(struct hid_device *hid)
164164
if (time_after(jiffies, usbhid->stop_retry)) {
165165

166166
/* Retries failed, so do a port reset unless we lack bandwidth*/
167-
if (test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
167+
if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
168168
&& !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) {
169169

170170
schedule_work(&usbhid->reset_work);
@@ -710,7 +710,8 @@ int usbhid_open(struct hid_device *hid)
710710
* Wait 50 msec for the queue to empty before allowing events
711711
* to go through hid.
712712
*/
713-
msleep(50);
713+
if (res == 0 && !(hid->quirks & HID_QUIRK_ALWAYS_POLL))
714+
msleep(50);
714715
clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
715716
}
716717
done:

drivers/hid/usbhid/hid-quirks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ static const struct hid_blacklist {
117117
{ USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
118118
{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
119119
{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
120-
{ USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET },
120+
{ USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882, HID_QUIRK_NOGET },
121+
{ USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883, HID_QUIRK_NOGET },
121122
{ USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
122123
{ USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT },
123124
{ USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT },

drivers/hid/wacom_sys.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id,
335335
if (error >= 0)
336336
error = wacom_get_report(hdev, HID_FEATURE_REPORT,
337337
rep_data, length, 1);
338-
} while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES);
338+
} while (error >= 0 && rep_data[1] != mode && limit++ < WAC_MSG_RETRIES);
339339

340340
kfree(rep_data);
341341

@@ -1149,12 +1149,9 @@ static void wacom_free_inputs(struct wacom *wacom)
11491149
{
11501150
struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
11511151

1152-
if (wacom_wac->pen_input)
1153-
input_free_device(wacom_wac->pen_input);
1154-
if (wacom_wac->touch_input)
1155-
input_free_device(wacom_wac->touch_input);
1156-
if (wacom_wac->pad_input)
1157-
input_free_device(wacom_wac->pad_input);
1152+
input_free_device(wacom_wac->pen_input);
1153+
input_free_device(wacom_wac->touch_input);
1154+
input_free_device(wacom_wac->pad_input);
11581155
wacom_wac->pen_input = NULL;
11591156
wacom_wac->touch_input = NULL;
11601157
wacom_wac->pad_input = NULL;

0 commit comments

Comments
 (0)