Skip to content

Commit bf36c6b

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - Lenovo X1 Tablet support improvements from Mikael Wikström - "heartbeat" report fix for several Wacom devices from Jason Gerecke - bounds checking fix in hid-roccat from Dan Carpenter - stylus battery reporting fix from Dmitry Torokhov - i2c-hid support for wakeup from suspend-to-idle from Kai-Heng Feng - new driver for Vivaldi devices from Sean O'Brien - other assorted small fixes and device ID additions * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle HID: add vivaldi HID driver HID: hid-input: fix stylus battery reporting HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery HID: i2c-hid: fix kerneldoc warnings in i2c-hid-core.c HID: core: fix kerneldoc warnings in hid-core.c HID: multitouch: Lenovo X1 Tablet Gen2 trackpoint and buttons HID: multitouch: Lenovo X1 Tablet Gen3 trackpoint and buttons HID: alps: clean up indentation issue HID: intel-ish-hid: simplify the return expression of ishtp_bus_remove_device() HID: hid-debug: fix nonblocking read semantics wrt EIO/ERESTARTSYS HID: i2c-hid: Prefer asynchronous probe HID: ite: Add USB id match for Acer One S1003 keyboard dock HID: roccat: add bounds checking in kone_sysfs_write_settings() HID: wiimote: narrow spinlock range in wiimote_hid_event() HID: wiimote: make handlers[] const HID: apple: Add support for Matias wireless keyboard HID: cp2112: Use irqchip template
2 parents 0cd7d97 + 3504e85 commit bf36c6b

File tree

18 files changed

+244
-43
lines changed

18 files changed

+244
-43
lines changed

drivers/hid/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ config HID_GOOGLE_HAMMER
397397
help
398398
Say Y here if you have a Google Hammer device.
399399

400+
config HID_VIVALDI
401+
tristate "Vivaldi Keyboard"
402+
depends on HID
403+
help
404+
Say Y here if you want to enable support for Vivaldi keyboards.
405+
406+
Vivaldi keyboards use a vendor-specific (Google) HID usage to report
407+
how the keys in the top row are physically ordered.
408+
400409
config HID_GT683R
401410
tristate "MSI GT68xR LED support"
402411
depends on LEDS_CLASS && USB_HID

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
5050
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
5151
obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o
5252
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
53+
obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o
5354
obj-$(CONFIG_HID_GT683R) += hid-gt683r.o
5455
obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
5556
obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o

drivers/hid/hid-alps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static int u1_init(struct hid_device *hdev, struct alps_dev *pri_data)
526526

527527
ret = u1_read_write_register(hdev, ADDRESS_U1_NUM_SENS_Y,
528528
&sen_line_num_y, 0, true);
529-
if (ret < 0) {
529+
if (ret < 0) {
530530
dev_err(&hdev->dev, "failed U1_NUM_SENS_Y (%d)\n", ret);
531531
goto exit;
532532
}

drivers/hid/hid-apple.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ static const struct hid_device_id apple_devices[] = {
503503
.driver_data = APPLE_HAS_FN },
504504
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
505505
.driver_data = APPLE_HAS_FN },
506+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
507+
.driver_data = APPLE_HAS_FN },
506508
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS),
507509
.driver_data = APPLE_HAS_FN },
508510
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),

drivers/hid/hid-core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,13 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
814814

815815
if ((parser->global.usage_page << 16) >= HID_UP_MSVENDOR)
816816
parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC;
817+
818+
if ((parser->global.usage_page << 16) == HID_UP_GOOGLEVENDOR)
819+
for (i = 0; i < parser->local.usage_index; i++)
820+
if (parser->local.usage[i] ==
821+
(HID_UP_GOOGLEVENDOR | 0x0001))
822+
parser->device->group =
823+
HID_GROUP_VIVALDI;
817824
}
818825

819826
static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
@@ -920,7 +927,7 @@ static int hid_scan_report(struct hid_device *hid)
920927
/**
921928
* hid_parse_report - parse device report
922929
*
923-
* @device: hid device
930+
* @hid: hid device
924931
* @start: report start
925932
* @size: report size
926933
*
@@ -945,7 +952,7 @@ static const char * const hid_report_names[] = {
945952
/**
946953
* hid_validate_values - validate existing device report's value indexes
947954
*
948-
* @device: hid device
955+
* @hid: hid device
949956
* @type: which report type to examine
950957
* @id: which report ID to examine (0 for first)
951958
* @field_index: which report field to examine
@@ -1444,7 +1451,7 @@ static int search(__s32 *array, __s32 value, unsigned n)
14441451
* hid_match_report - check if driver's raw_event should be called
14451452
*
14461453
* @hid: hid device
1447-
* @report_type: type to match against
1454+
* @report: hid report to match against
14481455
*
14491456
* compare hid->driver->report_table->report_type to report->type
14501457
*/
@@ -2120,7 +2127,7 @@ struct hid_dynid {
21202127

21212128
/**
21222129
* store_new_id - add a new HID device ID to this driver and re-probe devices
2123-
* @driver: target device driver
2130+
* @drv: target device driver
21242131
* @buf: buffer for scanning device ID data
21252132
* @count: input size
21262133
*

drivers/hid/hid-cp2112.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
12351235
struct cp2112_device *dev;
12361236
u8 buf[3];
12371237
struct cp2112_smbus_config_report config;
1238+
struct gpio_irq_chip *girq;
12381239
int ret;
12391240

12401241
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
@@ -1338,6 +1339,15 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
13381339
dev->gc.can_sleep = 1;
13391340
dev->gc.parent = &hdev->dev;
13401341

1342+
girq = &dev->gc.irq;
1343+
girq->chip = &cp2112_gpio_irqchip;
1344+
/* The event comes from the outside so no parent handler */
1345+
girq->parent_handler = NULL;
1346+
girq->num_parents = 0;
1347+
girq->parents = NULL;
1348+
girq->default_type = IRQ_TYPE_NONE;
1349+
girq->handler = handle_simple_irq;
1350+
13411351
ret = gpiochip_add_data(&dev->gc, dev);
13421352
if (ret < 0) {
13431353
hid_err(hdev, "error registering gpio chip\n");
@@ -1353,17 +1363,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
13531363
chmod_sysfs_attrs(hdev);
13541364
hid_hw_power(hdev, PM_HINT_NORMAL);
13551365

1356-
ret = gpiochip_irqchip_add(&dev->gc, &cp2112_gpio_irqchip, 0,
1357-
handle_simple_irq, IRQ_TYPE_NONE);
1358-
if (ret) {
1359-
dev_err(dev->gc.parent, "failed to add IRQ chip\n");
1360-
goto err_sysfs_remove;
1361-
}
1362-
13631366
return ret;
13641367

1365-
err_sysfs_remove:
1366-
sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group);
13671368
err_gpiochip_remove:
13681369
gpiochip_remove(&dev->gc);
13691370
err_free_i2c:

drivers/hid/hid-debug.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,6 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
11011101
set_current_state(TASK_INTERRUPTIBLE);
11021102

11031103
while (kfifo_is_empty(&list->hid_debug_fifo)) {
1104-
if (file->f_flags & O_NONBLOCK) {
1105-
ret = -EAGAIN;
1106-
break;
1107-
}
1108-
11091104
if (signal_pending(current)) {
11101105
ret = -ERESTARTSYS;
11111106
break;
@@ -1122,6 +1117,11 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
11221117
goto out;
11231118
}
11241119

1120+
if (file->f_flags & O_NONBLOCK) {
1121+
ret = -EAGAIN;
1122+
break;
1123+
}
1124+
11251125
/* allow O_NONBLOCK from other threads */
11261126
mutex_unlock(&list->read_mutex);
11271127
schedule();

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@
727727
#define USB_DEVICE_ID_LENOVO_TP10UBKBD 0x6062
728728
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
729729
#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
730+
#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
731+
#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5
730732
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d
731733
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019
732734
#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e
@@ -1123,6 +1125,7 @@
11231125
#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
11241126
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
11251127
#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
1128+
#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5
11261129
#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
11271130

11281131
#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047

drivers/hid/hid-input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
797797
case 0x3b: /* Battery Strength */
798798
hidinput_setup_battery(device, HID_INPUT_REPORT, field);
799799
usage->type = EV_PWR;
800-
goto ignore;
800+
return;
801801

802802
case 0x3c: /* Invert */
803803
map_key_clear(BTN_TOOL_RUBBER);
@@ -1059,7 +1059,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
10591059
case HID_DC_BATTERYSTRENGTH:
10601060
hidinput_setup_battery(device, HID_INPUT_REPORT, field);
10611061
usage->type = EV_PWR;
1062-
goto ignore;
1062+
return;
10631063
}
10641064
goto unknown;
10651065

drivers/hid/hid-ite.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ static const struct hid_device_id ite_devices[] = {
4444
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
4545
USB_VENDOR_ID_SYNAPTICS,
4646
USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
47+
/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */
48+
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
49+
USB_VENDOR_ID_SYNAPTICS,
50+
USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003) },
4751
{ }
4852
};
4953
MODULE_DEVICE_TABLE(hid, ite_devices);

drivers/hid/hid-multitouch.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,18 @@ static const struct hid_device_id mt_devices[] = {
19731973
HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
19741974
USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) },
19751975

1976+
/* Lenovo X1 TAB Gen 2 */
1977+
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
1978+
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
1979+
USB_VENDOR_ID_LENOVO,
1980+
USB_DEVICE_ID_LENOVO_X1_TAB) },
1981+
1982+
/* Lenovo X1 TAB Gen 3 */
1983+
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
1984+
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
1985+
USB_VENDOR_ID_LENOVO,
1986+
USB_DEVICE_ID_LENOVO_X1_TAB3) },
1987+
19761988
/* MosArt panels */
19771989
{ .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
19781990
MT_USB_DEVICE(USB_VENDOR_ID_ASUS,

drivers/hid/hid-roccat-kone.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,31 +294,40 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj,
294294
struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
295295
struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
296296
int retval = 0, difference, old_profile;
297+
struct kone_settings *settings = (struct kone_settings *)buf;
297298

298299
/* I need to get my data in one piece */
299300
if (off != 0 || count != sizeof(struct kone_settings))
300301
return -EINVAL;
301302

302303
mutex_lock(&kone->kone_lock);
303-
difference = memcmp(buf, &kone->settings, sizeof(struct kone_settings));
304+
difference = memcmp(settings, &kone->settings,
305+
sizeof(struct kone_settings));
304306
if (difference) {
305-
retval = kone_set_settings(usb_dev,
306-
(struct kone_settings const *)buf);
307-
if (retval) {
308-
mutex_unlock(&kone->kone_lock);
309-
return retval;
307+
if (settings->startup_profile < 1 ||
308+
settings->startup_profile > 5) {
309+
retval = -EINVAL;
310+
goto unlock;
310311
}
311312

313+
retval = kone_set_settings(usb_dev, settings);
314+
if (retval)
315+
goto unlock;
316+
312317
old_profile = kone->settings.startup_profile;
313-
memcpy(&kone->settings, buf, sizeof(struct kone_settings));
318+
memcpy(&kone->settings, settings, sizeof(struct kone_settings));
314319

315320
kone_profile_activated(kone, kone->settings.startup_profile);
316321

317322
if (kone->settings.startup_profile != old_profile)
318323
kone_profile_report(kone, kone->settings.startup_profile);
319324
}
325+
unlock:
320326
mutex_unlock(&kone->kone_lock);
321327

328+
if (retval)
329+
return retval;
330+
322331
return sizeof(struct kone_settings);
323332
}
324333
static BIN_ATTR(settings, 0660, kone_sysfs_read_settings,

0 commit comments

Comments
 (0)