Skip to content

Commit fdea70d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: - Valve Steam Controller support from Rodrigo Rivas Costa - Redragon Asura support from Robert Munteanu - improvement of duplicate usage handling in generic hid-input from Benjamin Tissoires - Win 8.1 precisioun touchpad spec implementation from Benjamin Tissoires - Support for "In Range" flag for Wacom Intuos/Bamboo devices from Jason Gerecke - other various assorted smaller fixes and improvements * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (27 commits) HID: rmi: use HID_QUIRK_NO_INPUT_SYNC HID: multitouch: fix calculation of last slot field in multi-touch reports HID: quirks: remove Delcom Visual Signal Indicator from hid_have_special_driver[] HID: steam: select CONFIG_POWER_SUPPLY HID: i2c-hid: remove i2c_hid_open_mut HID: wacom: Support "in range" for Intuos/Bamboo tablets where possible HID: core: fix hid_hw_open() comment HID: hid-plantronics: Re-resend Update to map button for PTT products HID: multitouch: fix types returned from mt_need_to_apply_feature() HID: i2c-hid: check if device is there before really probing HID: steam: add missing fields in client initialization HID: steam: add battery device. HID: add driver for Valve Steam Controller HID: alps: Fix some style in 't4_read_write_register()' HID: alps: Check errors returned by 't4_read_write_register()' HID: alps: Save a memory allocation in 't4_read_write_register()' when writing data HID: alps: Report an error if we receive invalid data in 't4_read_write_register()' HID: multitouch: implement precision touchpad latency and switches HID: multitouch: simplify the settings of the various features HID: multitouch: make use of HID_QUIRK_INPUT_PER_APP ...
2 parents 9eb86c7 + 06d8b90 commit fdea70d

18 files changed

+1621
-185
lines changed

drivers/hid/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,13 @@ config HID_MAYFLASH
575575
Say Y here if you have HJZ Mayflash PS3 game controller adapters
576576
and want to enable force feedback support.
577577

578+
config HID_REDRAGON
579+
tristate "Redragon keyboards"
580+
depends on HID
581+
default !EXPERT
582+
---help---
583+
Support for Redragon keyboards that need fix-ups to work properly.
584+
578585
config HID_MICROSOFT
579586
tristate "Microsoft non-fully HID-compliant devices"
580587
depends on HID
@@ -838,6 +845,15 @@ config HID_SPEEDLINK
838845
---help---
839846
Support for Speedlink Vicious and Divine Cezanne mouse.
840847

848+
config HID_STEAM
849+
tristate "Steam Controller support"
850+
depends on HID
851+
select POWER_SUPPLY
852+
---help---
853+
Say Y here if you have a Steam Controller if you want to use it
854+
without running the Steam Client. It supports both the wired and
855+
the wireless adaptor.
856+
841857
config HID_STEELSERIES
842858
tristate "Steelseries SRW-S1 steering wheel support"
843859
depends on HID

drivers/hid/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ hid-picolcd-$(CONFIG_DEBUG_FS) += hid-picolcd_debugfs.o
8686

8787
obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
8888
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
89+
obj-$(CONFIG_HID_REDRAGON) += hid-redragon.o
8990
obj-$(CONFIG_HID_RETRODE) += hid-retrode.o
9091
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
9192
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
@@ -97,6 +98,7 @@ obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
9798
obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
9899
obj-$(CONFIG_HID_SONY) += hid-sony.o
99100
obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o
101+
obj-$(CONFIG_HID_STEAM) += hid-steam.o
100102
obj-$(CONFIG_HID_STEELSERIES) += hid-steelseries.o
101103
obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
102104
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o

drivers/hid/hid-alps.c

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
171171
int ret;
172172
u16 check_sum;
173173
u8 *input;
174-
u8 *readbuf;
174+
u8 *readbuf = NULL;
175175

176176
input = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
177177
if (!input)
@@ -204,8 +204,8 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
204204
goto exit;
205205
}
206206

207-
readbuf = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
208207
if (read_flag) {
208+
readbuf = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
209209
if (!readbuf) {
210210
ret = -ENOMEM;
211211
goto exit;
@@ -219,22 +219,24 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
219219
goto exit_readbuf;
220220
}
221221

222+
ret = -EINVAL;
223+
222224
if (*(u32 *)&readbuf[6] != address) {
223225
dev_err(&hdev->dev, "read register address error (%x,%x)\n",
224-
*(u32 *)&readbuf[6], address);
226+
*(u32 *)&readbuf[6], address);
225227
goto exit_readbuf;
226228
}
227229

228230
if (*(u16 *)&readbuf[10] != 1) {
229231
dev_err(&hdev->dev, "read register size error (%x)\n",
230-
*(u16 *)&readbuf[10]);
232+
*(u16 *)&readbuf[10]);
231233
goto exit_readbuf;
232234
}
233235

234236
check_sum = t4_calc_check_sum(readbuf, 6, 7);
235237
if (*(u16 *)&readbuf[13] != check_sum) {
236238
dev_err(&hdev->dev, "read register checksum error (%x,%x)\n",
237-
*(u16 *)&readbuf[13], check_sum);
239+
*(u16 *)&readbuf[13], check_sum);
238240
goto exit_readbuf;
239241
}
240242

@@ -458,17 +460,35 @@ static int __maybe_unused alps_post_reset(struct hid_device *hdev)
458460
case T4:
459461
ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_1,
460462
NULL, T4_I2C_ABS, false);
463+
if (ret < 0) {
464+
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_1 (%d)\n",
465+
ret);
466+
goto exit;
467+
}
468+
461469
ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_4,
462470
NULL, T4_FEEDCFG4_ADVANCED_ABS_ENABLE, false);
471+
if (ret < 0) {
472+
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_4 (%d)\n",
473+
ret);
474+
goto exit;
475+
}
463476
break;
464477
case U1:
465478
ret = u1_read_write_register(hdev,
466479
ADDRESS_U1_DEV_CTRL_1, NULL,
467480
U1_TP_ABS_MODE | U1_SP_ABS_MODE, false);
481+
if (ret < 0) {
482+
dev_err(&hdev->dev, "failed to change TP mode (%d)\n",
483+
ret);
484+
goto exit;
485+
}
468486
break;
469487
default:
470488
break;
471489
}
490+
491+
exit:
472492
return ret;
473493
}
474494

drivers/hid/hid-core.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle
5757
* Register a new report for a device.
5858
*/
5959

60-
struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id)
60+
struct hid_report *hid_register_report(struct hid_device *device,
61+
unsigned int type, unsigned int id,
62+
unsigned int application)
6163
{
6264
struct hid_report_enum *report_enum = device->report_enum + type;
6365
struct hid_report *report;
@@ -78,6 +80,7 @@ struct hid_report *hid_register_report(struct hid_device *device, unsigned type,
7880
report->type = type;
7981
report->size = 0;
8082
report->device = device;
83+
report->application = application;
8184
report_enum->report_id_hash[id] = report;
8285

8386
list_add_tail(&report->list, &report_enum->report_list);
@@ -221,11 +224,15 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
221224
{
222225
struct hid_report *report;
223226
struct hid_field *field;
224-
unsigned usages;
225-
unsigned offset;
226-
unsigned i;
227+
unsigned int usages;
228+
unsigned int offset;
229+
unsigned int i;
230+
unsigned int application;
231+
232+
application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);
227233

228-
report = hid_register_report(parser->device, report_type, parser->global.report_id);
234+
report = hid_register_report(parser->device, report_type,
235+
parser->global.report_id, application);
229236
if (!report) {
230237
hid_err(parser->device, "hid_register_report failed\n");
231238
return -1;
@@ -259,7 +266,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
259266

260267
field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);
261268
field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL);
262-
field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);
269+
field->application = application;
263270

264271
for (i = 0; i < usages; i++) {
265272
unsigned j = i;
@@ -1798,7 +1805,7 @@ EXPORT_SYMBOL_GPL(hid_hw_stop);
17981805
*
17991806
* Tell underlying HW to start delivering events from the device.
18001807
* This function should be called sometime after successful call
1801-
* to hid_hiw_start().
1808+
* to hid_hw_start().
18021809
*/
18031810
int hid_hw_open(struct hid_device *hdev)
18041811
{

drivers/hid/hid-generic.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ static bool hid_generic_match(struct hid_device *hdev,
5656
return true;
5757
}
5858

59+
static int hid_generic_probe(struct hid_device *hdev,
60+
const struct hid_device_id *id)
61+
{
62+
int ret;
63+
64+
hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
65+
66+
ret = hid_parse(hdev);
67+
if (ret)
68+
return ret;
69+
70+
return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
71+
}
72+
5973
static const struct hid_device_id hid_table[] = {
6074
{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, HID_ANY_ID, HID_ANY_ID) },
6175
{ }
@@ -66,6 +80,7 @@ static struct hid_driver hid_generic = {
6680
.name = "hid-generic",
6781
.id_table = hid_table,
6882
.match = hid_generic_match,
83+
.probe = hid_generic_probe,
6984
};
7085
module_hid_driver(hid_generic);
7186

drivers/hid/hid-gfrm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int gfrm_probe(struct hid_device *hdev, const struct hid_device_id *id)
116116
* those reports reach gfrm_raw_event() from hid_input_report().
117117
*/
118118
if (!hid_register_report(hdev, HID_INPUT_REPORT,
119-
GFRM100_SEARCH_KEY_REPORT_ID)) {
119+
GFRM100_SEARCH_KEY_REPORT_ID, 0)) {
120120
ret = -ENOMEM;
121121
goto done;
122122
}

drivers/hid/hid-ids.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@
615615
#define USB_VENDOR_ID_JESS 0x0c45
616616
#define USB_DEVICE_ID_JESS_YUREX 0x1010
617617
#define USB_DEVICE_ID_ASUS_MD_5112 0x5112
618+
#define USB_DEVICE_ID_REDRAGON_ASURA 0x760b
618619

619620
#define USB_VENDOR_ID_JESS2 0x0f30
620621
#define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111
@@ -1012,6 +1013,10 @@
10121013
#define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403
10131014
#define USB_DEVICE_ID_MTP_SITRONIX 0x5001
10141015

1016+
#define USB_VENDOR_ID_VALVE 0x28de
1017+
#define USB_DEVICE_ID_STEAM_CONTROLLER 0x1102
1018+
#define USB_DEVICE_ID_STEAM_CONTROLLER_WIRELESS 0x1142
1019+
10151020
#define USB_VENDOR_ID_STEELSERIES 0x1038
10161021
#define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410
10171022

0 commit comments

Comments
 (0)