diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-17 20:34:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-17 20:34:33 -0400 |
commit | dcc4c2f61cdc7e0ab61b25b8d28205302497a8c4 (patch) | |
tree | 240ec9f0352d35e78936eb95b61399a71440b68b | |
parent | 0b86c75db6e7f68c22ac5d0dae0f551c4897cdf5 (diff) | |
parent | 66bc5ba5236519297d4ba2b52cdb6fc003a897d3 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
"No biggies this time:
- micro-optimization of implement() in HID core parses, from Dmitry
Torokhov
- thingm driver cleanups from Heiner Kallweit
- fine-graining detection of distance and tilt axes in wacom driver
from Jason Gerecke
- New hid-asus driver, currently supporting X205TA and VivoBook
E200HA, from Yusuke Fujimaki"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: wacom: Add fuzz factor to distance and tilt axes
HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB)
HID: thingm: remove not needed error message
HID: thingm: set new flag LED_HW_PLUGGABLE
HID: thingm: factor out duplicated code to thingm_init_led
HID: simplify implement() a bit
HID: asus: add support for VivoBook E200HA
HID: hidraw: silence an uninitialized variable warning
HID: roccat: silence an uninitialized variable warning
HID: Asus X205TA keyboard driver
HID: hidraw: switch to using memdup_user
-rw-r--r-- | drivers/hid/Kconfig | 10 | ||||
-rw-r--r-- | drivers/hid/Makefile | 1 | ||||
-rw-r--r-- | drivers/hid/hid-asus.c | 52 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 34 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 8 | ||||
-rw-r--r-- | drivers/hid/hid-roccat.c | 5 | ||||
-rw-r--r-- | drivers/hid/hid-thingm.c | 49 | ||||
-rw-r--r-- | drivers/hid/hidraw.c | 18 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 5 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 3 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 13 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 1 |
12 files changed, 126 insertions, 73 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 411722570035..5646ca4b95de 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -134,6 +134,16 @@ config HID_APPLEIR | |||
134 | 134 | ||
135 | Say Y here if you want support for Apple infrared remote control. | 135 | Say Y here if you want support for Apple infrared remote control. |
136 | 136 | ||
137 | config HID_ASUS | ||
138 | tristate "Asus" | ||
139 | depends on I2C_HID | ||
140 | ---help--- | ||
141 | Support for Asus notebook built-in keyboard via i2c. | ||
142 | |||
143 | Supported devices: | ||
144 | - EeeBook X205TA | ||
145 | - VivoBook E200HA | ||
146 | |||
137 | config HID_AUREAL | 147 | config HID_AUREAL |
138 | tristate "Aureal" | 148 | tristate "Aureal" |
139 | depends on HID | 149 | depends on HID |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index be56ab6f75a8..a2fb562de748 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -24,6 +24,7 @@ obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o | |||
24 | obj-$(CONFIG_HID_ACRUX) += hid-axff.o | 24 | obj-$(CONFIG_HID_ACRUX) += hid-axff.o |
25 | obj-$(CONFIG_HID_APPLE) += hid-apple.o | 25 | obj-$(CONFIG_HID_APPLE) += hid-apple.o |
26 | obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o | 26 | obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o |
27 | obj-$(CONFIG_HID_ASUS) += hid-asus.o | ||
27 | obj-$(CONFIG_HID_AUREAL) += hid-aureal.o | 28 | obj-$(CONFIG_HID_AUREAL) += hid-aureal.o |
28 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o | 29 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o |
29 | obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o | 30 | obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o |
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c new file mode 100644 index 000000000000..7a811ec4f2e1 --- /dev/null +++ b/drivers/hid/hid-asus.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * HID driver for Asus notebook built-in keyboard. | ||
3 | * Fixes small logical maximum to match usage maximum. | ||
4 | * | ||
5 | * Currently supported devices are: | ||
6 | * EeeBook X205TA | ||
7 | * VivoBook E200HA | ||
8 | * | ||
9 | * Copyright (c) 2016 Yusuke Fujimaki <usk.fujimaki@gmail.com> | ||
10 | * | ||
11 | * This module based on hid-ortek by | ||
12 | * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> | ||
13 | * Copyright (c) 2011 Jiri Kosina | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * This program is free software; you can redistribute it and/or modify it | ||
18 | * under the terms of the GNU General Public License as published by the Free | ||
19 | * Software Foundation; either version 2 of the License, or (at your option) | ||
20 | * any later version. | ||
21 | */ | ||
22 | |||
23 | #include <linux/device.h> | ||
24 | #include <linux/hid.h> | ||
25 | #include <linux/module.h> | ||
26 | |||
27 | #include "hid-ids.h" | ||
28 | |||
29 | static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
30 | unsigned int *rsize) | ||
31 | { | ||
32 | if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x65) { | ||
33 | hid_info(hdev, "Fixing up Asus notebook report descriptor\n"); | ||
34 | rdesc[55] = 0xdd; | ||
35 | } | ||
36 | return rdesc; | ||
37 | } | ||
38 | |||
39 | static const struct hid_device_id asus_devices[] = { | ||
40 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) }, | ||
41 | { } | ||
42 | }; | ||
43 | MODULE_DEVICE_TABLE(hid, asus_devices); | ||
44 | |||
45 | static struct hid_driver asus_driver = { | ||
46 | .name = "asus", | ||
47 | .id_table = asus_devices, | ||
48 | .report_fixup = asus_report_fixup | ||
49 | }; | ||
50 | module_hid_driver(asus_driver); | ||
51 | |||
52 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 4f9c5c6deaed..8ea3a26360e9 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1129,49 +1129,46 @@ EXPORT_SYMBOL_GPL(hid_field_extract); | |||
1129 | static void __implement(u8 *report, unsigned offset, int n, u32 value) | 1129 | static void __implement(u8 *report, unsigned offset, int n, u32 value) |
1130 | { | 1130 | { |
1131 | unsigned int idx = offset / 8; | 1131 | unsigned int idx = offset / 8; |
1132 | unsigned int size = offset + n; | ||
1133 | unsigned int bit_shift = offset % 8; | 1132 | unsigned int bit_shift = offset % 8; |
1134 | int bits_to_set = 8 - bit_shift; | 1133 | int bits_to_set = 8 - bit_shift; |
1135 | u8 bit_mask = 0xff << bit_shift; | ||
1136 | 1134 | ||
1137 | while (n - bits_to_set >= 0) { | 1135 | while (n - bits_to_set >= 0) { |
1138 | report[idx] &= ~bit_mask; | 1136 | report[idx] &= ~(0xff << bit_shift); |
1139 | report[idx] |= value << bit_shift; | 1137 | report[idx] |= value << bit_shift; |
1140 | value >>= bits_to_set; | 1138 | value >>= bits_to_set; |
1141 | n -= bits_to_set; | 1139 | n -= bits_to_set; |
1142 | bits_to_set = 8; | 1140 | bits_to_set = 8; |
1143 | bit_mask = 0xff; | ||
1144 | bit_shift = 0; | 1141 | bit_shift = 0; |
1145 | idx++; | 1142 | idx++; |
1146 | } | 1143 | } |
1147 | 1144 | ||
1148 | /* last nibble */ | 1145 | /* last nibble */ |
1149 | if (n) { | 1146 | if (n) { |
1150 | if (size % 8) | 1147 | u8 bit_mask = ((1U << n) - 1); |
1151 | bit_mask &= (1U << (size % 8)) - 1; | 1148 | report[idx] &= ~(bit_mask << bit_shift); |
1152 | report[idx] &= ~bit_mask; | 1149 | report[idx] |= value << bit_shift; |
1153 | report[idx] |= (value << bit_shift) & bit_mask; | ||
1154 | } | 1150 | } |
1155 | } | 1151 | } |
1156 | 1152 | ||
1157 | static void implement(const struct hid_device *hid, u8 *report, | 1153 | static void implement(const struct hid_device *hid, u8 *report, |
1158 | unsigned offset, unsigned n, u32 value) | 1154 | unsigned offset, unsigned n, u32 value) |
1159 | { | 1155 | { |
1160 | u64 m; | 1156 | if (unlikely(n > 32)) { |
1161 | |||
1162 | if (n > 32) { | ||
1163 | hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", | 1157 | hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", |
1164 | __func__, n, current->comm); | 1158 | __func__, n, current->comm); |
1165 | n = 32; | 1159 | n = 32; |
1160 | } else if (n < 32) { | ||
1161 | u32 m = (1U << n) - 1; | ||
1162 | |||
1163 | if (unlikely(value > m)) { | ||
1164 | hid_warn(hid, | ||
1165 | "%s() called with too large value %d (n: %d)! (%s)\n", | ||
1166 | __func__, value, n, current->comm); | ||
1167 | WARN_ON(1); | ||
1168 | value &= m; | ||
1169 | } | ||
1166 | } | 1170 | } |
1167 | 1171 | ||
1168 | m = (1ULL << n) - 1; | ||
1169 | if (value > m) | ||
1170 | hid_warn(hid, "%s() called with too large value %d! (%s)\n", | ||
1171 | __func__, value, current->comm); | ||
1172 | WARN_ON(value > m); | ||
1173 | value &= m; | ||
1174 | |||
1175 | __implement(report, offset, n, value); | 1172 | __implement(report, offset, n, value); |
1176 | } | 1173 | } |
1177 | 1174 | ||
@@ -1856,6 +1853,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1856 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, | 1853 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, |
1857 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 1854 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
1858 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 1855 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
1856 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) }, | ||
1859 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, | 1857 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, |
1860 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, | 1858 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
1861 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, | 1859 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0238f0169e48..3eec09a134cb 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -163,6 +163,7 @@ | |||
163 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 | 163 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 |
164 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 | 164 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 |
165 | #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b | 165 | #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b |
166 | #define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585 | ||
166 | 167 | ||
167 | #define USB_VENDOR_ID_ATEN 0x0557 | 168 | #define USB_VENDOR_ID_ATEN 0x0557 |
168 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | 169 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 |
@@ -258,6 +259,13 @@ | |||
258 | #define USB_VENDOR_ID_CORSAIR 0x1b1c | 259 | #define USB_VENDOR_ID_CORSAIR 0x1b1c |
259 | #define USB_DEVICE_ID_CORSAIR_K90 0x1b02 | 260 | #define USB_DEVICE_ID_CORSAIR_K90 0x1b02 |
260 | 261 | ||
262 | #define USB_VENDOR_ID_CORSAIR 0x1b1c | ||
263 | #define USB_DEVICE_ID_CORSAIR_K70R 0x1b09 | ||
264 | #define USB_DEVICE_ID_CORSAIR_K95RGB 0x1b11 | ||
265 | #define USB_DEVICE_ID_CORSAIR_M65RGB 0x1b12 | ||
266 | #define USB_DEVICE_ID_CORSAIR_K70RGB 0x1b13 | ||
267 | #define USB_DEVICE_ID_CORSAIR_K65RGB 0x1b17 | ||
268 | |||
261 | #define USB_VENDOR_ID_CREATIVELABS 0x041e | 269 | #define USB_VENDOR_ID_CREATIVELABS 0x041e |
262 | #define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c | 270 | #define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c |
263 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 | 271 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 |
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index 65c4ccfcbd29..76d06cf87b2a 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c | |||
@@ -421,14 +421,13 @@ static int __init roccat_init(void) | |||
421 | 421 | ||
422 | retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR, | 422 | retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR, |
423 | ROCCAT_MAX_DEVICES, "roccat"); | 423 | ROCCAT_MAX_DEVICES, "roccat"); |
424 | |||
425 | roccat_major = MAJOR(dev_id); | ||
426 | |||
427 | if (retval < 0) { | 424 | if (retval < 0) { |
428 | pr_warn("can't get major number\n"); | 425 | pr_warn("can't get major number\n"); |
429 | goto error; | 426 | goto error; |
430 | } | 427 | } |
431 | 428 | ||
429 | roccat_major = MAJOR(dev_id); | ||
430 | |||
432 | cdev_init(&roccat_cdev, &roccat_ops); | 431 | cdev_init(&roccat_cdev, &roccat_ops); |
433 | retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES); | 432 | retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES); |
434 | 433 | ||
diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c index 847a497cd472..9ad9c6ec5bba 100644 --- a/drivers/hid/hid-thingm.c +++ b/drivers/hid/hid-thingm.c | |||
@@ -148,13 +148,21 @@ static int thingm_led_set(struct led_classdev *ldev, | |||
148 | enum led_brightness brightness) | 148 | enum led_brightness brightness) |
149 | { | 149 | { |
150 | struct thingm_led *led = container_of(ldev, struct thingm_led, ldev); | 150 | struct thingm_led *led = container_of(ldev, struct thingm_led, ldev); |
151 | int ret; | ||
152 | 151 | ||
153 | ret = thingm_write_color(led->rgb); | 152 | return thingm_write_color(led->rgb); |
154 | if (ret) | 153 | } |
155 | hid_err(led->rgb->tdev->hdev, "failed to write color\n"); | ||
156 | 154 | ||
157 | return ret; | 155 | static int thingm_init_led(struct thingm_led *led, const char *color_name, |
156 | struct thingm_rgb *rgb, int minor) | ||
157 | { | ||
158 | snprintf(led->name, sizeof(led->name), "thingm%d:%s:led%d", | ||
159 | minor, color_name, rgb->num); | ||
160 | led->ldev.name = led->name; | ||
161 | led->ldev.max_brightness = 255; | ||
162 | led->ldev.brightness_set_blocking = thingm_led_set; | ||
163 | led->ldev.flags = LED_HW_PLUGGABLE; | ||
164 | led->rgb = rgb; | ||
165 | return devm_led_classdev_register(&rgb->tdev->hdev->dev, &led->ldev); | ||
158 | } | 166 | } |
159 | 167 | ||
160 | static int thingm_init_rgb(struct thingm_rgb *rgb) | 168 | static int thingm_init_rgb(struct thingm_rgb *rgb) |
@@ -163,42 +171,17 @@ static int thingm_init_rgb(struct thingm_rgb *rgb) | |||
163 | int err; | 171 | int err; |
164 | 172 | ||
165 | /* Register the red diode */ | 173 | /* Register the red diode */ |
166 | snprintf(rgb->red.name, sizeof(rgb->red.name), | 174 | err = thingm_init_led(&rgb->red, "red", rgb, minor); |
167 | "thingm%d:red:led%d", minor, rgb->num); | ||
168 | rgb->red.ldev.name = rgb->red.name; | ||
169 | rgb->red.ldev.max_brightness = 255; | ||
170 | rgb->red.ldev.brightness_set_blocking = thingm_led_set; | ||
171 | rgb->red.rgb = rgb; | ||
172 | |||
173 | err = devm_led_classdev_register(&rgb->tdev->hdev->dev, | ||
174 | &rgb->red.ldev); | ||
175 | if (err) | 175 | if (err) |
176 | return err; | 176 | return err; |
177 | 177 | ||
178 | /* Register the green diode */ | 178 | /* Register the green diode */ |
179 | snprintf(rgb->green.name, sizeof(rgb->green.name), | 179 | err = thingm_init_led(&rgb->green, "green", rgb, minor); |
180 | "thingm%d:green:led%d", minor, rgb->num); | ||
181 | rgb->green.ldev.name = rgb->green.name; | ||
182 | rgb->green.ldev.max_brightness = 255; | ||
183 | rgb->green.ldev.brightness_set_blocking = thingm_led_set; | ||
184 | rgb->green.rgb = rgb; | ||
185 | |||
186 | err = devm_led_classdev_register(&rgb->tdev->hdev->dev, | ||
187 | &rgb->green.ldev); | ||
188 | if (err) | 180 | if (err) |
189 | return err; | 181 | return err; |
190 | 182 | ||
191 | /* Register the blue diode */ | 183 | /* Register the blue diode */ |
192 | snprintf(rgb->blue.name, sizeof(rgb->blue.name), | 184 | return thingm_init_led(&rgb->blue, "blue", rgb, minor); |
193 | "thingm%d:blue:led%d", minor, rgb->num); | ||
194 | rgb->blue.ldev.name = rgb->blue.name; | ||
195 | rgb->blue.ldev.max_brightness = 255; | ||
196 | rgb->blue.ldev.brightness_set_blocking = thingm_led_set; | ||
197 | rgb->blue.rgb = rgb; | ||
198 | |||
199 | err = devm_led_classdev_register(&rgb->tdev->hdev->dev, | ||
200 | &rgb->blue.ldev); | ||
201 | return err; | ||
202 | } | 185 | } |
203 | 186 | ||
204 | static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id) | 187 | static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id) |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 9c2d7c23f296..f0e2757cb909 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/hid.h> | 34 | #include <linux/hid.h> |
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/string.h> | ||
37 | 38 | ||
38 | #include <linux/hidraw.h> | 39 | #include <linux/hidraw.h> |
39 | 40 | ||
@@ -123,7 +124,6 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, | |||
123 | 124 | ||
124 | dev = hidraw_table[minor]->hid; | 125 | dev = hidraw_table[minor]->hid; |
125 | 126 | ||
126 | |||
127 | if (count > HID_MAX_BUFFER_SIZE) { | 127 | if (count > HID_MAX_BUFFER_SIZE) { |
128 | hid_warn(dev, "pid %d passed too large report\n", | 128 | hid_warn(dev, "pid %d passed too large report\n", |
129 | task_pid_nr(current)); | 129 | task_pid_nr(current)); |
@@ -138,17 +138,12 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, | |||
138 | goto out; | 138 | goto out; |
139 | } | 139 | } |
140 | 140 | ||
141 | buf = kmalloc(count * sizeof(__u8), GFP_KERNEL); | 141 | buf = memdup_user(buffer, count); |
142 | if (!buf) { | 142 | if (IS_ERR(buf)) { |
143 | ret = -ENOMEM; | 143 | ret = PTR_ERR(buf); |
144 | goto out; | 144 | goto out; |
145 | } | 145 | } |
146 | 146 | ||
147 | if (copy_from_user(buf, buffer, count)) { | ||
148 | ret = -EFAULT; | ||
149 | goto out_free; | ||
150 | } | ||
151 | |||
152 | if ((report_type == HID_OUTPUT_REPORT) && | 147 | if ((report_type == HID_OUTPUT_REPORT) && |
153 | !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) { | 148 | !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) { |
154 | ret = hid_hw_output_report(dev, buf, count); | 149 | ret = hid_hw_output_report(dev, buf, count); |
@@ -587,14 +582,13 @@ int __init hidraw_init(void) | |||
587 | 582 | ||
588 | result = alloc_chrdev_region(&dev_id, HIDRAW_FIRST_MINOR, | 583 | result = alloc_chrdev_region(&dev_id, HIDRAW_FIRST_MINOR, |
589 | HIDRAW_MAX_DEVICES, "hidraw"); | 584 | HIDRAW_MAX_DEVICES, "hidraw"); |
590 | |||
591 | hidraw_major = MAJOR(dev_id); | ||
592 | |||
593 | if (result < 0) { | 585 | if (result < 0) { |
594 | pr_warn("can't get major number\n"); | 586 | pr_warn("can't get major number\n"); |
595 | goto out; | 587 | goto out; |
596 | } | 588 | } |
597 | 589 | ||
590 | hidraw_major = MAJOR(dev_id); | ||
591 | |||
598 | hidraw_class = class_create(THIS_MODULE, "hidraw"); | 592 | hidraw_class = class_create(THIS_MODULE, "hidraw"); |
599 | if (IS_ERR(hidraw_class)) { | 593 | if (IS_ERR(hidraw_class)) { |
600 | result = PTR_ERR(hidraw_class); | 594 | result = PTR_ERR(hidraw_class); |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 53fc856d6867..b4b8c6abb03e 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -71,6 +71,11 @@ static const struct hid_blacklist { | |||
71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, | 71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, |
72 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
73 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | 73 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
74 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70R, HID_QUIRK_NO_INIT_REPORTS }, | ||
75 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_M65RGB, HID_QUIRK_NO_INIT_REPORTS }, | ||
76 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K95RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, | ||
77 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB, HID_QUIRK_NO_INIT_REPORTS }, | ||
78 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB, HID_QUIRK_NO_INIT_REPORTS }, | ||
74 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, | 79 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, |
75 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 80 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
76 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, | 81 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index ccf1883318c3..499cc8213cfe 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -493,7 +493,8 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, | |||
493 | features->x_fuzz = 4; | 493 | features->x_fuzz = 4; |
494 | features->y_fuzz = 4; | 494 | features->y_fuzz = 4; |
495 | features->pressure_fuzz = 0; | 495 | features->pressure_fuzz = 0; |
496 | features->distance_fuzz = 0; | 496 | features->distance_fuzz = 1; |
497 | features->tilt_fuzz = 1; | ||
497 | 498 | ||
498 | /* | 499 | /* |
499 | * The wireless device HID is basic and layout conflicts with | 500 | * The wireless device HID is basic and layout conflicts with |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index cf2ba43453fd..1eae13cdc502 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -2344,12 +2344,13 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac) | |||
2344 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 2344 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
2345 | 2345 | ||
2346 | input_set_abs_params(input_dev, ABS_DISTANCE, | 2346 | input_set_abs_params(input_dev, ABS_DISTANCE, |
2347 | 0, wacom_wac->features.distance_max, 0, 0); | 2347 | 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); |
2348 | } | 2348 | } |
2349 | 2349 | ||
2350 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) | 2350 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
2351 | { | 2351 | { |
2352 | struct input_dev *input_dev = wacom_wac->pen_input; | 2352 | struct input_dev *input_dev = wacom_wac->pen_input; |
2353 | struct wacom_features *features = &wacom_wac->features; | ||
2353 | 2354 | ||
2354 | wacom_setup_basic_pro_pen(wacom_wac); | 2355 | wacom_setup_basic_pro_pen(wacom_wac); |
2355 | 2356 | ||
@@ -2359,9 +2360,9 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) | |||
2359 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); | 2360 | __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); |
2360 | 2361 | ||
2361 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | 2362 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
2362 | input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); | 2363 | input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); |
2363 | input_abs_set_res(input_dev, ABS_TILT_X, 57); | 2364 | input_abs_set_res(input_dev, ABS_TILT_X, 57); |
2364 | input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); | 2365 | input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); |
2365 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); | 2366 | input_abs_set_res(input_dev, ABS_TILT_Y, 57); |
2366 | } | 2367 | } |
2367 | 2368 | ||
@@ -2507,7 +2508,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, | |||
2507 | case WACOM_G4: | 2508 | case WACOM_G4: |
2508 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, | 2509 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
2509 | features->distance_max, | 2510 | features->distance_max, |
2510 | 0, 0); | 2511 | features->distance_fuzz, 0); |
2511 | /* fall through */ | 2512 | /* fall through */ |
2512 | 2513 | ||
2513 | case GRAPHIRE: | 2514 | case GRAPHIRE: |
@@ -2569,7 +2570,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, | |||
2569 | 2570 | ||
2570 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, | 2571 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
2571 | features->distance_max, | 2572 | features->distance_max, |
2572 | 0, 0); | 2573 | features->distance_fuzz, 0); |
2573 | 2574 | ||
2574 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2575 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
2575 | input_abs_set_res(input_dev, ABS_Z, 287); | 2576 | input_abs_set_res(input_dev, ABS_Z, 287); |
@@ -2628,7 +2629,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, | |||
2628 | __set_bit(BTN_STYLUS2, input_dev->keybit); | 2629 | __set_bit(BTN_STYLUS2, input_dev->keybit); |
2629 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, | 2630 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
2630 | features->distance_max, | 2631 | features->distance_max, |
2631 | 0, 0); | 2632 | features->distance_fuzz, 0); |
2632 | } | 2633 | } |
2633 | break; | 2634 | break; |
2634 | case BAMBOO_PAD: | 2635 | case BAMBOO_PAD: |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index e2084d914c14..53d16537fd2a 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -177,6 +177,7 @@ struct wacom_features { | |||
177 | int y_fuzz; | 177 | int y_fuzz; |
178 | int pressure_fuzz; | 178 | int pressure_fuzz; |
179 | int distance_fuzz; | 179 | int distance_fuzz; |
180 | int tilt_fuzz; | ||
180 | unsigned quirks; | 181 | unsigned quirks; |
181 | unsigned touch_max; | 182 | unsigned touch_max; |
182 | int oVid; | 183 | int oVid; |