diff options
Diffstat (limited to 'drivers/hid/hid-logitech-hidpp.c')
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 309 |
1 files changed, 27 insertions, 282 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index f01280898b24..19cc980eebce 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -64,14 +64,6 @@ MODULE_PARM_DESC(disable_tap_to_click, | |||
64 | #define HIDPP_QUIRK_NO_HIDINPUT BIT(23) | 64 | #define HIDPP_QUIRK_NO_HIDINPUT BIT(23) |
65 | #define HIDPP_QUIRK_FORCE_OUTPUT_REPORTS BIT(24) | 65 | #define HIDPP_QUIRK_FORCE_OUTPUT_REPORTS BIT(24) |
66 | #define HIDPP_QUIRK_UNIFYING BIT(25) | 66 | #define HIDPP_QUIRK_UNIFYING BIT(25) |
67 | #define HIDPP_QUIRK_HI_RES_SCROLL_1P0 BIT(26) | ||
68 | #define HIDPP_QUIRK_HI_RES_SCROLL_X2120 BIT(27) | ||
69 | #define HIDPP_QUIRK_HI_RES_SCROLL_X2121 BIT(28) | ||
70 | |||
71 | /* Convenience constant to check for any high-res support. */ | ||
72 | #define HIDPP_QUIRK_HI_RES_SCROLL (HIDPP_QUIRK_HI_RES_SCROLL_1P0 | \ | ||
73 | HIDPP_QUIRK_HI_RES_SCROLL_X2120 | \ | ||
74 | HIDPP_QUIRK_HI_RES_SCROLL_X2121) | ||
75 | 67 | ||
76 | #define HIDPP_QUIRK_DELAYED_INIT HIDPP_QUIRK_NO_HIDINPUT | 68 | #define HIDPP_QUIRK_DELAYED_INIT HIDPP_QUIRK_NO_HIDINPUT |
77 | 69 | ||
@@ -157,7 +149,6 @@ struct hidpp_device { | |||
157 | unsigned long capabilities; | 149 | unsigned long capabilities; |
158 | 150 | ||
159 | struct hidpp_battery battery; | 151 | struct hidpp_battery battery; |
160 | struct hid_scroll_counter vertical_wheel_counter; | ||
161 | }; | 152 | }; |
162 | 153 | ||
163 | /* HID++ 1.0 error codes */ | 154 | /* HID++ 1.0 error codes */ |
@@ -409,53 +400,32 @@ static void hidpp_prefix_name(char **name, int name_length) | |||
409 | #define HIDPP_SET_LONG_REGISTER 0x82 | 400 | #define HIDPP_SET_LONG_REGISTER 0x82 |
410 | #define HIDPP_GET_LONG_REGISTER 0x83 | 401 | #define HIDPP_GET_LONG_REGISTER 0x83 |
411 | 402 | ||
412 | /** | 403 | #define HIDPP_REG_GENERAL 0x00 |
413 | * hidpp10_set_register_bit() - Sets a single bit in a HID++ 1.0 register. | 404 | |
414 | * @hidpp_dev: the device to set the register on. | 405 | static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev) |
415 | * @register_address: the address of the register to modify. | ||
416 | * @byte: the byte of the register to modify. Should be less than 3. | ||
417 | * Return: 0 if successful, otherwise a negative error code. | ||
418 | */ | ||
419 | static int hidpp10_set_register_bit(struct hidpp_device *hidpp_dev, | ||
420 | u8 register_address, u8 byte, u8 bit) | ||
421 | { | 406 | { |
422 | struct hidpp_report response; | 407 | struct hidpp_report response; |
423 | int ret; | 408 | int ret; |
424 | u8 params[3] = { 0 }; | 409 | u8 params[3] = { 0 }; |
425 | 410 | ||
426 | ret = hidpp_send_rap_command_sync(hidpp_dev, | 411 | ret = hidpp_send_rap_command_sync(hidpp_dev, |
427 | REPORT_ID_HIDPP_SHORT, | 412 | REPORT_ID_HIDPP_SHORT, |
428 | HIDPP_GET_REGISTER, | 413 | HIDPP_GET_REGISTER, |
429 | register_address, | 414 | HIDPP_REG_GENERAL, |
430 | NULL, 0, &response); | 415 | NULL, 0, &response); |
431 | if (ret) | 416 | if (ret) |
432 | return ret; | 417 | return ret; |
433 | 418 | ||
434 | memcpy(params, response.rap.params, 3); | 419 | memcpy(params, response.rap.params, 3); |
435 | 420 | ||
436 | params[byte] |= BIT(bit); | 421 | /* Set the battery bit */ |
422 | params[0] |= BIT(4); | ||
437 | 423 | ||
438 | return hidpp_send_rap_command_sync(hidpp_dev, | 424 | return hidpp_send_rap_command_sync(hidpp_dev, |
439 | REPORT_ID_HIDPP_SHORT, | 425 | REPORT_ID_HIDPP_SHORT, |
440 | HIDPP_SET_REGISTER, | 426 | HIDPP_SET_REGISTER, |
441 | register_address, | 427 | HIDPP_REG_GENERAL, |
442 | params, 3, &response); | 428 | params, 3, &response); |
443 | } | ||
444 | |||
445 | |||
446 | #define HIDPP_REG_GENERAL 0x00 | ||
447 | |||
448 | static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev) | ||
449 | { | ||
450 | return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_GENERAL, 0, 4); | ||
451 | } | ||
452 | |||
453 | #define HIDPP_REG_FEATURES 0x01 | ||
454 | |||
455 | /* On HID++ 1.0 devices, high-res scroll was called "scrolling acceleration". */ | ||
456 | static int hidpp10_enable_scrolling_acceleration(struct hidpp_device *hidpp_dev) | ||
457 | { | ||
458 | return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_FEATURES, 0, 6); | ||
459 | } | 429 | } |
460 | 430 | ||
461 | #define HIDPP_REG_BATTERY_STATUS 0x07 | 431 | #define HIDPP_REG_BATTERY_STATUS 0x07 |
@@ -1167,100 +1137,6 @@ static int hidpp_battery_get_property(struct power_supply *psy, | |||
1167 | } | 1137 | } |
1168 | 1138 | ||
1169 | /* -------------------------------------------------------------------------- */ | 1139 | /* -------------------------------------------------------------------------- */ |
1170 | /* 0x2120: Hi-resolution scrolling */ | ||
1171 | /* -------------------------------------------------------------------------- */ | ||
1172 | |||
1173 | #define HIDPP_PAGE_HI_RESOLUTION_SCROLLING 0x2120 | ||
1174 | |||
1175 | #define CMD_HI_RESOLUTION_SCROLLING_SET_HIGHRES_SCROLLING_MODE 0x10 | ||
1176 | |||
1177 | static int hidpp_hrs_set_highres_scrolling_mode(struct hidpp_device *hidpp, | ||
1178 | bool enabled, u8 *multiplier) | ||
1179 | { | ||
1180 | u8 feature_index; | ||
1181 | u8 feature_type; | ||
1182 | int ret; | ||
1183 | u8 params[1]; | ||
1184 | struct hidpp_report response; | ||
1185 | |||
1186 | ret = hidpp_root_get_feature(hidpp, | ||
1187 | HIDPP_PAGE_HI_RESOLUTION_SCROLLING, | ||
1188 | &feature_index, | ||
1189 | &feature_type); | ||
1190 | if (ret) | ||
1191 | return ret; | ||
1192 | |||
1193 | params[0] = enabled ? BIT(0) : 0; | ||
1194 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, | ||
1195 | CMD_HI_RESOLUTION_SCROLLING_SET_HIGHRES_SCROLLING_MODE, | ||
1196 | params, sizeof(params), &response); | ||
1197 | if (ret) | ||
1198 | return ret; | ||
1199 | *multiplier = response.fap.params[1]; | ||
1200 | return 0; | ||
1201 | } | ||
1202 | |||
1203 | /* -------------------------------------------------------------------------- */ | ||
1204 | /* 0x2121: HiRes Wheel */ | ||
1205 | /* -------------------------------------------------------------------------- */ | ||
1206 | |||
1207 | #define HIDPP_PAGE_HIRES_WHEEL 0x2121 | ||
1208 | |||
1209 | #define CMD_HIRES_WHEEL_GET_WHEEL_CAPABILITY 0x00 | ||
1210 | #define CMD_HIRES_WHEEL_SET_WHEEL_MODE 0x20 | ||
1211 | |||
1212 | static int hidpp_hrw_get_wheel_capability(struct hidpp_device *hidpp, | ||
1213 | u8 *multiplier) | ||
1214 | { | ||
1215 | u8 feature_index; | ||
1216 | u8 feature_type; | ||
1217 | int ret; | ||
1218 | struct hidpp_report response; | ||
1219 | |||
1220 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_HIRES_WHEEL, | ||
1221 | &feature_index, &feature_type); | ||
1222 | if (ret) | ||
1223 | goto return_default; | ||
1224 | |||
1225 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, | ||
1226 | CMD_HIRES_WHEEL_GET_WHEEL_CAPABILITY, | ||
1227 | NULL, 0, &response); | ||
1228 | if (ret) | ||
1229 | goto return_default; | ||
1230 | |||
1231 | *multiplier = response.fap.params[0]; | ||
1232 | return 0; | ||
1233 | return_default: | ||
1234 | hid_warn(hidpp->hid_dev, | ||
1235 | "Couldn't get wheel multiplier (error %d), assuming %d.\n", | ||
1236 | ret, *multiplier); | ||
1237 | return ret; | ||
1238 | } | ||
1239 | |||
1240 | static int hidpp_hrw_set_wheel_mode(struct hidpp_device *hidpp, bool invert, | ||
1241 | bool high_resolution, bool use_hidpp) | ||
1242 | { | ||
1243 | u8 feature_index; | ||
1244 | u8 feature_type; | ||
1245 | int ret; | ||
1246 | u8 params[1]; | ||
1247 | struct hidpp_report response; | ||
1248 | |||
1249 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_HIRES_WHEEL, | ||
1250 | &feature_index, &feature_type); | ||
1251 | if (ret) | ||
1252 | return ret; | ||
1253 | |||
1254 | params[0] = (invert ? BIT(2) : 0) | | ||
1255 | (high_resolution ? BIT(1) : 0) | | ||
1256 | (use_hidpp ? BIT(0) : 0); | ||
1257 | |||
1258 | return hidpp_send_fap_command_sync(hidpp, feature_index, | ||
1259 | CMD_HIRES_WHEEL_SET_WHEEL_MODE, | ||
1260 | params, sizeof(params), &response); | ||
1261 | } | ||
1262 | |||
1263 | /* -------------------------------------------------------------------------- */ | ||
1264 | /* 0x4301: Solar Keyboard */ | 1140 | /* 0x4301: Solar Keyboard */ |
1265 | /* -------------------------------------------------------------------------- */ | 1141 | /* -------------------------------------------------------------------------- */ |
1266 | 1142 | ||
@@ -2523,8 +2399,7 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size) | |||
2523 | input_report_rel(mydata->input, REL_Y, v); | 2399 | input_report_rel(mydata->input, REL_Y, v); |
2524 | 2400 | ||
2525 | v = hid_snto32(data[6], 8); | 2401 | v = hid_snto32(data[6], 8); |
2526 | hid_scroll_counter_handle_scroll( | 2402 | input_report_rel(mydata->input, REL_WHEEL, v); |
2527 | &hidpp->vertical_wheel_counter, v); | ||
2528 | 2403 | ||
2529 | input_sync(mydata->input); | 2404 | input_sync(mydata->input); |
2530 | } | 2405 | } |
@@ -2653,72 +2528,6 @@ static int g920_get_config(struct hidpp_device *hidpp) | |||
2653 | } | 2528 | } |
2654 | 2529 | ||
2655 | /* -------------------------------------------------------------------------- */ | 2530 | /* -------------------------------------------------------------------------- */ |
2656 | /* High-resolution scroll wheels */ | ||
2657 | /* -------------------------------------------------------------------------- */ | ||
2658 | |||
2659 | /** | ||
2660 | * struct hi_res_scroll_info - Stores info on a device's high-res scroll wheel. | ||
2661 | * @product_id: the HID product ID of the device being described. | ||
2662 | * @microns_per_hi_res_unit: the distance moved by the user's finger for each | ||
2663 | * high-resolution unit reported by the device, in | ||
2664 | * 256ths of a millimetre. | ||
2665 | */ | ||
2666 | struct hi_res_scroll_info { | ||
2667 | __u32 product_id; | ||
2668 | int microns_per_hi_res_unit; | ||
2669 | }; | ||
2670 | |||
2671 | static struct hi_res_scroll_info hi_res_scroll_devices[] = { | ||
2672 | { /* Anywhere MX */ | ||
2673 | .product_id = 0x1017, .microns_per_hi_res_unit = 445 }, | ||
2674 | { /* Performance MX */ | ||
2675 | .product_id = 0x101a, .microns_per_hi_res_unit = 406 }, | ||
2676 | { /* M560 */ | ||
2677 | .product_id = 0x402d, .microns_per_hi_res_unit = 435 }, | ||
2678 | { /* MX Master 2S */ | ||
2679 | .product_id = 0x4069, .microns_per_hi_res_unit = 406 }, | ||
2680 | }; | ||
2681 | |||
2682 | static int hi_res_scroll_look_up_microns(__u32 product_id) | ||
2683 | { | ||
2684 | int i; | ||
2685 | int num_devices = sizeof(hi_res_scroll_devices) | ||
2686 | / sizeof(hi_res_scroll_devices[0]); | ||
2687 | for (i = 0; i < num_devices; i++) { | ||
2688 | if (hi_res_scroll_devices[i].product_id == product_id) | ||
2689 | return hi_res_scroll_devices[i].microns_per_hi_res_unit; | ||
2690 | } | ||
2691 | /* We don't have a value for this device, so use a sensible default. */ | ||
2692 | return 406; | ||
2693 | } | ||
2694 | |||
2695 | static int hi_res_scroll_enable(struct hidpp_device *hidpp) | ||
2696 | { | ||
2697 | int ret; | ||
2698 | u8 multiplier = 8; | ||
2699 | |||
2700 | if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2121) { | ||
2701 | ret = hidpp_hrw_set_wheel_mode(hidpp, false, true, false); | ||
2702 | hidpp_hrw_get_wheel_capability(hidpp, &multiplier); | ||
2703 | } else if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2120) { | ||
2704 | ret = hidpp_hrs_set_highres_scrolling_mode(hidpp, true, | ||
2705 | &multiplier); | ||
2706 | } else /* if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_1P0) */ | ||
2707 | ret = hidpp10_enable_scrolling_acceleration(hidpp); | ||
2708 | |||
2709 | if (ret) | ||
2710 | return ret; | ||
2711 | |||
2712 | hidpp->vertical_wheel_counter.resolution_multiplier = multiplier; | ||
2713 | hidpp->vertical_wheel_counter.microns_per_hi_res_unit = | ||
2714 | hi_res_scroll_look_up_microns(hidpp->hid_dev->product); | ||
2715 | hid_info(hidpp->hid_dev, "multiplier = %d, microns = %d\n", | ||
2716 | multiplier, | ||
2717 | hidpp->vertical_wheel_counter.microns_per_hi_res_unit); | ||
2718 | return 0; | ||
2719 | } | ||
2720 | |||
2721 | /* -------------------------------------------------------------------------- */ | ||
2722 | /* Generic HID++ devices */ | 2531 | /* Generic HID++ devices */ |
2723 | /* -------------------------------------------------------------------------- */ | 2532 | /* -------------------------------------------------------------------------- */ |
2724 | 2533 | ||
@@ -2763,11 +2572,6 @@ static void hidpp_populate_input(struct hidpp_device *hidpp, | |||
2763 | wtp_populate_input(hidpp, input, origin_is_hid_core); | 2572 | wtp_populate_input(hidpp, input, origin_is_hid_core); |
2764 | else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560) | 2573 | else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560) |
2765 | m560_populate_input(hidpp, input, origin_is_hid_core); | 2574 | m560_populate_input(hidpp, input, origin_is_hid_core); |
2766 | |||
2767 | if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) { | ||
2768 | input_set_capability(input, EV_REL, REL_WHEEL_HI_RES); | ||
2769 | hidpp->vertical_wheel_counter.dev = input; | ||
2770 | } | ||
2771 | } | 2575 | } |
2772 | 2576 | ||
2773 | static int hidpp_input_configured(struct hid_device *hdev, | 2577 | static int hidpp_input_configured(struct hid_device *hdev, |
@@ -2886,27 +2690,6 @@ static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
2886 | return 0; | 2690 | return 0; |
2887 | } | 2691 | } |
2888 | 2692 | ||
2889 | static int hidpp_event(struct hid_device *hdev, struct hid_field *field, | ||
2890 | struct hid_usage *usage, __s32 value) | ||
2891 | { | ||
2892 | /* This function will only be called for scroll events, due to the | ||
2893 | * restriction imposed in hidpp_usages. | ||
2894 | */ | ||
2895 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
2896 | struct hid_scroll_counter *counter = &hidpp->vertical_wheel_counter; | ||
2897 | /* A scroll event may occur before the multiplier has been retrieved or | ||
2898 | * the input device set, or high-res scroll enabling may fail. In such | ||
2899 | * cases we must return early (falling back to default behaviour) to | ||
2900 | * avoid a crash in hid_scroll_counter_handle_scroll. | ||
2901 | */ | ||
2902 | if (!(hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) || value == 0 | ||
2903 | || counter->dev == NULL || counter->resolution_multiplier == 0) | ||
2904 | return 0; | ||
2905 | |||
2906 | hid_scroll_counter_handle_scroll(counter, value); | ||
2907 | return 1; | ||
2908 | } | ||
2909 | |||
2910 | static int hidpp_initialize_battery(struct hidpp_device *hidpp) | 2693 | static int hidpp_initialize_battery(struct hidpp_device *hidpp) |
2911 | { | 2694 | { |
2912 | static atomic_t battery_no = ATOMIC_INIT(0); | 2695 | static atomic_t battery_no = ATOMIC_INIT(0); |
@@ -3118,9 +2901,6 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) | |||
3118 | if (hidpp->battery.ps) | 2901 | if (hidpp->battery.ps) |
3119 | power_supply_changed(hidpp->battery.ps); | 2902 | power_supply_changed(hidpp->battery.ps); |
3120 | 2903 | ||
3121 | if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) | ||
3122 | hi_res_scroll_enable(hidpp); | ||
3123 | |||
3124 | if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) | 2904 | if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) |
3125 | /* if the input nodes are already created, we can stop now */ | 2905 | /* if the input nodes are already created, we can stop now */ |
3126 | return; | 2906 | return; |
@@ -3306,63 +3086,35 @@ static void hidpp_remove(struct hid_device *hdev) | |||
3306 | mutex_destroy(&hidpp->send_mutex); | 3086 | mutex_destroy(&hidpp->send_mutex); |
3307 | } | 3087 | } |
3308 | 3088 | ||
3309 | #define LDJ_DEVICE(product) \ | ||
3310 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, \ | ||
3311 | USB_VENDOR_ID_LOGITECH, (product)) | ||
3312 | |||
3313 | static const struct hid_device_id hidpp_devices[] = { | 3089 | static const struct hid_device_id hidpp_devices[] = { |
3314 | { /* wireless touchpad */ | 3090 | { /* wireless touchpad */ |
3315 | LDJ_DEVICE(0x4011), | 3091 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3092 | USB_VENDOR_ID_LOGITECH, 0x4011), | ||
3316 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT | | 3093 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT | |
3317 | HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS }, | 3094 | HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS }, |
3318 | { /* wireless touchpad T650 */ | 3095 | { /* wireless touchpad T650 */ |
3319 | LDJ_DEVICE(0x4101), | 3096 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3097 | USB_VENDOR_ID_LOGITECH, 0x4101), | ||
3320 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT }, | 3098 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT }, |
3321 | { /* wireless touchpad T651 */ | 3099 | { /* wireless touchpad T651 */ |
3322 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, | 3100 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
3323 | USB_DEVICE_ID_LOGITECH_T651), | 3101 | USB_DEVICE_ID_LOGITECH_T651), |
3324 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, | 3102 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, |
3325 | { /* Mouse Logitech Anywhere MX */ | ||
3326 | LDJ_DEVICE(0x1017), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, | ||
3327 | { /* Mouse Logitech Cube */ | ||
3328 | LDJ_DEVICE(0x4010), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, | ||
3329 | { /* Mouse Logitech M335 */ | ||
3330 | LDJ_DEVICE(0x4050), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3331 | { /* Mouse Logitech M515 */ | ||
3332 | LDJ_DEVICE(0x4007), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, | ||
3333 | { /* Mouse logitech M560 */ | 3103 | { /* Mouse logitech M560 */ |
3334 | LDJ_DEVICE(0x402d), | 3104 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3335 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_CLASS_M560 | 3105 | USB_VENDOR_ID_LOGITECH, 0x402d), |
3336 | | HIDPP_QUIRK_HI_RES_SCROLL_X2120 }, | 3106 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_CLASS_M560 }, |
3337 | { /* Mouse Logitech M705 (firmware RQM17) */ | ||
3338 | LDJ_DEVICE(0x101b), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, | ||
3339 | { /* Mouse Logitech M705 (firmware RQM67) */ | ||
3340 | LDJ_DEVICE(0x406d), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3341 | { /* Mouse Logitech M720 */ | ||
3342 | LDJ_DEVICE(0x405e), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3343 | { /* Mouse Logitech MX Anywhere 2 */ | ||
3344 | LDJ_DEVICE(0x404a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3345 | { LDJ_DEVICE(0xb013), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3346 | { LDJ_DEVICE(0xb018), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3347 | { LDJ_DEVICE(0xb01f), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3348 | { /* Mouse Logitech MX Anywhere 2S */ | ||
3349 | LDJ_DEVICE(0x406a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3350 | { /* Mouse Logitech MX Master */ | ||
3351 | LDJ_DEVICE(0x4041), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3352 | { LDJ_DEVICE(0x4060), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3353 | { LDJ_DEVICE(0x4071), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3354 | { /* Mouse Logitech MX Master 2S */ | ||
3355 | LDJ_DEVICE(0x4069), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, | ||
3356 | { /* Mouse Logitech Performance MX */ | ||
3357 | LDJ_DEVICE(0x101a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 }, | ||
3358 | { /* Keyboard logitech K400 */ | 3107 | { /* Keyboard logitech K400 */ |
3359 | LDJ_DEVICE(0x4024), | 3108 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3109 | USB_VENDOR_ID_LOGITECH, 0x4024), | ||
3360 | .driver_data = HIDPP_QUIRK_CLASS_K400 }, | 3110 | .driver_data = HIDPP_QUIRK_CLASS_K400 }, |
3361 | { /* Solar Keyboard Logitech K750 */ | 3111 | { /* Solar Keyboard Logitech K750 */ |
3362 | LDJ_DEVICE(0x4002), | 3112 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3113 | USB_VENDOR_ID_LOGITECH, 0x4002), | ||
3363 | .driver_data = HIDPP_QUIRK_CLASS_K750 }, | 3114 | .driver_data = HIDPP_QUIRK_CLASS_K750 }, |
3364 | 3115 | ||
3365 | { LDJ_DEVICE(HID_ANY_ID) }, | 3116 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
3117 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, | ||
3366 | 3118 | ||
3367 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL), | 3119 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL), |
3368 | .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS}, | 3120 | .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS}, |
@@ -3371,19 +3123,12 @@ static const struct hid_device_id hidpp_devices[] = { | |||
3371 | 3123 | ||
3372 | MODULE_DEVICE_TABLE(hid, hidpp_devices); | 3124 | MODULE_DEVICE_TABLE(hid, hidpp_devices); |
3373 | 3125 | ||
3374 | static const struct hid_usage_id hidpp_usages[] = { | ||
3375 | { HID_GD_WHEEL, EV_REL, REL_WHEEL }, | ||
3376 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | ||
3377 | }; | ||
3378 | |||
3379 | static struct hid_driver hidpp_driver = { | 3126 | static struct hid_driver hidpp_driver = { |
3380 | .name = "logitech-hidpp-device", | 3127 | .name = "logitech-hidpp-device", |
3381 | .id_table = hidpp_devices, | 3128 | .id_table = hidpp_devices, |
3382 | .probe = hidpp_probe, | 3129 | .probe = hidpp_probe, |
3383 | .remove = hidpp_remove, | 3130 | .remove = hidpp_remove, |
3384 | .raw_event = hidpp_raw_event, | 3131 | .raw_event = hidpp_raw_event, |
3385 | .usage_table = hidpp_usages, | ||
3386 | .event = hidpp_event, | ||
3387 | .input_configured = hidpp_input_configured, | 3132 | .input_configured = hidpp_input_configured, |
3388 | .input_mapping = hidpp_input_mapping, | 3133 | .input_mapping = hidpp_input_mapping, |
3389 | .input_mapped = hidpp_input_mapped, | 3134 | .input_mapped = hidpp_input_mapped, |