aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-02 15:42:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-02 15:42:50 -0500
commitda2875673660c114dc7d65edcd1f97023d0ed624 (patch)
tree26e94009c2692a1eb167104d5560c3459bf1ff73
parent74e5c265a4955d6a01adc40783346b716271170b (diff)
parent143fca77cce906d35f7a60ccef648e888df589f2 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina: - regression fix (caused by me applying a wrong version of patch) for sensor-hub driver, from Srinivas Pandruvada - hid-sony fixes (mostly related to DS4 device) from Roderick Colenbrander - three device-specific quirks-fixes from Alex Wood, Brendan McGrath and Marcel Hasler * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: sensor-hub: Move the memset to sensor_hub_get_feature() HID: usbhid: Add quirk for Mayflash/Dragonrise DolphinBar. HID: usbhid: Add quirk for the Futaba TOSD-5711BB VFD HID: sony: Ignore DS4 dongle reports when no device is connected HID: sony: Use DS4 MAC address as unique identifier on USB HID: sony: Fix error handling bug when touchpad registration fails HID: asus: Fix keyboard support
-rw-r--r--drivers/hid/hid-asus.c17
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-sensor-hub.c3
-rw-r--r--drivers/hid/hid-sony.c36
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
5 files changed, 54 insertions, 8 deletions
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index d40ed9fdf68d..70b12f89a193 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -64,7 +64,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
64#define QUIRK_SKIP_INPUT_MAPPING BIT(2) 64#define QUIRK_SKIP_INPUT_MAPPING BIT(2)
65#define QUIRK_IS_MULTITOUCH BIT(3) 65#define QUIRK_IS_MULTITOUCH BIT(3)
66 66
67#define NOTEBOOK_QUIRKS QUIRK_FIX_NOTEBOOK_REPORT 67#define KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
68 QUIRK_NO_INIT_REPORTS)
68#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ 69#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
69 QUIRK_SKIP_INPUT_MAPPING | \ 70 QUIRK_SKIP_INPUT_MAPPING | \
70 QUIRK_IS_MULTITOUCH) 71 QUIRK_IS_MULTITOUCH)
@@ -170,11 +171,11 @@ static int asus_raw_event(struct hid_device *hdev,
170 171
171static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) 172static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
172{ 173{
174 struct input_dev *input = hi->input;
173 struct asus_drvdata *drvdata = hid_get_drvdata(hdev); 175 struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
174 176
175 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { 177 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
176 int ret; 178 int ret;
177 struct input_dev *input = hi->input;
178 179
179 input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0); 180 input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
180 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); 181 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0);
@@ -191,10 +192,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
191 hid_err(hdev, "Asus input mt init slots failed: %d\n", ret); 192 hid_err(hdev, "Asus input mt init slots failed: %d\n", ret);
192 return ret; 193 return ret;
193 } 194 }
194
195 drvdata->input = input;
196 } 195 }
197 196
197 drvdata->input = input;
198
198 return 0; 199 return 0;
199} 200}
200 201
@@ -286,7 +287,11 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
286 goto err_stop_hw; 287 goto err_stop_hw;
287 } 288 }
288 289
289 drvdata->input->name = "Asus TouchPad"; 290 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
291 drvdata->input->name = "Asus TouchPad";
292 } else {
293 drvdata->input->name = "Asus Keyboard";
294 }
290 295
291 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { 296 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
292 ret = asus_start_multitouch(hdev); 297 ret = asus_start_multitouch(hdev);
@@ -315,7 +320,7 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
315 320
316static const struct hid_device_id asus_devices[] = { 321static const struct hid_device_id asus_devices[] = {
317 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, 322 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
318 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), NOTEBOOK_QUIRKS}, 323 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
319 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, 324 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
320 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, 325 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
321 { } 326 { }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ec277b96eaa1..54bd22dc1411 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -319,6 +319,7 @@
319#define USB_VENDOR_ID_DRAGONRISE 0x0079 319#define USB_VENDOR_ID_DRAGONRISE 0x0079
320#define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800 320#define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800
321#define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801 321#define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801
322#define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR 0x1803
322#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843 323#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843
323 324
324#define USB_VENDOR_ID_DWAV 0x0eef 325#define USB_VENDOR_ID_DWAV 0x0eef
@@ -365,6 +366,9 @@
365#define USB_VENDOR_ID_FLATFROG 0x25b5 366#define USB_VENDOR_ID_FLATFROG 0x25b5
366#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 367#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002
367 368
369#define USB_VENDOR_ID_FUTABA 0x0547
370#define USB_DEVICE_ID_LED_DISPLAY 0x7000
371
368#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 372#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
369#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 373#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
370 374
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 5c925228847c..4ef73374a8f9 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -212,7 +212,6 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
212 __s32 value; 212 __s32 value;
213 int ret = 0; 213 int ret = 0;
214 214
215 memset(buffer, 0, buffer_size);
216 mutex_lock(&data->mutex); 215 mutex_lock(&data->mutex);
217 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); 216 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
218 if (!report || (field_index >= report->maxfield)) { 217 if (!report || (field_index >= report->maxfield)) {
@@ -256,6 +255,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
256 int buffer_index = 0; 255 int buffer_index = 0;
257 int i; 256 int i;
258 257
258 memset(buffer, 0, buffer_size);
259
259 mutex_lock(&data->mutex); 260 mutex_lock(&data->mutex);
260 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); 261 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
261 if (!report || (field_index >= report->maxfield) || 262 if (!report || (field_index >= report->maxfield) ||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 7687c0875395..f405b07d0381 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1099,8 +1099,11 @@ struct sony_sc {
1099 u8 led_delay_on[MAX_LEDS]; 1099 u8 led_delay_on[MAX_LEDS];
1100 u8 led_delay_off[MAX_LEDS]; 1100 u8 led_delay_off[MAX_LEDS];
1101 u8 led_count; 1101 u8 led_count;
1102 bool ds4_dongle_connected;
1102}; 1103};
1103 1104
1105static void sony_set_leds(struct sony_sc *sc);
1106
1104static inline void sony_schedule_work(struct sony_sc *sc) 1107static inline void sony_schedule_work(struct sony_sc *sc)
1105{ 1108{
1106 if (!sc->defer_initialization) 1109 if (!sc->defer_initialization)
@@ -1430,6 +1433,31 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
1430 return -EILSEQ; 1433 return -EILSEQ;
1431 } 1434 }
1432 } 1435 }
1436
1437 /*
1438 * In the case of a DS4 USB dongle, bit[2] of byte 31 indicates
1439 * if a DS4 is actually connected (indicated by '0').
1440 * For non-dongle, this bit is always 0 (connected).
1441 */
1442 if (sc->hdev->vendor == USB_VENDOR_ID_SONY &&
1443 sc->hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) {
1444 bool connected = (rd[31] & 0x04) ? false : true;
1445
1446 if (!sc->ds4_dongle_connected && connected) {
1447 hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n");
1448 sony_set_leds(sc);
1449 sc->ds4_dongle_connected = true;
1450 } else if (sc->ds4_dongle_connected && !connected) {
1451 hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n");
1452 sc->ds4_dongle_connected = false;
1453 /* Return 0, so hidraw can get the report. */
1454 return 0;
1455 } else if (!sc->ds4_dongle_connected) {
1456 /* Return 0, so hidraw can get the report. */
1457 return 0;
1458 }
1459 }
1460
1433 dualshock4_parse_report(sc, rd, size); 1461 dualshock4_parse_report(sc, rd, size);
1434 } 1462 }
1435 1463
@@ -2390,6 +2418,12 @@ static int sony_check_add(struct sony_sc *sc)
2390 } 2418 }
2391 2419
2392 memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); 2420 memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
2421
2422 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
2423 "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
2424 sc->mac_address[5], sc->mac_address[4],
2425 sc->mac_address[3], sc->mac_address[2],
2426 sc->mac_address[1], sc->mac_address[0]);
2393 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || 2427 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
2394 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { 2428 (sc->quirks & NAVIGATION_CONTROLLER_USB)) {
2395 buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); 2429 buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
@@ -2548,7 +2582,7 @@ static int sony_input_configured(struct hid_device *hdev,
2548 hid_err(sc->hdev, 2582 hid_err(sc->hdev,
2549 "Unable to initialize multi-touch slots: %d\n", 2583 "Unable to initialize multi-touch slots: %d\n",
2550 ret); 2584 ret);
2551 return ret; 2585 goto err_stop;
2552 } 2586 }
2553 2587
2554 sony_init_output_report(sc, dualshock4_send_output_report); 2588 sony_init_output_report(sc, dualshock4_send_output_report);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index b3e01c82af05..e9d6cc7cdfc5 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -83,11 +83,13 @@ static const struct hid_blacklist {
83 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 83 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
84 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, 84 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
85 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT }, 85 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT },
86 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR, HID_QUIRK_MULTI_INPUT },
86 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT }, 87 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT },
87 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, 88 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
88 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 89 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
89 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, 90 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
90 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, 91 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
92 { USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY, HID_QUIRK_NO_INIT_REPORTS },
91 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL }, 93 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL },
92 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL }, 94 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
93 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, 95 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },