Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 08ec2dc

Browse files
author
Jiri Kosina
committed
Merge branches 'for-3.11/multitouch', 'for-3.11/sony' and 'for-3.11/upstream' into for-linus
Conflicts: drivers/hid/hid-core.c
4 parents db58316 + adb91ae + 078328d + 3685c18 commit 08ec2dc

File tree

12 files changed

+736
-256
lines changed

12 files changed

+736
-256
lines changed

drivers/hid/Kconfig

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ config HOLTEK_FF
250250
Say Y here if you have a Holtek On Line Grip based game controller
251251
and want to have force feedback support for it.
252252

253+
config HID_HUION
254+
tristate "Huion tablets"
255+
depends on USB_HID
256+
---help---
257+
Support for Huion 580 tablet.
258+
253259
config HID_KEYTOUCH
254260
tristate "Keytouch HID devices"
255261
depends on HID
@@ -571,15 +577,6 @@ config HID_PRIMAX
571577
Support for Primax devices that are not fully compliant with the
572578
HID standard.
573579

574-
config HID_PS3REMOTE
575-
tristate "Sony PS3 BD Remote Control"
576-
depends on HID
577-
---help---
578-
Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech
579-
Harmony Adapter for PS3, which connect over Bluetooth.
580-
581-
Support for the 6-axis controllers is provided by HID_SONY.
582-
583580
config HID_ROCCAT
584581
tristate "Roccat device support"
585582
depends on USB_HID
@@ -604,12 +601,17 @@ config HID_SAMSUNG
604601
Support for Samsung InfraRed remote control or keyboards.
605602

606603
config HID_SONY
607-
tristate "Sony PS3 controller"
604+
tristate "Sony PS2/3 accessories"
608605
depends on USB_HID
606+
depends on NEW_LEDS
607+
depends on LEDS_CLASS
609608
---help---
610-
Support for Sony PS3 6-axis controllers.
609+
Support for
611610

612-
Support for the Sony PS3 BD Remote is provided by HID_PS3REMOTE.
611+
* Sony PS3 6-axis controllers
612+
* Buzz controllers
613+
* Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
614+
* Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
613615

614616
config HID_SPEEDLINK
615617
tristate "Speedlink VAD Cezanne mouse support"

drivers/hid/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
5454
obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
5555
obj-$(CONFIG_HID_HOLTEK) += hid-holtek-mouse.o
5656
obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o
57+
obj-$(CONFIG_HID_HUION) += hid-huion.o
5758
obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o
5859
obj-$(CONFIG_HID_ICADE) += hid-icade.o
5960
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
@@ -94,7 +95,6 @@ hid-picolcd-y += hid-picolcd_debugfs.o
9495
endif
9596

9697
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
97-
obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.o
9898
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
9999
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
100100
hid-roccat-koneplus.o hid-roccat-konepure.o hid-roccat-kovaplus.o \

drivers/hid/hid-core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
12931293

12941294
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
12951295
ret = hdrv->raw_event(hid, report, data, size);
1296-
if (ret != 0) {
1296+
if (ret < 0) {
12971297
ret = ret < 0 ? ret : 0;
12981298
goto unlock;
12991299
}
@@ -1588,10 +1588,12 @@ static const struct hid_device_id hid_have_special_driver[] = {
15881588
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
15891589
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
15901590
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
1591+
{ HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) },
15911592
{ HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
15921593
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
15931594
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
15941595
{ HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
1596+
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
15951597
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
15961598
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) },
15971599
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
@@ -1684,6 +1686,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
16841686
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
16851687
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
16861688
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
1689+
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
1690+
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
16871691
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) },
16881692
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
16891693
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
@@ -2046,6 +2050,8 @@ static const struct hid_device_id hid_ignore_list[] = {
20462050
{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
20472051
{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
20482052
{ HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
2053+
{ HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_410) },
2054+
{ HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_510) },
20492055
{ HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
20502056
{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
20512057
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },

drivers/hid/hid-huion.c

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/*
2+
* HID driver for Huion devices not fully compliant with HID standard
3+
*
4+
* Copyright (c) 2013 Martin Rusko
5+
*/
6+
7+
/*
8+
* This program is free software; you can redistribute it and/or modify it
9+
* under the terms of the GNU General Public License as published by the Free
10+
* Software Foundation; either version 2 of the License, or (at your option)
11+
* any later version.
12+
*/
13+
14+
#include <linux/device.h>
15+
#include <linux/hid.h>
16+
#include <linux/module.h>
17+
#include <linux/usb.h>
18+
#include "usbhid/usbhid.h"
19+
20+
#include "hid-ids.h"
21+
22+
/* Original Huion 580 report descriptor size */
23+
#define HUION_580_RDESC_ORIG_SIZE 177
24+
25+
/* Fixed Huion 580 report descriptor */
26+
static __u8 huion_580_rdesc_fixed[] = {
27+
0x05, 0x0D, /* Usage Page (Digitizer), */
28+
0x09, 0x02, /* Usage (Pen), */
29+
0xA1, 0x01, /* Collection (Application), */
30+
0x85, 0x07, /* Report ID (7), */
31+
0x09, 0x20, /* Usage (Stylus), */
32+
0xA0, /* Collection (Physical), */
33+
0x14, /* Logical Minimum (0), */
34+
0x25, 0x01, /* Logical Maximum (1), */
35+
0x75, 0x01, /* Report Size (1), */
36+
0x09, 0x42, /* Usage (Tip Switch), */
37+
0x09, 0x44, /* Usage (Barrel Switch), */
38+
0x09, 0x46, /* Usage (Tablet Pick), */
39+
0x95, 0x03, /* Report Count (3), */
40+
0x81, 0x02, /* Input (Variable), */
41+
0x95, 0x03, /* Report Count (3), */
42+
0x81, 0x03, /* Input (Constant, Variable), */
43+
0x09, 0x32, /* Usage (In Range), */
44+
0x95, 0x01, /* Report Count (1), */
45+
0x81, 0x02, /* Input (Variable), */
46+
0x95, 0x01, /* Report Count (1), */
47+
0x81, 0x03, /* Input (Constant, Variable), */
48+
0x75, 0x10, /* Report Size (16), */
49+
0x95, 0x01, /* Report Count (1), */
50+
0xA4, /* Push, */
51+
0x05, 0x01, /* Usage Page (Desktop), */
52+
0x65, 0x13, /* Unit (Inch), */
53+
0x55, 0xFD, /* Unit Exponent (-3), */
54+
0x34, /* Physical Minimum (0), */
55+
0x09, 0x30, /* Usage (X), */
56+
0x46, 0x40, 0x1F, /* Physical Maximum (8000), */
57+
0x26, 0x00, 0x7D, /* Logical Maximum (32000), */
58+
0x81, 0x02, /* Input (Variable), */
59+
0x09, 0x31, /* Usage (Y), */
60+
0x46, 0x88, 0x13, /* Physical Maximum (5000), */
61+
0x26, 0x20, 0x4E, /* Logical Maximum (20000), */
62+
0x81, 0x02, /* Input (Variable), */
63+
0xB4, /* Pop, */
64+
0x09, 0x30, /* Usage (Tip Pressure), */
65+
0x26, 0xFF, 0x07, /* Logical Maximum (2047), */
66+
0x81, 0x02, /* Input (Variable), */
67+
0xC0, /* End Collection, */
68+
0xC0 /* End Collection */
69+
};
70+
71+
static __u8 *huion_report_fixup(struct hid_device *hdev, __u8 *rdesc,
72+
unsigned int *rsize)
73+
{
74+
switch (hdev->product) {
75+
case USB_DEVICE_ID_HUION_580:
76+
if (*rsize == HUION_580_RDESC_ORIG_SIZE) {
77+
rdesc = huion_580_rdesc_fixed;
78+
*rsize = sizeof(huion_580_rdesc_fixed);
79+
}
80+
break;
81+
}
82+
return rdesc;
83+
}
84+
85+
/**
86+
* Enable fully-functional tablet mode by reading special string
87+
* descriptor.
88+
*
89+
* @hdev: HID device
90+
*
91+
* The specific string descriptor and data were discovered by sniffing
92+
* the Windows driver traffic.
93+
*/
94+
static int huion_tablet_enable(struct hid_device *hdev)
95+
{
96+
int rc;
97+
char buf[22];
98+
99+
rc = usb_string(hid_to_usb_dev(hdev), 0x64, buf, sizeof(buf));
100+
if (rc < 0)
101+
return rc;
102+
103+
return 0;
104+
}
105+
106+
static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id)
107+
{
108+
int ret;
109+
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
110+
111+
/* Ignore interfaces 1 (mouse) and 2 (keyboard) for Huion 580 tablet,
112+
* as they are not used
113+
*/
114+
switch (id->product) {
115+
case USB_DEVICE_ID_HUION_580:
116+
if (intf->cur_altsetting->desc.bInterfaceNumber != 0x00)
117+
return -ENODEV;
118+
break;
119+
}
120+
121+
ret = hid_parse(hdev);
122+
if (ret) {
123+
hid_err(hdev, "parse failed\n");
124+
goto err;
125+
}
126+
127+
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
128+
if (ret) {
129+
hid_err(hdev, "hw start failed\n");
130+
goto err;
131+
}
132+
133+
switch (id->product) {
134+
case USB_DEVICE_ID_HUION_580:
135+
ret = huion_tablet_enable(hdev);
136+
if (ret) {
137+
hid_err(hdev, "tablet enabling failed\n");
138+
goto enabling_err;
139+
}
140+
break;
141+
}
142+
143+
return 0;
144+
enabling_err:
145+
hid_hw_stop(hdev);
146+
err:
147+
return ret;
148+
}
149+
150+
static int huion_raw_event(struct hid_device *hdev, struct hid_report *report,
151+
u8 *data, int size)
152+
{
153+
/* If this is a pen input report then invert the in-range bit */
154+
if (report->type == HID_INPUT_REPORT && report->id == 0x07 && size >= 2)
155+
data[1] ^= 0x40;
156+
157+
return 0;
158+
}
159+
160+
static const struct hid_device_id huion_devices[] = {
161+
{ HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) },
162+
{ }
163+
};
164+
MODULE_DEVICE_TABLE(hid, huion_devices);
165+
166+
static struct hid_driver huion_driver = {
167+
.name = "huion",
168+
.id_table = huion_devices,
169+
.probe = huion_probe,
170+
.report_fixup = huion_report_fixup,
171+
.raw_event = huion_raw_event,
172+
};
173+
module_hid_driver(huion_driver);
174+
175+
MODULE_AUTHOR("Martin Rusko");
176+
MODULE_DESCRIPTION("Huion HID driver");
177+
MODULE_LICENSE("GPL");

drivers/hid/hid-hyperv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,11 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
199199
if (desc->bLength == 0)
200200
goto cleanup;
201201

202-
input_device->hid_desc = kzalloc(desc->bLength, GFP_ATOMIC);
202+
input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
203203

204204
if (!input_device->hid_desc)
205205
goto cleanup;
206206

207-
memcpy(input_device->hid_desc, desc, desc->bLength);
208-
209207
input_device->report_desc_size = desc->desc[0].wDescriptorLength;
210208
if (input_device->report_desc_size == 0) {
211209
input_device->dev_info_status = -EINVAL;

drivers/hid/hid-ids.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@
248248
#define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81
249249
#define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001
250250

251+
#define USB_VENDOR_ID_DATA_MODUL 0x7374
252+
#define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201
253+
251254
#define USB_VENDOR_ID_DEALEXTREAME 0x10c5
252255
#define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a
253256

@@ -272,16 +275,15 @@
272275
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E 0x725e
273276
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262 0x7262
274277
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b
275-
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA 0x72aa
276278
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1
279+
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA 0x72aa
280+
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4 0x72c4
281+
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0 0x72d0
277282
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa
278283
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302
279284
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
280285
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7
281286
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
282-
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224 0x7224
283-
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0 0x72d0
284-
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4 0x72c4
285287

286288
#define USB_VENDOR_ID_ELECOM 0x056e
287289
#define USB_DEVICE_ID_ELECOM_BM084 0x0061
@@ -425,6 +427,9 @@
425427
#define USB_DEVICE_ID_UGCI_FLYING 0x0020
426428
#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
427429

430+
#define USB_VENDOR_ID_HUION 0x256c
431+
#define USB_DEVICE_ID_HUION_580 0x006e
432+
428433
#define USB_VENDOR_ID_IDEACOM 0x1cb6
429434
#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650
430435
#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651
@@ -449,6 +454,10 @@
449454
#define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615
450455
#define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070
451456

457+
#define USB_VENDOR_ID_JABRA 0x0b0e
458+
#define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412
459+
#define USB_DEVICE_ID_JABRA_SPEAK_510 0x0420
460+
452461
#define USB_VENDOR_ID_JESS 0x0c45
453462
#define USB_DEVICE_ID_JESS_YUREX 0x1010
454463

@@ -469,6 +478,7 @@
469478

470479
#define USB_VENDOR_ID_KYE 0x0458
471480
#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
481+
#define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138
472482
#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
473483
#define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
474484
#define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011
@@ -736,6 +746,8 @@
736746
#define USB_DEVICE_ID_SONY_PS3_BDREMOTE 0x0306
737747
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
738748
#define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f
749+
#define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002
750+
#define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER 0x1000
739751

740752
#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
741753
#define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034

drivers/hid/hid-input.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,14 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
10421042

10431043
/*
10441044
* Ignore out-of-range values as per HID specification,
1045-
* section 5.10 and 6.2.25
1045+
* section 5.10 and 6.2.25.
1046+
*
1047+
* The logical_minimum < logical_maximum check is done so that we
1048+
* don't unintentionally discard values sent by devices which
1049+
* don't specify logical min and max.
10461050
*/
10471051
if ((field->flags & HID_MAIN_ITEM_VARIABLE) &&
1052+
(field->logical_minimum < field->logical_maximum) &&
10481053
(value < field->logical_minimum ||
10491054
value > field->logical_maximum)) {
10501055
dbg_hid("Ignoring out-of-range value %x\n", value);

0 commit comments

Comments
 (0)