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:

 - 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
  ...
  • Loading branch information
Linus Torvalds committed Jan 15, 2016
2 parents 75f26df + 83f1bfd commit c2848f2
Show file tree
Hide file tree
Showing 35 changed files with 819 additions and 574 deletions.
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4984,6 +4984,7 @@ F: arch/*/include/asm/suspend*.h

HID CORE LAYER
M: Jiri Kosina <jikos@kernel.org>
R: Benjamin Tissoires <benjamin.tissoires@redhat.com>
L: linux-input@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
S: Maintained
Expand Down Expand Up @@ -11162,6 +11163,7 @@ F: include/linux/usb/gadget*

USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
M: Jiri Kosina <jikos@kernel.org>
R: Benjamin Tissoires <benjamin.tissoires@redhat.com>
L: linux-usb@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
S: Maintained
Expand Down
49 changes: 25 additions & 24 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ static void hid_close_report(struct hid_device *device)

static void hid_device_release(struct device *dev)
{
struct hid_device *hid = container_of(dev, struct hid_device, dev);
struct hid_device *hid = to_hid_device(dev);

hid_close_report(hid);
kfree(hid->dev_rdesc);
Expand Down Expand Up @@ -1571,8 +1571,8 @@ read_report_descriptor(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct device *dev = kobj_to_dev(kobj);
struct hid_device *hdev = to_hid_device(dev);

if (off >= hdev->rsize)
return 0;
Expand All @@ -1589,7 +1589,7 @@ static ssize_t
show_country(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev);

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

ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
if (ret)
hid_warn(hdev,
"can't create sysfs report descriptor attribute err: %d\n", ret);

hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
buf, bus, hdev->version >> 8, hdev->version & 0xff,
type, hdev->name, hdev->phys);
Expand All @@ -1707,7 +1702,6 @@ EXPORT_SYMBOL_GPL(hid_connect);
void hid_disconnect(struct hid_device *hdev)
{
device_remove_file(&hdev->dev, &dev_attr_country);
device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
if (hdev->claimed & HID_CLAIMED_INPUT)
hidinput_disconnect(hdev);
if (hdev->claimed & HID_CLAIMED_HIDDEV)
Expand Down Expand Up @@ -1902,6 +1896,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
Expand Down Expand Up @@ -2076,7 +2071,7 @@ struct hid_dynid {
static ssize_t store_new_id(struct device_driver *drv, const char *buf,
size_t count)
{
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
struct hid_driver *hdrv = to_hid_driver(drv);
struct hid_dynid *dynid;
__u32 bus, vendor, product;
unsigned long driver_data = 0;
Expand Down Expand Up @@ -2138,17 +2133,16 @@ static const struct hid_device_id *hid_match_device(struct hid_device *hdev,

static int hid_bus_match(struct device *dev, struct device_driver *drv)
{
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_driver *hdrv = to_hid_driver(drv);
struct hid_device *hdev = to_hid_device(dev);

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

static int hid_device_probe(struct device *dev)
{
struct hid_driver *hdrv = container_of(dev->driver,
struct hid_driver, driver);
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_driver *hdrv = to_hid_driver(dev->driver);
struct hid_device *hdev = to_hid_device(dev);
const struct hid_device_id *id;
int ret = 0;

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

static int hid_device_remove(struct device *dev)
{
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev);
struct hid_driver *hdrv;
int ret = 0;

Expand Down Expand Up @@ -2223,24 +2217,29 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
char *buf)
{
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
int len;

len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n",
hdev->bus, hdev->group, hdev->vendor, hdev->product);

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

static struct attribute *hid_dev_attrs[] = {
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(hid_dev);
static struct bin_attribute *hid_dev_bin_attrs[] = {
&dev_bin_attr_report_desc,
NULL
};
static const struct attribute_group hid_dev_group = {
.attrs = hid_dev_attrs,
.bin_attrs = hid_dev_bin_attrs,
};
__ATTRIBUTE_GROUPS(hid_dev);

static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev);

if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
hdev->bus, hdev->vendor, hdev->product))
Expand Down Expand Up @@ -2408,6 +2407,7 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454_V2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) },
Expand Down Expand Up @@ -2660,6 +2660,7 @@ struct hid_device *hid_allocate_device(void)
device_initialize(&hdev->dev);
hdev->dev.release = hid_device_release;
hdev->dev.bus = &hid_bus_type;
device_enable_async_suspend(&hdev->dev);

hid_close_report(hdev);

Expand Down
13 changes: 1 addition & 12 deletions drivers/hid/hid-corsair.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,18 +655,7 @@ static struct hid_driver corsair_driver = {
.input_mapping = corsair_input_mapping,
};

static int __init corsair_init(void)
{
return hid_register_driver(&corsair_driver);
}

static void corsair_exit(void)
{
hid_unregister_driver(&corsair_driver);
}

module_init(corsair_init);
module_exit(corsair_exit);
module_hid_driver(corsair_driver);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Clement Vuchener");
Expand Down
8 changes: 4 additions & 4 deletions drivers/hid/hid-cp2112.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static ssize_t name##_store(struct device *kdev, \
struct device_attribute *attr, const char *buf, \
size_t count) \
{ \
struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
struct hid_device *hdev = to_hid_device(kdev); \
struct cp2112_usb_config_report cfg; \
int ret = cp2112_get_usb_config(hdev, &cfg); \
if (ret) \
Expand All @@ -822,7 +822,7 @@ static ssize_t name##_store(struct device *kdev, \
static ssize_t name##_show(struct device *kdev, \
struct device_attribute *attr, char *buf) \
{ \
struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
struct hid_device *hdev = to_hid_device(kdev); \
struct cp2112_usb_config_report cfg; \
int ret = cp2112_get_usb_config(hdev, &cfg); \
if (ret) \
Expand Down Expand Up @@ -887,7 +887,7 @@ static ssize_t pstr_store(struct device *kdev,
struct device_attribute *kattr, const char *buf,
size_t count)
{
struct hid_device *hdev = container_of(kdev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(kdev);
struct cp2112_pstring_attribute *attr =
container_of(kattr, struct cp2112_pstring_attribute, attr);
struct cp2112_string_report report;
Expand Down Expand Up @@ -918,7 +918,7 @@ static ssize_t pstr_store(struct device *kdev,
static ssize_t pstr_show(struct device *kdev,
struct device_attribute *kattr, char *buf)
{
struct hid_device *hdev = container_of(kdev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(kdev);
struct cp2112_pstring_attribute *attr =
container_of(kattr, struct cp2112_pstring_attribute, attr);
struct cp2112_string_report report;
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,13 @@ EXPORT_SYMBOL_GPL(hid_dump_device);
/* enqueue string to 'events' ring buffer */
void hid_debug_event(struct hid_device *hdev, char *buf)
{
int i;
unsigned i;
struct hid_debug_list *list;
unsigned long flags;

spin_lock_irqsave(&hdev->debug_list_lock, flags);
list_for_each_entry(list, &hdev->debug_list, node) {
for (i = 0; i < strlen(buf); i++)
for (i = 0; buf[i]; i++)
list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
buf[i];
list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
Expand Down
8 changes: 3 additions & 5 deletions drivers/hid/hid-gt683r.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void gt683r_brightness_set(struct led_classdev *led_cdev,
{
int i;
struct device *dev = led_cdev->dev->parent;
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev);
struct gt683r_led *led = hid_get_drvdata(hdev);

for (i = 0; i < GT683R_LED_COUNT; i++) {
Expand All @@ -89,8 +89,7 @@ static ssize_t mode_show(struct device *dev,
char *buf)
{
u8 sysfs_mode;
struct hid_device *hdev = container_of(dev->parent,
struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev->parent);
struct gt683r_led *led = hid_get_drvdata(hdev);

if (led->mode == GT683R_LED_NORMAL)
Expand All @@ -108,8 +107,7 @@ static ssize_t mode_store(struct device *dev,
const char *buf, size_t count)
{
u8 sysfs_mode;
struct hid_device *hdev = container_of(dev->parent,
struct hid_device, dev);
struct hid_device *hdev = to_hid_device(dev->parent);
struct gt683r_led *led = hid_get_drvdata(hdev);


Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
#define USB_VENDOR_ID_ITE 0x048d
#define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
#define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
#define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396

#define USB_VENDOR_ID_JABRA 0x0b0e
#define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412
Expand Down Expand Up @@ -615,6 +616,7 @@
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
#define USB_DEVICE_ID_LOGITECH_G29_WHEEL 0xc24f
#define USB_DEVICE_ID_LOGITECH_G920_WHEEL 0xc262
#define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283
#define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286
#define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287
Expand Down Expand Up @@ -664,6 +666,7 @@
#define USB_DEVICE_ID_PICOLCD 0xc002
#define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002
#define USB_DEVICE_ID_PICK16F1454 0x0042
#define USB_DEVICE_ID_PICK16F1454_V2 0xf2f7

#define USB_VENDOR_ID_MICROSOFT 0x045e
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
Expand Down
21 changes: 16 additions & 5 deletions drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ static enum power_supply_property hidinput_battery_props[] = {

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

static const struct hid_device_id hid_battery_quirks[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
Expand All @@ -320,6 +321,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
USB_DEVICE_ID_ELECOM_BM084),
HID_BATTERY_QUIRK_IGNORE },
{}
};

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

quirks = find_battery_quirk(dev);

hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
dev->bus, dev->vendor, dev->product, dev->version, quirks);

if (quirks & HID_BATTERY_QUIRK_IGNORE)
goto out;

psy_desc = kzalloc(sizeof(*psy_desc), GFP_KERNEL);
if (psy_desc == NULL)
goto out;
Expand All @@ -424,11 +436,6 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
psy_desc->use_for_apm = 0;
psy_desc->get_property = hidinput_get_battery_property;

quirks = find_battery_quirk(dev);

hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
dev->bus, dev->vendor, dev->product, dev->version, quirks);

min = field->logical_minimum;
max = field->logical_maximum;

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

case HID_UP_LOGIVENDOR:
/* intentional fallback */
case HID_UP_LOGIVENDOR2:
/* intentional fallback */
case HID_UP_LOGIVENDOR3:
goto ignore;

case HID_UP_PID:
Expand Down
Loading

0 comments on commit c2848f2

Please sign in to comment.