Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  ...
  • Loading branch information
Linus Torvalds committed Jun 8, 2018
2 parents 9eb86c7 + 06d8b90 commit fdea70d
Show file tree
Hide file tree
Showing 18 changed files with 1,621 additions and 185 deletions.
16 changes: 16 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,13 @@ config HID_MAYFLASH
Say Y here if you have HJZ Mayflash PS3 game controller adapters
and want to enable force feedback support.

config HID_REDRAGON
tristate "Redragon keyboards"
depends on HID
default !EXPERT
---help---
Support for Redragon keyboards that need fix-ups to work properly.

config HID_MICROSOFT
tristate "Microsoft non-fully HID-compliant devices"
depends on HID
Expand Down Expand Up @@ -838,6 +845,15 @@ config HID_SPEEDLINK
---help---
Support for Speedlink Vicious and Divine Cezanne mouse.

config HID_STEAM
tristate "Steam Controller support"
depends on HID
select POWER_SUPPLY
---help---
Say Y here if you have a Steam Controller if you want to use it
without running the Steam Client. It supports both the wired and
the wireless adaptor.

config HID_STEELSERIES
tristate "Steelseries SRW-S1 steering wheel support"
depends on HID
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ hid-picolcd-$(CONFIG_DEBUG_FS) += hid-picolcd_debugfs.o

obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
obj-$(CONFIG_HID_REDRAGON) += hid-redragon.o
obj-$(CONFIG_HID_RETRODE) += hid-retrode.o
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
Expand All @@ -97,6 +98,7 @@ obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
obj-$(CONFIG_HID_SONY) += hid-sony.o
obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o
obj-$(CONFIG_HID_STEAM) += hid-steam.o
obj-$(CONFIG_HID_STEELSERIES) += hid-steelseries.o
obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
Expand Down
30 changes: 25 additions & 5 deletions drivers/hid/hid-alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
int ret;
u16 check_sum;
u8 *input;
u8 *readbuf;
u8 *readbuf = NULL;

input = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
if (!input)
Expand Down Expand Up @@ -204,8 +204,8 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
goto exit;
}

readbuf = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
if (read_flag) {
readbuf = kzalloc(T4_FEATURE_REPORT_LEN, GFP_KERNEL);
if (!readbuf) {
ret = -ENOMEM;
goto exit;
Expand All @@ -219,22 +219,24 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
goto exit_readbuf;
}

ret = -EINVAL;

if (*(u32 *)&readbuf[6] != address) {
dev_err(&hdev->dev, "read register address error (%x,%x)\n",
*(u32 *)&readbuf[6], address);
*(u32 *)&readbuf[6], address);
goto exit_readbuf;
}

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

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

Expand Down Expand Up @@ -458,17 +460,35 @@ static int __maybe_unused alps_post_reset(struct hid_device *hdev)
case T4:
ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_1,
NULL, T4_I2C_ABS, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_1 (%d)\n",
ret);
goto exit;
}

ret = t4_read_write_register(hdev, T4_PRM_FEED_CONFIG_4,
NULL, T4_FEEDCFG4_ADVANCED_ABS_ENABLE, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_4 (%d)\n",
ret);
goto exit;
}
break;
case U1:
ret = u1_read_write_register(hdev,
ADDRESS_U1_DEV_CTRL_1, NULL,
U1_TP_ABS_MODE | U1_SP_ABS_MODE, false);
if (ret < 0) {
dev_err(&hdev->dev, "failed to change TP mode (%d)\n",
ret);
goto exit;
}
break;
default:
break;
}

exit:
return ret;
}

Expand Down
21 changes: 14 additions & 7 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle
* Register a new report for a device.
*/

struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id)
struct hid_report *hid_register_report(struct hid_device *device,
unsigned int type, unsigned int id,
unsigned int application)
{
struct hid_report_enum *report_enum = device->report_enum + type;
struct hid_report *report;
Expand All @@ -78,6 +80,7 @@ struct hid_report *hid_register_report(struct hid_device *device, unsigned type,
report->type = type;
report->size = 0;
report->device = device;
report->application = application;
report_enum->report_id_hash[id] = report;

list_add_tail(&report->list, &report_enum->report_list);
Expand Down Expand Up @@ -221,11 +224,15 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
{
struct hid_report *report;
struct hid_field *field;
unsigned usages;
unsigned offset;
unsigned i;
unsigned int usages;
unsigned int offset;
unsigned int i;
unsigned int application;

application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);

report = hid_register_report(parser->device, report_type, parser->global.report_id);
report = hid_register_report(parser->device, report_type,
parser->global.report_id, application);
if (!report) {
hid_err(parser->device, "hid_register_report failed\n");
return -1;
Expand Down Expand Up @@ -259,7 +266,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign

field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);
field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL);
field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);
field->application = application;

for (i = 0; i < usages; i++) {
unsigned j = i;
Expand Down Expand Up @@ -1798,7 +1805,7 @@ EXPORT_SYMBOL_GPL(hid_hw_stop);
*
* Tell underlying HW to start delivering events from the device.
* This function should be called sometime after successful call
* to hid_hiw_start().
* to hid_hw_start().
*/
int hid_hw_open(struct hid_device *hdev)
{
Expand Down
15 changes: 15 additions & 0 deletions drivers/hid/hid-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ static bool hid_generic_match(struct hid_device *hdev,
return true;
}

static int hid_generic_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
int ret;

hdev->quirks |= HID_QUIRK_INPUT_PER_APP;

ret = hid_parse(hdev);
if (ret)
return ret;

return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
}

static const struct hid_device_id hid_table[] = {
{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, HID_ANY_ID, HID_ANY_ID) },
{ }
Expand All @@ -66,6 +80,7 @@ static struct hid_driver hid_generic = {
.name = "hid-generic",
.id_table = hid_table,
.match = hid_generic_match,
.probe = hid_generic_probe,
};
module_hid_driver(hid_generic);

Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-gfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static int gfrm_probe(struct hid_device *hdev, const struct hid_device_id *id)
* those reports reach gfrm_raw_event() from hid_input_report().
*/
if (!hid_register_report(hdev, HID_INPUT_REPORT,
GFRM100_SEARCH_KEY_REPORT_ID)) {
GFRM100_SEARCH_KEY_REPORT_ID, 0)) {
ret = -ENOMEM;
goto done;
}
Expand Down
5 changes: 5 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@
#define USB_VENDOR_ID_JESS 0x0c45
#define USB_DEVICE_ID_JESS_YUREX 0x1010
#define USB_DEVICE_ID_ASUS_MD_5112 0x5112
#define USB_DEVICE_ID_REDRAGON_ASURA 0x760b

#define USB_VENDOR_ID_JESS2 0x0f30
#define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111
Expand Down Expand Up @@ -1012,6 +1013,10 @@
#define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403
#define USB_DEVICE_ID_MTP_SITRONIX 0x5001

#define USB_VENDOR_ID_VALVE 0x28de
#define USB_DEVICE_ID_STEAM_CONTROLLER 0x1102
#define USB_DEVICE_ID_STEAM_CONTROLLER_WIRELESS 0x1142

#define USB_VENDOR_ID_STEELSERIES 0x1038
#define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410

Expand Down
Loading

0 comments on commit fdea70d

Please sign in to comment.