diff options
author | Jiri Kosina <jkosina@suse.cz> | 2020-12-16 13:38:38 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2020-12-16 13:38:38 +0300 |
commit | 105856b36c0cefc2fa1c1e649d75da71e2e38c31 (patch) | |
tree | 87adba76a320aa4ef4e122db84af21a9eac93382 /drivers/hid | |
parent | 90c5f4649aafd0bca6f47f67ea0ba596c93a3ab0 (diff) | |
parent | f43d3870cafa2a0f3854c1819c8385733db8f9ae (diff) | |
download | linux-105856b36c0cefc2fa1c1e649d75da71e2e38c31.tar.xz |
Merge branch 'for-5.11/core' into for-linus
- increase of maximum HID report size to 16KB in order to support
some of the modern devices, from Dean Camera
- control interface support for hidraw, from Dean Camera
- stylus battery reporting improvement, from Dmitry Torokhov
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-input.c | 6 | ||||
-rw-r--r-- | drivers/hid/hidraw.c | 24 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 2 |
3 files changed, 30 insertions, 2 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 4dca11392459..dc7f6b4a775c 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -537,9 +537,12 @@ static void hidinput_update_battery(struct hid_device *dev, int value) capacity = hidinput_scale_battery_capacity(dev, value); if (dev->battery_status != HID_BATTERY_REPORTED || - capacity != dev->battery_capacity) { + capacity != dev->battery_capacity || + ktime_after(ktime_get_coarse(), dev->battery_ratelimit_time)) { dev->battery_capacity = capacity; dev->battery_status = HID_BATTERY_REPORTED; + dev->battery_ratelimit_time = + ktime_add_ms(ktime_get_coarse(), 30 * 1000); power_supply_changed(dev->battery); } } @@ -746,6 +749,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel field->flags |= HID_MAIN_ITEM_RELATIVE; break; } + goto unknown; default: goto unknown; } diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 2eee5e31c2b7..79faac87a06f 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -170,7 +170,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t /* * This function performs a Get_Report transfer over the control endpoint * per section 7.2.1 of the HID specification, version 1.1. The first byte - * of buffer is the report number to request, or 0x0 if the defice does not + * of buffer is the report number to request, or 0x0 if the device does not * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT * or HID_INPUT_REPORT. */ @@ -428,6 +428,28 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, break; } + if (_IOC_NR(cmd) == _IOC_NR(HIDIOCSINPUT(0))) { + int len = _IOC_SIZE(cmd); + ret = hidraw_send_report(file, user_arg, len, HID_INPUT_REPORT); + break; + } + if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGINPUT(0))) { + int len = _IOC_SIZE(cmd); + ret = hidraw_get_report(file, user_arg, len, HID_INPUT_REPORT); + break; + } + + if (_IOC_NR(cmd) == _IOC_NR(HIDIOCSOUTPUT(0))) { + int len = _IOC_SIZE(cmd); + ret = hidraw_send_report(file, user_arg, len, HID_OUTPUT_REPORT); + break; + } + if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGOUTPUT(0))) { + int len = _IOC_SIZE(cmd); + ret = hidraw_get_report(file, user_arg, len, HID_OUTPUT_REPORT); + break; + } + /* Begin Read-only ioctls. */ if (_IOC_DIR(cmd) != _IOC_READ) { ret = -EINVAL; diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 17a29ee0ac6c..86257ce6d619 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -438,6 +438,7 @@ static void hid_irq_out(struct urb *urb) break; case -ESHUTDOWN: /* unplug */ unplug = 1; + break; case -EILSEQ: /* protocol error or unplug */ case -EPROTO: /* protocol error or unplug */ case -ECONNRESET: /* unlink */ @@ -489,6 +490,7 @@ static void hid_ctrl(struct urb *urb) break; case -ESHUTDOWN: /* unplug */ unplug = 1; + break; case -EILSEQ: /* protocol error or unplug */ case -EPROTO: /* protocol error or unplug */ case -ECONNRESET: /* unlink */ |