Skip to content

Commit 47cf1b4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - Wacom driver functional and regression fixes from Jason Gerecke - race condition fix in usbhid, found by syzbot and fixed by Alan Stern - a few device-specific quirks and ID additions * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock HID: mcp2221: add gpiolib dependency HID: i2c-hid: reset Synaptics SYNA2393 on resume HID: wacom: Report 2nd-gen Intuos Pro S center button status over BT HID: usbhid: Fix race between usbhid_close() and usbhid_stop() Revert "HID: wacom: generic: read the number of expected touches on a per collection basis" HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead HID: alps: Add AUI1657 device ID HID: logitech: Add support for Logitech G11 extra keys HID: multitouch: add eGalaxTouch P80H84 support HID: wacom: Read HID_DG_CONTACTMAX directly for non-generic devices
2 parents 9851a0d + 1e189f2 commit 47cf1b4

File tree

11 files changed

+74
-76
lines changed

11 files changed

+74
-76
lines changed

drivers/hid/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ config HID_ALPS
11551155
config HID_MCP2221
11561156
tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support"
11571157
depends on USB_HID && I2C
1158+
depends on GPIOLIB
11581159
---help---
11591160
Provides I2C and SMBUS host adapter functionality over USB-HID
11601161
through MCP2221 device.

drivers/hid/hid-alps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)
802802
break;
803803
case HID_DEVICE_ID_ALPS_U1_DUAL:
804804
case HID_DEVICE_ID_ALPS_U1:
805+
case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY:
805806
data->dev_type = U1;
806807
break;
807808
default:

drivers/hid/hid-ids.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@
7979
#define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F
8080
#define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220
8181
#define HID_DEVICE_ID_ALPS_U1 0x1215
82+
#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E
8283
#define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
8384
#define HID_DEVICE_ID_ALPS_1222 0x1222
8485

85-
8686
#define USB_VENDOR_ID_AMI 0x046b
8787
#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
8888

@@ -385,6 +385,7 @@
385385
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
386386
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
387387
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
388+
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002
388389

389390
#define USB_VENDOR_ID_ELAN 0x04f3
390391
#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
@@ -759,6 +760,7 @@
759760
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
760761
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
761762
#define USB_DEVICE_ID_LOGITECH_G15_LCD 0xc222
763+
#define USB_DEVICE_ID_LOGITECH_G11 0xc225
762764
#define USB_DEVICE_ID_LOGITECH_G15_V2_LCD 0xc227
763765
#define USB_DEVICE_ID_LOGITECH_G510 0xc22d
764766
#define USB_DEVICE_ID_LOGITECH_G510_USB_AUDIO 0xc22e
@@ -1097,6 +1099,9 @@
10971099
#define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300
10981100
#define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200
10991101

1102+
#define I2C_VENDOR_ID_SYNAPTICS 0x06cb
1103+
#define I2C_PRODUCT_ID_SYNAPTICS_SYNA2393 0x7a13
1104+
11001105
#define USB_VENDOR_ID_SYNAPTICS 0x06cb
11011106
#define USB_DEVICE_ID_SYNAPTICS_TP 0x0001
11021107
#define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002
@@ -1111,6 +1116,7 @@
11111116
#define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
11121117
#define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
11131118
#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
1119+
#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
11141120
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
11151121
#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
11161122
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7

drivers/hid/hid-lg-g15.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,10 @@ static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id)
872872
}
873873

874874
static const struct hid_device_id lg_g15_devices[] = {
875+
/* The G11 is a G15 without the LCD, treat it as a G15 */
876+
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
877+
USB_DEVICE_ID_LOGITECH_G11),
878+
.driver_data = LG_G15 },
875879
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
876880
USB_DEVICE_ID_LOGITECH_G15_LCD),
877881
.driver_data = LG_G15 },

drivers/hid/hid-multitouch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,9 @@ static const struct hid_device_id mt_devices[] = {
19221922
{ .driver_data = MT_CLS_EGALAX_SERIAL,
19231923
MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
19241924
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
1925+
{ .driver_data = MT_CLS_EGALAX,
1926+
MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1927+
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) },
19251928

19261929
/* Elitegroup panel */
19271930
{ .driver_data = MT_CLS_SERIAL,

drivers/hid/hid-quirks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static const struct hid_device_id hid_quirks[] = {
163163
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS },
164164
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS },
165165
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS },
166+
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS },
166167
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD },
167168
{ HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT },
168169
{ HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ static const struct i2c_hid_quirks {
177177
I2C_HID_QUIRK_BOGUS_IRQ },
178178
{ USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
179179
I2C_HID_QUIRK_RESET_ON_RESUME },
180+
{ I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393,
181+
I2C_HID_QUIRK_RESET_ON_RESUME },
180182
{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
181183
I2C_HID_QUIRK_BAD_INPUT_SIZE },
182184
{ 0, 0 }

drivers/hid/usbhid/hid-core.c

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -682,16 +682,21 @@ static int usbhid_open(struct hid_device *hid)
682682
struct usbhid_device *usbhid = hid->driver_data;
683683
int res;
684684

685+
mutex_lock(&usbhid->mutex);
686+
685687
set_bit(HID_OPENED, &usbhid->iofl);
686688

687-
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
688-
return 0;
689+
if (hid->quirks & HID_QUIRK_ALWAYS_POLL) {
690+
res = 0;
691+
goto Done;
692+
}
689693

690694
res = usb_autopm_get_interface(usbhid->intf);
691695
/* the device must be awake to reliably request remote wakeup */
692696
if (res < 0) {
693697
clear_bit(HID_OPENED, &usbhid->iofl);
694-
return -EIO;
698+
res = -EIO;
699+
goto Done;
695700
}
696701

697702
usbhid->intf->needs_remote_wakeup = 1;
@@ -725,13 +730,18 @@ static int usbhid_open(struct hid_device *hid)
725730
msleep(50);
726731

727732
clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
733+
734+
Done:
735+
mutex_unlock(&usbhid->mutex);
728736
return res;
729737
}
730738

731739
static void usbhid_close(struct hid_device *hid)
732740
{
733741
struct usbhid_device *usbhid = hid->driver_data;
734742

743+
mutex_lock(&usbhid->mutex);
744+
735745
/*
736746
* Make sure we don't restart data acquisition due to
737747
* a resumption we no longer care about by avoiding racing
@@ -743,12 +753,13 @@ static void usbhid_close(struct hid_device *hid)
743753
clear_bit(HID_IN_POLLING, &usbhid->iofl);
744754
spin_unlock_irq(&usbhid->lock);
745755

746-
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
747-
return;
756+
if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) {
757+
hid_cancel_delayed_stuff(usbhid);
758+
usb_kill_urb(usbhid->urbin);
759+
usbhid->intf->needs_remote_wakeup = 0;
760+
}
748761

749-
hid_cancel_delayed_stuff(usbhid);
750-
usb_kill_urb(usbhid->urbin);
751-
usbhid->intf->needs_remote_wakeup = 0;
762+
mutex_unlock(&usbhid->mutex);
752763
}
753764

754765
/*
@@ -1057,6 +1068,8 @@ static int usbhid_start(struct hid_device *hid)
10571068
unsigned int n, insize = 0;
10581069
int ret;
10591070

1071+
mutex_lock(&usbhid->mutex);
1072+
10601073
clear_bit(HID_DISCONNECTED, &usbhid->iofl);
10611074

10621075
usbhid->bufsize = HID_MIN_BUFFER_SIZE;
@@ -1177,6 +1190,8 @@ static int usbhid_start(struct hid_device *hid)
11771190
usbhid_set_leds(hid);
11781191
device_set_wakeup_enable(&dev->dev, 1);
11791192
}
1193+
1194+
mutex_unlock(&usbhid->mutex);
11801195
return 0;
11811196

11821197
fail:
@@ -1187,6 +1202,7 @@ static int usbhid_start(struct hid_device *hid)
11871202
usbhid->urbout = NULL;
11881203
usbhid->urbctrl = NULL;
11891204
hid_free_buffers(dev, hid);
1205+
mutex_unlock(&usbhid->mutex);
11901206
return ret;
11911207
}
11921208

@@ -1202,6 +1218,8 @@ static void usbhid_stop(struct hid_device *hid)
12021218
usbhid->intf->needs_remote_wakeup = 0;
12031219
}
12041220

1221+
mutex_lock(&usbhid->mutex);
1222+
12051223
clear_bit(HID_STARTED, &usbhid->iofl);
12061224
spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */
12071225
set_bit(HID_DISCONNECTED, &usbhid->iofl);
@@ -1222,6 +1240,8 @@ static void usbhid_stop(struct hid_device *hid)
12221240
usbhid->urbout = NULL;
12231241

12241242
hid_free_buffers(hid_to_usb_dev(hid), hid);
1243+
1244+
mutex_unlock(&usbhid->mutex);
12251245
}
12261246

12271247
static int usbhid_power(struct hid_device *hid, int lvl)
@@ -1382,6 +1402,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
13821402
INIT_WORK(&usbhid->reset_work, hid_reset);
13831403
timer_setup(&usbhid->io_retry, hid_retry_timeout, 0);
13841404
spin_lock_init(&usbhid->lock);
1405+
mutex_init(&usbhid->mutex);
13851406

13861407
ret = hid_add_device(hid);
13871408
if (ret) {

drivers/hid/usbhid/usbhid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct usbhid_device {
8080
dma_addr_t outbuf_dma; /* Output buffer dma */
8181
unsigned long last_out; /* record of last output for timeouts */
8282

83+
struct mutex mutex; /* start/stop/open/close */
8384
spinlock_t lock; /* fifo spinlock */
8485
unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
8586
struct timer_list io_retry; /* Retry timer */

drivers/hid/wacom_sys.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ static void wacom_feature_mapping(struct hid_device *hdev,
319319
data[0] = field->report->id;
320320
ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
321321
data, n, WAC_CMD_RETRIES);
322-
if (ret == n) {
322+
if (ret == n && features->type == HID_GENERIC) {
323323
ret = hid_report_raw_event(hdev,
324324
HID_FEATURE_REPORT, data, n, 0);
325+
} else if (ret == 2 && features->type != HID_GENERIC) {
326+
features->touch_max = data[1];
325327
} else {
326328
features->touch_max = 16;
327329
hid_warn(hdev, "wacom_feature_mapping: "

0 commit comments

Comments
 (0)