Skip to content

Commit c2848f2

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: - appoint Benjamin Tissoires as co-maintainer / designated reviewer - sysfs report_descriptor visibility fix for unclaimed devices, from Andy Lutomirski - suspend/resume fixes for Sony driver from Frank Praznik - IRQ deadlock fix from Ioan-Adrian Ratiu - hid-i2c fixes affecting (at least) Yoga 900 from Mika Westerberg and Srinivas Pandruvada - a lot of new device support (especially, but not limited to, Wacom) and assorted small misc fixes - almost complete G920 support; the only bit that is missing is switching the device to HID mode automatically; Simon Wood and Michal Maly are working on it. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (46 commits) Revert "INPUT: xpad: switch Logitech G920 Wheel into HID mode" HID: sensor-hub: Add quirk for Lenovo Yoga 900 with ITE Chips HID: Add new PID for Microchip Pick16F1454 HID: wacom: Use correct report to query pen ID from INTUOSHT2 devices HID: i2c-hid: Prevent sending reports from racing with device reset HID: use kobj_to_dev() HID: wiimote: use dev_to_wii() HID: add a new helper to_hid_driver() HID: use to_hid_device() HID: move to_hid_device() to hid.h HID: usbhid: use to_usb_device HID: corsair: Convert to use module_hid_driver HID: input: ignore the battery in OKLICK Laser BTmouse HID: wacom: Fix pad button range for CINTIQ_COMPANION_2 HID: wacom: Fix touchring value reporting HID: wacom: Report 'strip2' values in ABS_RY HID: wacom: Limit touchstrip data to 13 bits HID: wacom: bitwise vs logical ORs HID: wacom: Apply lowres quirk to BAMBOO_TOUCH devices HID: enable hid device to suspend/resume asynchronously ...
2 parents 75f26df + 83f1bfd commit c2848f2

35 files changed

+819
-574
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4984,6 +4984,7 @@ F: arch/*/include/asm/suspend*.h
49844984

49854985
HID CORE LAYER
49864986
M: Jiri Kosina <[email protected]>
4987+
R: Benjamin Tissoires <[email protected]>
49874988
49884989
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
49894990
S: Maintained
@@ -11162,6 +11163,7 @@ F: include/linux/usb/gadget*
1116211163

1116311164
USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
1116411165
M: Jiri Kosina <[email protected]>
11166+
R: Benjamin Tissoires <[email protected]>
1116511167
1116611168
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
1116711169
S: Maintained

drivers/hid/hid-core.c

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ static void hid_close_report(struct hid_device *device)
625625

626626
static void hid_device_release(struct device *dev)
627627
{
628-
struct hid_device *hid = container_of(dev, struct hid_device, dev);
628+
struct hid_device *hid = to_hid_device(dev);
629629

630630
hid_close_report(hid);
631631
kfree(hid->dev_rdesc);
@@ -1571,8 +1571,8 @@ read_report_descriptor(struct file *filp, struct kobject *kobj,
15711571
struct bin_attribute *attr,
15721572
char *buf, loff_t off, size_t count)
15731573
{
1574-
struct device *dev = container_of(kobj, struct device, kobj);
1575-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1574+
struct device *dev = kobj_to_dev(kobj);
1575+
struct hid_device *hdev = to_hid_device(dev);
15761576

15771577
if (off >= hdev->rsize)
15781578
return 0;
@@ -1589,7 +1589,7 @@ static ssize_t
15891589
show_country(struct device *dev, struct device_attribute *attr,
15901590
char *buf)
15911591
{
1592-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1592+
struct hid_device *hdev = to_hid_device(dev);
15931593

15941594
return sprintf(buf, "%02x\n", hdev->country & 0xff);
15951595
}
@@ -1691,11 +1691,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
16911691
hid_warn(hdev,
16921692
"can't create sysfs country code attribute err: %d\n", ret);
16931693

1694-
ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
1695-
if (ret)
1696-
hid_warn(hdev,
1697-
"can't create sysfs report descriptor attribute err: %d\n", ret);
1698-
16991694
hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
17001695
buf, bus, hdev->version >> 8, hdev->version & 0xff,
17011696
type, hdev->name, hdev->phys);
@@ -1707,7 +1702,6 @@ EXPORT_SYMBOL_GPL(hid_connect);
17071702
void hid_disconnect(struct hid_device *hdev)
17081703
{
17091704
device_remove_file(&hdev->dev, &dev_attr_country);
1710-
device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
17111705
if (hdev->claimed & HID_CLAIMED_INPUT)
17121706
hidinput_disconnect(hdev);
17131707
if (hdev->claimed & HID_CLAIMED_HIDDEV)
@@ -1902,6 +1896,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
19021896
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
19031897
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
19041898
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) },
1899+
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
19051900
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
19061901
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
19071902
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
@@ -2076,7 +2071,7 @@ struct hid_dynid {
20762071
static ssize_t store_new_id(struct device_driver *drv, const char *buf,
20772072
size_t count)
20782073
{
2079-
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
2074+
struct hid_driver *hdrv = to_hid_driver(drv);
20802075
struct hid_dynid *dynid;
20812076
__u32 bus, vendor, product;
20822077
unsigned long driver_data = 0;
@@ -2138,17 +2133,16 @@ static const struct hid_device_id *hid_match_device(struct hid_device *hdev,
21382133

21392134
static int hid_bus_match(struct device *dev, struct device_driver *drv)
21402135
{
2141-
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
2142-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
2136+
struct hid_driver *hdrv = to_hid_driver(drv);
2137+
struct hid_device *hdev = to_hid_device(dev);
21432138

21442139
return hid_match_device(hdev, hdrv) != NULL;
21452140
}
21462141

21472142
static int hid_device_probe(struct device *dev)
21482143
{
2149-
struct hid_driver *hdrv = container_of(dev->driver,
2150-
struct hid_driver, driver);
2151-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
2144+
struct hid_driver *hdrv = to_hid_driver(dev->driver);
2145+
struct hid_device *hdev = to_hid_device(dev);
21522146
const struct hid_device_id *id;
21532147
int ret = 0;
21542148

@@ -2190,7 +2184,7 @@ static int hid_device_probe(struct device *dev)
21902184

21912185
static int hid_device_remove(struct device *dev)
21922186
{
2193-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
2187+
struct hid_device *hdev = to_hid_device(dev);
21942188
struct hid_driver *hdrv;
21952189
int ret = 0;
21962190

@@ -2223,24 +2217,29 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
22232217
char *buf)
22242218
{
22252219
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
2226-
int len;
2227-
2228-
len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2229-
hdev->bus, hdev->group, hdev->vendor, hdev->product);
22302220

2231-
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
2221+
return scnprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
2222+
hdev->bus, hdev->group, hdev->vendor, hdev->product);
22322223
}
22332224
static DEVICE_ATTR_RO(modalias);
22342225

22352226
static struct attribute *hid_dev_attrs[] = {
22362227
&dev_attr_modalias.attr,
22372228
NULL,
22382229
};
2239-
ATTRIBUTE_GROUPS(hid_dev);
2230+
static struct bin_attribute *hid_dev_bin_attrs[] = {
2231+
&dev_bin_attr_report_desc,
2232+
NULL
2233+
};
2234+
static const struct attribute_group hid_dev_group = {
2235+
.attrs = hid_dev_attrs,
2236+
.bin_attrs = hid_dev_bin_attrs,
2237+
};
2238+
__ATTRIBUTE_GROUPS(hid_dev);
22402239

22412240
static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
22422241
{
2243-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
2242+
struct hid_device *hdev = to_hid_device(dev);
22442243

22452244
if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
22462245
hdev->bus, hdev->vendor, hdev->product))
@@ -2408,6 +2407,7 @@ static const struct hid_device_id hid_ignore_list[] = {
24082407
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
24092408
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) },
24102409
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) },
2410+
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454_V2) },
24112411
{ HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) },
24122412
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) },
24132413
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) },
@@ -2660,6 +2660,7 @@ struct hid_device *hid_allocate_device(void)
26602660
device_initialize(&hdev->dev);
26612661
hdev->dev.release = hid_device_release;
26622662
hdev->dev.bus = &hid_bus_type;
2663+
device_enable_async_suspend(&hdev->dev);
26632664

26642665
hid_close_report(hdev);
26652666

drivers/hid/hid-corsair.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,7 @@ static struct hid_driver corsair_driver = {
655655
.input_mapping = corsair_input_mapping,
656656
};
657657

658-
static int __init corsair_init(void)
659-
{
660-
return hid_register_driver(&corsair_driver);
661-
}
662-
663-
static void corsair_exit(void)
664-
{
665-
hid_unregister_driver(&corsair_driver);
666-
}
667-
668-
module_init(corsair_init);
669-
module_exit(corsair_exit);
658+
module_hid_driver(corsair_driver);
670659

671660
MODULE_LICENSE("GPL");
672661
MODULE_AUTHOR("Clement Vuchener");

drivers/hid/hid-cp2112.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static ssize_t name##_store(struct device *kdev, \
807807
struct device_attribute *attr, const char *buf, \
808808
size_t count) \
809809
{ \
810-
struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
810+
struct hid_device *hdev = to_hid_device(kdev); \
811811
struct cp2112_usb_config_report cfg; \
812812
int ret = cp2112_get_usb_config(hdev, &cfg); \
813813
if (ret) \
@@ -822,7 +822,7 @@ static ssize_t name##_store(struct device *kdev, \
822822
static ssize_t name##_show(struct device *kdev, \
823823
struct device_attribute *attr, char *buf) \
824824
{ \
825-
struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
825+
struct hid_device *hdev = to_hid_device(kdev); \
826826
struct cp2112_usb_config_report cfg; \
827827
int ret = cp2112_get_usb_config(hdev, &cfg); \
828828
if (ret) \
@@ -887,7 +887,7 @@ static ssize_t pstr_store(struct device *kdev,
887887
struct device_attribute *kattr, const char *buf,
888888
size_t count)
889889
{
890-
struct hid_device *hdev = container_of(kdev, struct hid_device, dev);
890+
struct hid_device *hdev = to_hid_device(kdev);
891891
struct cp2112_pstring_attribute *attr =
892892
container_of(kattr, struct cp2112_pstring_attribute, attr);
893893
struct cp2112_string_report report;
@@ -918,7 +918,7 @@ static ssize_t pstr_store(struct device *kdev,
918918
static ssize_t pstr_show(struct device *kdev,
919919
struct device_attribute *kattr, char *buf)
920920
{
921-
struct hid_device *hdev = container_of(kdev, struct hid_device, dev);
921+
struct hid_device *hdev = to_hid_device(kdev);
922922
struct cp2112_pstring_attribute *attr =
923923
container_of(kattr, struct cp2112_pstring_attribute, attr);
924924
struct cp2112_string_report report;

drivers/hid/hid-debug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,13 @@ EXPORT_SYMBOL_GPL(hid_dump_device);
659659
/* enqueue string to 'events' ring buffer */
660660
void hid_debug_event(struct hid_device *hdev, char *buf)
661661
{
662-
int i;
662+
unsigned i;
663663
struct hid_debug_list *list;
664664
unsigned long flags;
665665

666666
spin_lock_irqsave(&hdev->debug_list_lock, flags);
667667
list_for_each_entry(list, &hdev->debug_list, node) {
668-
for (i = 0; i < strlen(buf); i++)
668+
for (i = 0; buf[i]; i++)
669669
list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
670670
buf[i];
671671
list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;

drivers/hid/hid-gt683r.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void gt683r_brightness_set(struct led_classdev *led_cdev,
7070
{
7171
int i;
7272
struct device *dev = led_cdev->dev->parent;
73-
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
73+
struct hid_device *hdev = to_hid_device(dev);
7474
struct gt683r_led *led = hid_get_drvdata(hdev);
7575

7676
for (i = 0; i < GT683R_LED_COUNT; i++) {
@@ -89,8 +89,7 @@ static ssize_t mode_show(struct device *dev,
8989
char *buf)
9090
{
9191
u8 sysfs_mode;
92-
struct hid_device *hdev = container_of(dev->parent,
93-
struct hid_device, dev);
92+
struct hid_device *hdev = to_hid_device(dev->parent);
9493
struct gt683r_led *led = hid_get_drvdata(hdev);
9594

9695
if (led->mode == GT683R_LED_NORMAL)
@@ -108,8 +107,7 @@ static ssize_t mode_store(struct device *dev,
108107
const char *buf, size_t count)
109108
{
110109
u8 sysfs_mode;
111-
struct hid_device *hdev = container_of(dev->parent,
112-
struct hid_device, dev);
110+
struct hid_device *hdev = to_hid_device(dev->parent);
113111
struct gt683r_led *led = hid_get_drvdata(hdev);
114112

115113

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@
510510
#define USB_VENDOR_ID_ITE 0x048d
511511
#define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
512512
#define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
513+
#define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396
513514

514515
#define USB_VENDOR_ID_JABRA 0x0b0e
515516
#define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412
@@ -615,6 +616,7 @@
615616
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
616617
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
617618
#define USB_DEVICE_ID_LOGITECH_G29_WHEEL 0xc24f
619+
#define USB_DEVICE_ID_LOGITECH_G920_WHEEL 0xc262
618620
#define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283
619621
#define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286
620622
#define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287
@@ -664,6 +666,7 @@
664666
#define USB_DEVICE_ID_PICOLCD 0xc002
665667
#define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002
666668
#define USB_DEVICE_ID_PICK16F1454 0x0042
669+
#define USB_DEVICE_ID_PICK16F1454_V2 0xf2f7
667670

668671
#define USB_VENDOR_ID_MICROSOFT 0x045e
669672
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b

drivers/hid/hid-input.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ static enum power_supply_property hidinput_battery_props[] = {
303303

304304
#define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */
305305
#define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */
306+
#define HID_BATTERY_QUIRK_IGNORE (1 << 2) /* completely ignore the battery */
306307

307308
static const struct hid_device_id hid_battery_quirks[] = {
308309
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
@@ -320,6 +321,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
320321
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
321322
USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
322323
HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
324+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
325+
USB_DEVICE_ID_ELECOM_BM084),
326+
HID_BATTERY_QUIRK_IGNORE },
323327
{}
324328
};
325329

@@ -408,6 +412,14 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
408412
if (dev->battery != NULL)
409413
goto out; /* already initialized? */
410414

415+
quirks = find_battery_quirk(dev);
416+
417+
hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
418+
dev->bus, dev->vendor, dev->product, dev->version, quirks);
419+
420+
if (quirks & HID_BATTERY_QUIRK_IGNORE)
421+
goto out;
422+
411423
psy_desc = kzalloc(sizeof(*psy_desc), GFP_KERNEL);
412424
if (psy_desc == NULL)
413425
goto out;
@@ -424,11 +436,6 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
424436
psy_desc->use_for_apm = 0;
425437
psy_desc->get_property = hidinput_get_battery_property;
426438

427-
quirks = find_battery_quirk(dev);
428-
429-
hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
430-
dev->bus, dev->vendor, dev->product, dev->version, quirks);
431-
432439
min = field->logical_minimum;
433440
max = field->logical_maximum;
434441

@@ -960,6 +967,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
960967
goto ignore;
961968

962969
case HID_UP_LOGIVENDOR:
970+
/* intentional fallback */
971+
case HID_UP_LOGIVENDOR2:
972+
/* intentional fallback */
973+
case HID_UP_LOGIVENDOR3:
963974
goto ignore;
964975

965976
case HID_UP_PID:

0 commit comments

Comments
 (0)