Lines Matching +full:long +full:- +full:press +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
6 * Copyright (c) 2012-2013 Google (c)
7 * Copyright (c) 2013-2014 Red Hat Inc.
25 #include <linux/fixp-arith.h>
28 #include "hid-ids.h"
42 "Disable Tap-To-Click mode reporting for touchpads (only on the K400 currently).");
83 /* Convenience constant to check for any high-res support. */
112 * is 0xFF for the receiver), and all messages (short or long) with a device
123 u8 params[HIDPP_REPORT_VERY_LONG_MAX_LENGTH - 4U];
129 u8 params[HIDPP_REPORT_VERY_LONG_MAX_LENGTH - 4U];
158 * struct hidpp_scroll_counter - Utility class for processing high-resolution
162 * @remainder: counts the number of high-resolution units moved since the last
163 * low-resolution event (REL_WHEEL or REL_HWHEEL) was sent. Should
165 * @direction: direction of last movement (1 or -1)
172 unsigned long long last_time;
194 unsigned long quirks;
195 unsigned long capabilities;
230 switch (hidpp_report->report_id) { in __hidpp_send_report()
238 fields_count = hidpp->very_long_report_length; in __hidpp_send_report()
241 return -ENODEV; in __hidpp_send_report()
248 hidpp_report->device_index = 0xff; in __hidpp_send_report()
250 if (hidpp->quirks & HIDPP_QUIRK_FORCE_OUTPUT_REPORTS) { in __hidpp_send_report()
253 ret = hid_hw_raw_request(hdev, hidpp_report->report_id, in __hidpp_send_report()
258 return ret == fields_count ? 0 : -1; in __hidpp_send_report()
264 * - If ' something else' is positive, that means that an error has been raised
266 * - If ' something else' is negative, that means that we had a classic error
267 * (-ENOMEM, -EPIPE, etc...)
275 mutex_lock(&hidpp->send_mutex); in hidpp_send_message_sync()
277 hidpp->send_receive_buf = response; in hidpp_send_message_sync()
278 hidpp->answer_available = false; in hidpp_send_message_sync()
286 ret = __hidpp_send_report(hidpp->hid_dev, message); in hidpp_send_message_sync()
294 if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, in hidpp_send_message_sync()
298 ret = -ETIMEDOUT; in hidpp_send_message_sync()
301 if (response->report_id == REPORT_ID_HIDPP_SHORT && in hidpp_send_message_sync()
302 response->rap.sub_id == HIDPP_ERROR) { in hidpp_send_message_sync()
303 ret = response->rap.params[1]; in hidpp_send_message_sync()
308 if ((response->report_id == REPORT_ID_HIDPP_LONG || in hidpp_send_message_sync()
309 response->report_id == REPORT_ID_HIDPP_VERY_LONG) && in hidpp_send_message_sync()
310 response->fap.feature_index == HIDPP20_ERROR) { in hidpp_send_message_sync()
311 ret = response->fap.params[1]; in hidpp_send_message_sync()
317 mutex_unlock(&hidpp->send_mutex); in hidpp_send_message_sync()
329 if (param_count > sizeof(message->fap.params)) in hidpp_send_fap_command_sync()
330 return -EINVAL; in hidpp_send_fap_command_sync()
334 return -ENOMEM; in hidpp_send_fap_command_sync()
336 if (param_count > (HIDPP_REPORT_LONG_LENGTH - 4)) in hidpp_send_fap_command_sync()
337 message->report_id = REPORT_ID_HIDPP_VERY_LONG; in hidpp_send_fap_command_sync()
339 message->report_id = REPORT_ID_HIDPP_LONG; in hidpp_send_fap_command_sync()
340 message->fap.feature_index = feat_index; in hidpp_send_fap_command_sync()
341 message->fap.funcindex_clientid = funcindex_clientid; in hidpp_send_fap_command_sync()
342 memcpy(&message->fap.params, params, param_count); in hidpp_send_fap_command_sync()
356 /* Send as long report if short reports are not supported. */ in hidpp_send_rap_command_sync()
358 !(hidpp_dev->supported_reports & HIDPP_REPORT_SHORT_SUPPORTED)) in hidpp_send_rap_command_sync()
363 max_count = HIDPP_REPORT_SHORT_LENGTH - 4; in hidpp_send_rap_command_sync()
366 max_count = HIDPP_REPORT_LONG_LENGTH - 4; in hidpp_send_rap_command_sync()
369 max_count = hidpp_dev->very_long_report_length - 4; in hidpp_send_rap_command_sync()
372 return -EINVAL; in hidpp_send_rap_command_sync()
376 return -EINVAL; in hidpp_send_rap_command_sync()
380 return -ENOMEM; in hidpp_send_rap_command_sync()
381 message->report_id = report_id; in hidpp_send_rap_command_sync()
382 message->rap.sub_id = sub_id; in hidpp_send_rap_command_sync()
383 message->rap.reg_address = reg_address; in hidpp_send_rap_command_sync()
384 memcpy(&message->rap.params, params, param_count); in hidpp_send_rap_command_sync()
401 return (answer->fap.feature_index == question->fap.feature_index) && in hidpp_match_answer()
402 (answer->fap.funcindex_clientid == question->fap.funcindex_clientid); in hidpp_match_answer()
408 return ((answer->rap.sub_id == HIDPP_ERROR) || in hidpp_match_error()
409 (answer->fap.feature_index == HIDPP20_ERROR)) && in hidpp_match_error()
410 (answer->fap.funcindex_clientid == question->fap.feature_index) && in hidpp_match_error()
411 (answer->fap.params[0] == question->fap.funcindex_clientid); in hidpp_match_error()
417 return (hidpp->wireless_feature_index && in hidpp_report_is_connect_event()
418 (report->fap.feature_index == hidpp->wireless_feature_index)) || in hidpp_report_is_connect_event()
419 ((report->report_id == REPORT_ID_HIDPP_SHORT) && in hidpp_report_is_connect_event()
420 (report->rap.sub_id == 0x41)); in hidpp_report_is_connect_event()
451 * hidpp_scroll_counter_handle_scroll() - Send high- and low-resolution scroll
452 * events given a high-resolution wheel
455 * @hi_res_value: the movement of the wheel, in the mouse's high-resolution
458 * Given a high-resolution movement, this function converts the movement into
459 * fractions of 120 and emits high-resolution scroll events for the input
461 * emit low-resolution scroll events when appropriate for
462 * backwards-compatibility with userspace input libraries.
469 unsigned long long now, previous; in hidpp_scroll_counter_handle_scroll()
471 hi_res_value = hi_res_value * 120/counter->wheel_multiplier; in hidpp_scroll_counter_handle_scroll()
474 remainder = counter->remainder; in hidpp_scroll_counter_handle_scroll()
475 direction = hi_res_value > 0 ? 1 : -1; in hidpp_scroll_counter_handle_scroll()
478 previous = counter->last_time; in hidpp_scroll_counter_handle_scroll()
479 counter->last_time = now; in hidpp_scroll_counter_handle_scroll()
486 if (now - previous > 1000000000 || direction != counter->direction) in hidpp_scroll_counter_handle_scroll()
489 counter->direction = direction; in hidpp_scroll_counter_handle_scroll()
493 * after slow movement, so we want the threshold for low-res events to in hidpp_scroll_counter_handle_scroll()
499 * is half-way to the next detent (i.e. scroll 1 detent after a in hidpp_scroll_counter_handle_scroll()
505 low_res_value = (hi_res_value > 0 ? 1 : -1); in hidpp_scroll_counter_handle_scroll()
507 remainder -= low_res_value * 120; in hidpp_scroll_counter_handle_scroll()
509 counter->remainder = remainder; in hidpp_scroll_counter_handle_scroll()
512 /* -------------------------------------------------------------------------- */
514 /* -------------------------------------------------------------------------- */
522 * hidpp10_set_register - Modify a HID++ 1.0 register.
574 /* On HID++ 1.0 devices, high-res scroll was called "scrolling acceleration". */
654 hidpp->battery.level = in hidpp10_query_battery_status()
657 hidpp->battery.status = status; in hidpp10_query_battery_status()
659 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING || in hidpp10_query_battery_status()
706 hidpp->battery.capacity = response.rap.params[0]; in hidpp10_query_battery_mileage()
708 hidpp->battery.status = status; in hidpp10_query_battery_mileage()
710 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING || in hidpp10_query_battery_mileage()
722 if (report->report_id != REPORT_ID_HIDPP_SHORT) in hidpp10_battery_event()
725 switch (report->rap.sub_id) { in hidpp10_battery_event()
727 capacity = hidpp->battery.capacity; in hidpp10_battery_event()
728 level = hidpp10_battery_status_map_level(report->rawbytes[1]); in hidpp10_battery_event()
729 status = hidpp10_battery_status_map_status(report->rawbytes[2]); in hidpp10_battery_event()
732 capacity = report->rap.params[0]; in hidpp10_battery_event()
733 level = hidpp->battery.level; in hidpp10_battery_event()
734 status = hidpp10_battery_mileage_map_status(report->rawbytes[3]); in hidpp10_battery_event()
740 changed = capacity != hidpp->battery.capacity || in hidpp10_battery_event()
741 level != hidpp->battery.level || in hidpp10_battery_event()
742 status != hidpp->battery.status; in hidpp10_battery_event()
745 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING || in hidpp10_battery_event()
749 hidpp->battery.level = level; in hidpp10_battery_event()
750 hidpp->battery.status = status; in hidpp10_battery_event()
751 if (hidpp->battery.ps) in hidpp10_battery_event()
752 power_supply_changed(hidpp->battery.ps); in hidpp10_battery_event()
822 struct hid_device *hdev = hidpp->hid_dev; in hidpp_unifying_init()
831 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial); in hidpp_unifying_init()
832 dbg_hid("HID++ Unifying: Got serial: %s\n", hdev->uniq); in hidpp_unifying_init()
836 return -EIO; in hidpp_unifying_init()
838 snprintf(hdev->name, sizeof(hdev->name), "%s", name); in hidpp_unifying_init()
845 /* -------------------------------------------------------------------------- */
847 /* -------------------------------------------------------------------------- */
870 return -ENOENT; in hidpp_root_get_feature()
892 hidpp->protocol_major = 1; in hidpp_root_get_protocol_version()
893 hidpp->protocol_minor = 0; in hidpp_root_get_protocol_version()
899 return -EIO; in hidpp_root_get_protocol_version()
902 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_root_get_protocol_version()
904 return -EPROTO; in hidpp_root_get_protocol_version()
910 hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", in hidpp_root_get_protocol_version()
912 return -EPROTO; in hidpp_root_get_protocol_version()
915 hidpp->protocol_major = response.rap.params[0]; in hidpp_root_get_protocol_version()
916 hidpp->protocol_minor = response.rap.params[1]; in hidpp_root_get_protocol_version()
919 hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n", in hidpp_root_get_protocol_version()
920 hidpp->protocol_major, hidpp->protocol_minor); in hidpp_root_get_protocol_version()
924 /* -------------------------------------------------------------------------- */
926 /* -------------------------------------------------------------------------- */
958 struct hid_device *hdev = hidpp->hid_dev; in hidpp_serial_init()
966 snprintf(hdev->uniq, sizeof(hdev->uniq), "%4phD", &serial); in hidpp_serial_init()
967 dbg_hid("HID++ DeviceInformation: Got serial: %s\n", hdev->uniq); in hidpp_serial_init()
972 /* -------------------------------------------------------------------------- */
974 /* -------------------------------------------------------------------------- */
992 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_count()
994 return -EPROTO; in hidpp_devicenametype_get_count()
1016 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_device_name()
1018 return -EPROTO; in hidpp_devicenametype_get_device_name()
1025 count = hidpp->very_long_report_length - 4; in hidpp_devicenametype_get_device_name()
1028 count = HIDPP_REPORT_LONG_LENGTH - 4; in hidpp_devicenametype_get_device_name()
1031 count = HIDPP_REPORT_SHORT_LENGTH - 4; in hidpp_devicenametype_get_device_name()
1034 return -EPROTO; in hidpp_devicenametype_get_device_name()
1072 __name_length - index); in hidpp_get_device_name()
1086 /* -------------------------------------------------------------------------- */
1088 /* -------------------------------------------------------------------------- */
1175 return -EIO; in hidpp20_batterylevel_get_battery_capacity()
1177 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_capacity()
1179 return -EPROTO; in hidpp20_batterylevel_get_battery_capacity()
1203 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_info()
1205 return -EPROTO; in hidpp20_batterylevel_get_battery_info()
1214 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS; in hidpp20_batterylevel_get_battery_info()
1216 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_MILEAGE; in hidpp20_batterylevel_get_battery_info()
1227 if (hidpp->battery.feature_index == 0xff) { in hidpp20_query_battery_info()
1230 &hidpp->battery.feature_index, in hidpp20_query_battery_info()
1237 hidpp->battery.feature_index, in hidpp20_query_battery_info()
1244 hidpp->battery.feature_index); in hidpp20_query_battery_info()
1248 hidpp->battery.status = status; in hidpp20_query_battery_info()
1249 hidpp->battery.capacity = capacity; in hidpp20_query_battery_info()
1250 hidpp->battery.level = level; in hidpp20_query_battery_info()
1252 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING || in hidpp20_query_battery_info()
1265 if (report->fap.feature_index != hidpp->battery.feature_index || in hidpp20_battery_event()
1266 report->fap.funcindex_clientid != EVENT_BATTERY_LEVEL_STATUS_BROADCAST) in hidpp20_battery_event()
1269 status = hidpp20_batterylevel_map_status_capacity(report->fap.params, in hidpp20_battery_event()
1275 hidpp->battery.online = status == POWER_SUPPLY_STATUS_DISCHARGING || in hidpp20_battery_event()
1278 changed = capacity != hidpp->battery.capacity || in hidpp20_battery_event()
1279 level != hidpp->battery.level || in hidpp20_battery_event()
1280 status != hidpp->battery.status; in hidpp20_battery_event()
1283 hidpp->battery.level = level; in hidpp20_battery_event()
1284 hidpp->battery.capacity = capacity; in hidpp20_battery_event()
1285 hidpp->battery.status = status; in hidpp20_battery_event()
1286 if (hidpp->battery.ps) in hidpp20_battery_event()
1287 power_supply_changed(hidpp->battery.ps); in hidpp20_battery_event()
1293 /* -------------------------------------------------------------------------- */
1295 /* -------------------------------------------------------------------------- */
1308 long flags = (long) data[2]; in hidpp20_battery_map_status_voltage()
1360 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_battery_get_battery_voltage()
1362 return -EPROTO; in hidpp20_battery_get_battery_voltage()
1367 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_VOLTAGE; in hidpp20_battery_get_battery_voltage()
1381 if (hidpp->battery.voltage_feature_index == 0xff) { in hidpp20_query_battery_voltage_info()
1383 &hidpp->battery.voltage_feature_index, in hidpp20_query_battery_voltage_info()
1390 hidpp->battery.voltage_feature_index, in hidpp20_query_battery_voltage_info()
1396 hidpp->battery.status = status; in hidpp20_query_battery_voltage_info()
1397 hidpp->battery.voltage = voltage; in hidpp20_query_battery_voltage_info()
1398 hidpp->battery.level = level; in hidpp20_query_battery_voltage_info()
1399 hidpp->battery.charge_type = charge_type; in hidpp20_query_battery_voltage_info()
1400 hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING; in hidpp20_query_battery_voltage_info()
1411 if (report->fap.feature_index != hidpp->battery.voltage_feature_index || in hidpp20_battery_voltage_event()
1412 report->fap.funcindex_clientid != EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST) in hidpp20_battery_voltage_event()
1415 status = hidpp20_battery_map_status_voltage(report->fap.params, &voltage, in hidpp20_battery_voltage_event()
1418 hidpp->battery.online = status != POWER_SUPPLY_STATUS_NOT_CHARGING; in hidpp20_battery_voltage_event()
1420 if (voltage != hidpp->battery.voltage || status != hidpp->battery.status) { in hidpp20_battery_voltage_event()
1421 hidpp->battery.voltage = voltage; in hidpp20_battery_voltage_event()
1422 hidpp->battery.status = status; in hidpp20_battery_voltage_event()
1423 hidpp->battery.level = level; in hidpp20_battery_voltage_event()
1424 hidpp->battery.charge_type = charge_type; in hidpp20_battery_voltage_event()
1425 if (hidpp->battery.ps) in hidpp20_battery_voltage_event()
1426 power_supply_changed(hidpp->battery.ps); in hidpp20_battery_voltage_event()
1452 val->intval = hidpp->battery.status; in hidpp_battery_get_property()
1455 val->intval = hidpp->battery.capacity; in hidpp_battery_get_property()
1458 val->intval = hidpp->battery.level; in hidpp_battery_get_property()
1461 val->intval = POWER_SUPPLY_SCOPE_DEVICE; in hidpp_battery_get_property()
1464 val->intval = hidpp->battery.online; in hidpp_battery_get_property()
1467 if (!strncmp(hidpp->name, "Logitech ", 9)) in hidpp_battery_get_property()
1468 val->strval = hidpp->name + 9; in hidpp_battery_get_property()
1470 val->strval = hidpp->name; in hidpp_battery_get_property()
1473 val->strval = "Logitech"; in hidpp_battery_get_property()
1476 val->strval = hidpp->hid_dev->uniq; in hidpp_battery_get_property()
1480 val->intval = hidpp->battery.voltage * 1000; in hidpp_battery_get_property()
1483 val->intval = hidpp->battery.charge_type; in hidpp_battery_get_property()
1486 ret = -EINVAL; in hidpp_battery_get_property()
1493 /* -------------------------------------------------------------------------- */
1495 /* -------------------------------------------------------------------------- */
1505 &hidpp->wireless_feature_index, in hidpp_set_wireless_feature_index()
1511 /* -------------------------------------------------------------------------- */
1512 /* 0x2120: Hi-resolution scrolling */
1513 /* -------------------------------------------------------------------------- */
1545 /* -------------------------------------------------------------------------- */
1547 /* -------------------------------------------------------------------------- */
1576 hid_warn(hidpp->hid_dev, in hidpp_hrw_get_wheel_capability()
1604 /* -------------------------------------------------------------------------- */
1606 /* -------------------------------------------------------------------------- */
1623 if (hidpp->battery.feature_index == 0xff) { in hidpp_solar_request_battery_event()
1626 &hidpp->battery.solar_feature_index, in hidpp_solar_request_battery_event()
1633 hidpp->battery.solar_feature_index, in hidpp_solar_request_battery_event()
1637 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_solar_request_battery_event()
1639 return -EPROTO; in hidpp_solar_request_battery_event()
1644 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_MILEAGE; in hidpp_solar_request_battery_event()
1656 function = report->fap.funcindex_clientid; in hidpp_solar_battery_event()
1659 if (report->fap.feature_index != hidpp->battery.solar_feature_index || in hidpp_solar_battery_event()
1665 capacity = report->fap.params[0]; in hidpp_solar_battery_event()
1669 lux = (report->fap.params[1] << 8) | report->fap.params[2]; in hidpp_solar_battery_event()
1677 if (capacity < hidpp->battery.capacity) in hidpp_solar_battery_event()
1687 hidpp->battery.online = true; in hidpp_solar_battery_event()
1688 if (capacity != hidpp->battery.capacity || in hidpp_solar_battery_event()
1689 status != hidpp->battery.status) { in hidpp_solar_battery_event()
1690 hidpp->battery.capacity = capacity; in hidpp_solar_battery_event()
1691 hidpp->battery.status = status; in hidpp_solar_battery_event()
1692 if (hidpp->battery.ps) in hidpp_solar_battery_event()
1693 power_supply_changed(hidpp->battery.ps); in hidpp_solar_battery_event()
1699 /* -------------------------------------------------------------------------- */
1701 /* -------------------------------------------------------------------------- */
1715 * send a set state command to the device by reading the current items->state
1727 CMD_TOUCHPAD_FW_ITEMS_SET, &items->state, 1, &response); in hidpp_touchpad_fw_items_set()
1730 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_fw_items_set()
1732 return -EPROTO; in hidpp_touchpad_fw_items_set()
1737 items->presence = params[0]; in hidpp_touchpad_fw_items_set()
1738 items->desired_state = params[1]; in hidpp_touchpad_fw_items_set()
1739 items->state = params[2]; in hidpp_touchpad_fw_items_set()
1740 items->persistent = params[3]; in hidpp_touchpad_fw_items_set()
1745 /* -------------------------------------------------------------------------- */
1747 /* -------------------------------------------------------------------------- */
1800 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_get_raw_info()
1802 return -EPROTO; in hidpp_touchpad_get_raw_info()
1807 raw_info->x_size = get_unaligned_be16(¶ms[0]); in hidpp_touchpad_get_raw_info()
1808 raw_info->y_size = get_unaligned_be16(¶ms[2]); in hidpp_touchpad_get_raw_info()
1809 raw_info->z_range = params[4]; in hidpp_touchpad_get_raw_info()
1810 raw_info->area_range = params[5]; in hidpp_touchpad_get_raw_info()
1811 raw_info->maxcontacts = params[7]; in hidpp_touchpad_get_raw_info()
1812 raw_info->origin = params[8]; in hidpp_touchpad_get_raw_info()
1814 raw_info->res = get_unaligned_be16(¶ms[13]) * 2 / 51; in hidpp_touchpad_get_raw_info()
1827 * bit 0 - enable raw in hidpp_touchpad_set_raw_report_state()
1828 * bit 1 - 16bit Z, no area in hidpp_touchpad_set_raw_report_state()
1829 * bit 2 - enhanced sensitivity in hidpp_touchpad_set_raw_report_state()
1830 * bit 3 - width, height (4 bits each) instead of area in hidpp_touchpad_set_raw_report_state()
1831 * bit 4 - send raw + gestures (degrades smoothness) in hidpp_touchpad_set_raw_report_state()
1832 * remaining bits - reserved in hidpp_touchpad_set_raw_report_state()
1846 finger->x = x_m << 6 | data[1]; in hidpp_touchpad_touch_event()
1847 finger->y = y_m << 6 | data[3]; in hidpp_touchpad_touch_event()
1849 finger->contact_type = data[0] >> 6; in hidpp_touchpad_touch_event()
1850 finger->contact_status = data[2] >> 6; in hidpp_touchpad_touch_event()
1852 finger->z = data[4]; in hidpp_touchpad_touch_event()
1853 finger->area = data[5]; in hidpp_touchpad_touch_event()
1854 finger->finger_id = data[6] >> 4; in hidpp_touchpad_touch_event()
1861 raw_xy->end_of_frame = data[8] & 0x01; in hidpp_touchpad_raw_xy_event()
1862 raw_xy->spurious_flag = (data[8] >> 1) & 0x01; in hidpp_touchpad_raw_xy_event()
1863 raw_xy->finger_count = data[15] & 0x0f; in hidpp_touchpad_raw_xy_event()
1864 raw_xy->button = (data[8] >> 2) & 0x01; in hidpp_touchpad_raw_xy_event()
1866 if (raw_xy->finger_count) { in hidpp_touchpad_raw_xy_event()
1867 hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]); in hidpp_touchpad_raw_xy_event()
1868 hidpp_touchpad_touch_event(&data[9], &raw_xy->fingers[1]); in hidpp_touchpad_raw_xy_event()
1872 /* -------------------------------------------------------------------------- */
1874 /* -------------------------------------------------------------------------- */
1905 #define HIDPP_FF_EFFECTID_NONE -1
1906 #define HIDPP_FF_EFFECTID_AUTOCENTER -2
1946 -1
1953 -1
1975 for (i = 0; i < data->num_effects; i++) in hidpp_ff_find_effect()
1976 if (data->effect_ids[i] == effect_id) in hidpp_ff_find_effect()
1985 struct hidpp_ff_private_data *data = wd->data; in hidpp_ff_work_handler()
1991 switch (wd->effect_id) { in hidpp_ff_work_handler()
1993 wd->params[0] = data->slot_autocenter; in hidpp_ff_work_handler()
2000 wd->params[0] = hidpp_ff_find_effect(data, wd->effect_id); in hidpp_ff_work_handler()
2005 ret = hidpp_send_fap_command_sync(data->hidpp, data->feature_index, in hidpp_ff_work_handler()
2006 wd->command, wd->params, wd->size, &response); in hidpp_ff_work_handler()
2009 hid_err(data->hidpp->hid_dev, "Failed to send command to device!\n"); in hidpp_ff_work_handler()
2014 switch (wd->command) { in hidpp_ff_work_handler()
2017 if (slot > 0 && slot <= data->num_effects) { in hidpp_ff_work_handler()
2018 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2020 data->effect_ids[slot-1] = wd->effect_id; in hidpp_ff_work_handler()
2021 else if (wd->effect_id >= HIDPP_FF_EFFECTID_AUTOCENTER) in hidpp_ff_work_handler()
2023 data->slot_autocenter = slot; in hidpp_ff_work_handler()
2027 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2029 data->effect_ids[wd->params[0]-1] = -1; in hidpp_ff_work_handler()
2030 else if (wd->effect_id >= HIDPP_FF_EFFECTID_AUTOCENTER) in hidpp_ff_work_handler()
2032 data->slot_autocenter = 0; in hidpp_ff_work_handler()
2035 data->gain = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2038 data->range = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2046 atomic_dec(&data->workqueue_size); in hidpp_ff_work_handler()
2056 return -ENOMEM; in hidpp_ff_queue_work()
2058 INIT_WORK(&wd->work, hidpp_ff_work_handler); in hidpp_ff_queue_work()
2060 wd->data = data; in hidpp_ff_queue_work()
2061 wd->effect_id = effect_id; in hidpp_ff_queue_work()
2062 wd->command = command; in hidpp_ff_queue_work()
2063 wd->size = size; in hidpp_ff_queue_work()
2064 memcpy(wd->params, params, size); in hidpp_ff_queue_work()
2066 atomic_inc(&data->workqueue_size); in hidpp_ff_queue_work()
2067 queue_work(data->wq, &wd->work); in hidpp_ff_queue_work()
2070 s = atomic_read(&data->workqueue_size); in hidpp_ff_queue_work()
2072 …hid_warn(data->hidpp->hid_dev, "Force feedback command queue contains %d commands, causing substan… in hidpp_ff_queue_work()
2079 struct hidpp_ff_private_data *data = dev->ff->private; in hidpp_ff_upload_effect()
2085 params[2] = effect->replay.length >> 8; in hidpp_ff_upload_effect()
2086 params[3] = effect->replay.length & 255; in hidpp_ff_upload_effect()
2087 params[4] = effect->replay.delay >> 8; in hidpp_ff_upload_effect()
2088 params[5] = effect->replay.delay & 255; in hidpp_ff_upload_effect()
2090 switch (effect->type) { in hidpp_ff_upload_effect()
2092 force = (effect->u.constant.level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; in hidpp_ff_upload_effect()
2096 params[8] = effect->u.constant.envelope.attack_level >> 7; in hidpp_ff_upload_effect()
2097 params[9] = effect->u.constant.envelope.attack_length >> 8; in hidpp_ff_upload_effect()
2098 params[10] = effect->u.constant.envelope.attack_length & 255; in hidpp_ff_upload_effect()
2099 params[11] = effect->u.constant.envelope.fade_level >> 7; in hidpp_ff_upload_effect()
2100 params[12] = effect->u.constant.envelope.fade_length >> 8; in hidpp_ff_upload_effect()
2101 params[13] = effect->u.constant.envelope.fade_length & 255; in hidpp_ff_upload_effect()
2104 effect->u.constant.level, in hidpp_ff_upload_effect()
2105 effect->direction, force); in hidpp_ff_upload_effect()
2106 dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", in hidpp_ff_upload_effect()
2107 effect->u.constant.envelope.attack_level, in hidpp_ff_upload_effect()
2108 effect->u.constant.envelope.attack_length, in hidpp_ff_upload_effect()
2109 effect->u.constant.envelope.fade_level, in hidpp_ff_upload_effect()
2110 effect->u.constant.envelope.fade_length); in hidpp_ff_upload_effect()
2114 switch (effect->u.periodic.waveform) { in hidpp_ff_upload_effect()
2131 …hid_err(data->hidpp->hid_dev, "Unexpected periodic waveform type %i!\n", effect->u.periodic.wavefo… in hidpp_ff_upload_effect()
2132 return -EINVAL; in hidpp_ff_upload_effect()
2134 force = (effect->u.periodic.magnitude * fixp_sin16((effect->direction * 360) >> 16)) >> 15; in hidpp_ff_upload_effect()
2135 params[6] = effect->u.periodic.magnitude >> 8; in hidpp_ff_upload_effect()
2136 params[7] = effect->u.periodic.magnitude & 255; in hidpp_ff_upload_effect()
2137 params[8] = effect->u.periodic.offset >> 8; in hidpp_ff_upload_effect()
2138 params[9] = effect->u.periodic.offset & 255; in hidpp_ff_upload_effect()
2139 params[10] = effect->u.periodic.period >> 8; in hidpp_ff_upload_effect()
2140 params[11] = effect->u.periodic.period & 255; in hidpp_ff_upload_effect()
2141 params[12] = effect->u.periodic.phase >> 8; in hidpp_ff_upload_effect()
2142 params[13] = effect->u.periodic.phase & 255; in hidpp_ff_upload_effect()
2143 params[14] = effect->u.periodic.envelope.attack_level >> 7; in hidpp_ff_upload_effect()
2144 params[15] = effect->u.periodic.envelope.attack_length >> 8; in hidpp_ff_upload_effect()
2145 params[16] = effect->u.periodic.envelope.attack_length & 255; in hidpp_ff_upload_effect()
2146 params[17] = effect->u.periodic.envelope.fade_level >> 7; in hidpp_ff_upload_effect()
2147 params[18] = effect->u.periodic.envelope.fade_length >> 8; in hidpp_ff_upload_effect()
2148 params[19] = effect->u.periodic.envelope.fade_length & 255; in hidpp_ff_upload_effect()
2150 dbg_hid("Uploading periodic force mag=%d/dir=%d, offset=%d, period=%d ms, phase=%d\n", in hidpp_ff_upload_effect()
2151 effect->u.periodic.magnitude, effect->direction, in hidpp_ff_upload_effect()
2152 effect->u.periodic.offset, in hidpp_ff_upload_effect()
2153 effect->u.periodic.period, in hidpp_ff_upload_effect()
2154 effect->u.periodic.phase); in hidpp_ff_upload_effect()
2155 dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", in hidpp_ff_upload_effect()
2156 effect->u.periodic.envelope.attack_level, in hidpp_ff_upload_effect()
2157 effect->u.periodic.envelope.attack_length, in hidpp_ff_upload_effect()
2158 effect->u.periodic.envelope.fade_level, in hidpp_ff_upload_effect()
2159 effect->u.periodic.envelope.fade_length); in hidpp_ff_upload_effect()
2164 force = (effect->u.ramp.start_level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; in hidpp_ff_upload_effect()
2167 force = (effect->u.ramp.end_level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; in hidpp_ff_upload_effect()
2170 params[10] = effect->u.ramp.envelope.attack_level >> 7; in hidpp_ff_upload_effect()
2171 params[11] = effect->u.ramp.envelope.attack_length >> 8; in hidpp_ff_upload_effect()
2172 params[12] = effect->u.ramp.envelope.attack_length & 255; in hidpp_ff_upload_effect()
2173 params[13] = effect->u.ramp.envelope.fade_level >> 7; in hidpp_ff_upload_effect()
2174 params[14] = effect->u.ramp.envelope.fade_length >> 8; in hidpp_ff_upload_effect()
2175 params[15] = effect->u.ramp.envelope.fade_length & 255; in hidpp_ff_upload_effect()
2177 dbg_hid("Uploading ramp force level=%d -> %d in dir %d = %d\n", in hidpp_ff_upload_effect()
2178 effect->u.ramp.start_level, in hidpp_ff_upload_effect()
2179 effect->u.ramp.end_level, in hidpp_ff_upload_effect()
2180 effect->direction, force); in hidpp_ff_upload_effect()
2181 dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", in hidpp_ff_upload_effect()
2182 effect->u.ramp.envelope.attack_level, in hidpp_ff_upload_effect()
2183 effect->u.ramp.envelope.attack_length, in hidpp_ff_upload_effect()
2184 effect->u.ramp.envelope.fade_level, in hidpp_ff_upload_effect()
2185 effect->u.ramp.envelope.fade_length); in hidpp_ff_upload_effect()
2191 params[1] = HIDPP_FF_CONDITION_CMDS[effect->type - FF_SPRING]; in hidpp_ff_upload_effect()
2192 params[6] = effect->u.condition[0].left_saturation >> 9; in hidpp_ff_upload_effect()
2193 params[7] = (effect->u.condition[0].left_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2194 params[8] = effect->u.condition[0].left_coeff >> 8; in hidpp_ff_upload_effect()
2195 params[9] = effect->u.condition[0].left_coeff & 255; in hidpp_ff_upload_effect()
2196 params[10] = effect->u.condition[0].deadband >> 9; in hidpp_ff_upload_effect()
2197 params[11] = (effect->u.condition[0].deadband >> 1) & 255; in hidpp_ff_upload_effect()
2198 params[12] = effect->u.condition[0].center >> 8; in hidpp_ff_upload_effect()
2199 params[13] = effect->u.condition[0].center & 255; in hidpp_ff_upload_effect()
2200 params[14] = effect->u.condition[0].right_coeff >> 8; in hidpp_ff_upload_effect()
2201 params[15] = effect->u.condition[0].right_coeff & 255; in hidpp_ff_upload_effect()
2202 params[16] = effect->u.condition[0].right_saturation >> 9; in hidpp_ff_upload_effect()
2203 params[17] = (effect->u.condition[0].right_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2206 HIDPP_FF_CONDITION_NAMES[effect->type - FF_SPRING], in hidpp_ff_upload_effect()
2207 effect->u.condition[0].left_coeff, in hidpp_ff_upload_effect()
2208 effect->u.condition[0].left_saturation, in hidpp_ff_upload_effect()
2209 effect->u.condition[0].right_coeff, in hidpp_ff_upload_effect()
2210 effect->u.condition[0].right_saturation); in hidpp_ff_upload_effect()
2212 effect->u.condition[0].deadband, in hidpp_ff_upload_effect()
2213 effect->u.condition[0].center); in hidpp_ff_upload_effect()
2216 hid_err(data->hidpp->hid_dev, "Unexpected force type %i!\n", effect->type); in hidpp_ff_upload_effect()
2217 return -EINVAL; in hidpp_ff_upload_effect()
2220 return hidpp_ff_queue_work(data, effect->id, HIDPP_FF_DOWNLOAD_EFFECT, params, size); in hidpp_ff_upload_effect()
2225 struct hidpp_ff_private_data *data = dev->ff->private; in hidpp_ff_playback()
2237 struct hidpp_ff_private_data *data = dev->ff->private; in hidpp_ff_erase_effect()
2247 struct hidpp_ff_private_data *data = dev->ff->private; in hidpp_ff_set_autocenter()
2269 struct hidpp_ff_private_data *data = dev->ff->private; in hidpp_ff_set_gain()
2285 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); in hidpp_ff_range_show()
2286 struct input_dev *idev = hidinput->input; in hidpp_ff_range_show()
2287 struct hidpp_ff_private_data *data = idev->ff->private; in hidpp_ff_range_show()
2289 return scnprintf(buf, PAGE_SIZE, "%u\n", data->range); in hidpp_ff_range_show()
2295 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); in hidpp_ff_range_store()
2296 struct input_dev *idev = hidinput->input; in hidpp_ff_range_store()
2297 struct hidpp_ff_private_data *data = idev->ff->private; in hidpp_ff_range_store()
2306 hidpp_ff_queue_work(data, -1, HIDPP_FF_SET_APERTURE, params, ARRAY_SIZE(params)); in hidpp_ff_range_store()
2315 struct hidpp_ff_private_data *data = ff->private; in hidpp_ff_destroy()
2316 struct hid_device *hid = data->hidpp->hid_dev; in hidpp_ff_destroy()
2320 device_remove_file(&hid->dev, &dev_attr_range); in hidpp_ff_destroy()
2321 destroy_workqueue(data->wq); in hidpp_ff_destroy()
2322 kfree(data->effect_ids); in hidpp_ff_destroy()
2328 struct hid_device *hid = hidpp->hid_dev; in hidpp_ff_init()
2331 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor); in hidpp_ff_init()
2332 const u16 bcdDevice = le16_to_cpu(udesc->bcdDevice); in hidpp_ff_init()
2334 int error, j, num_slots = data->num_effects; in hidpp_ff_init()
2337 if (list_empty(&hid->inputs)) { in hidpp_ff_init()
2339 return -ENODEV; in hidpp_ff_init()
2341 hidinput = list_entry(hid->inputs.next, struct hid_input, list); in hidpp_ff_init()
2342 dev = hidinput->input; in hidpp_ff_init()
2346 return -EINVAL; in hidpp_ff_init()
2354 set_bit(hidpp_ff_effects[j], dev->ffbit); in hidpp_ff_init()
2357 set_bit(hidpp_ff_effects_v2[j], dev->ffbit); in hidpp_ff_init()
2371 return -ENOMEM; in hidpp_ff_init()
2372 data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL); in hidpp_ff_init()
2373 if (!data->effect_ids) { in hidpp_ff_init()
2375 return -ENOMEM; in hidpp_ff_init()
2377 data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); in hidpp_ff_init()
2378 if (!data->wq) { in hidpp_ff_init()
2379 kfree(data->effect_ids); in hidpp_ff_init()
2381 return -ENOMEM; in hidpp_ff_init()
2384 data->hidpp = hidpp; in hidpp_ff_init()
2385 data->version = version; in hidpp_ff_init()
2387 data->effect_ids[j] = -1; in hidpp_ff_init()
2389 ff = dev->ff; in hidpp_ff_init()
2390 ff->private = data; in hidpp_ff_init()
2392 ff->upload = hidpp_ff_upload_effect; in hidpp_ff_init()
2393 ff->erase = hidpp_ff_erase_effect; in hidpp_ff_init()
2394 ff->playback = hidpp_ff_playback; in hidpp_ff_init()
2395 ff->set_gain = hidpp_ff_set_gain; in hidpp_ff_init()
2396 ff->set_autocenter = hidpp_ff_set_autocenter; in hidpp_ff_init()
2397 ff->destroy = hidpp_ff_destroy; in hidpp_ff_init()
2400 error = device_create_file(&(hidpp->hid_dev->dev), &dev_attr_range); in hidpp_ff_init()
2402 hid_warn(hidpp->hid_dev, "Unable to create sysfs interface for \"range\", errno %d!\n", error); in hidpp_ff_init()
2405 atomic_set(&data->workqueue_size, 0); in hidpp_ff_init()
2419 /* -------------------------------------------------------------------------- */
2421 /* -------------------------------------------------------------------------- */
2437 unsigned long **bit, int *max) in wtp_input_mapping()
2439 return -1; in wtp_input_mapping()
2445 struct wtp_data *wd = hidpp->private_data; in wtp_populate_input()
2447 __set_bit(EV_ABS, input_dev->evbit); in wtp_populate_input()
2448 __set_bit(EV_KEY, input_dev->evbit); in wtp_populate_input()
2449 __clear_bit(EV_REL, input_dev->evbit); in wtp_populate_input()
2450 __clear_bit(EV_LED, input_dev->evbit); in wtp_populate_input()
2452 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); in wtp_populate_input()
2453 input_abs_set_res(input_dev, ABS_MT_POSITION_X, wd->resolution); in wtp_populate_input()
2454 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); in wtp_populate_input()
2455 input_abs_set_res(input_dev, ABS_MT_POSITION_Y, wd->resolution); in wtp_populate_input()
2462 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) in wtp_populate_input()
2465 __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); in wtp_populate_input()
2467 input_mt_init_slots(input_dev, wd->maxcontacts, INPUT_MT_POINTER | in wtp_populate_input()
2474 struct wtp_data *wd = hidpp->private_data; in wtp_touch_event()
2477 if (!touch_report->finger_id || touch_report->contact_type) in wtp_touch_event()
2481 slot = input_mt_get_slot_by_key(hidpp->input, touch_report->finger_id); in wtp_touch_event()
2483 input_mt_slot(hidpp->input, slot); in wtp_touch_event()
2484 input_mt_report_slot_state(hidpp->input, MT_TOOL_FINGER, in wtp_touch_event()
2485 touch_report->contact_status); in wtp_touch_event()
2486 if (touch_report->contact_status) { in wtp_touch_event()
2487 input_event(hidpp->input, EV_ABS, ABS_MT_POSITION_X, in wtp_touch_event()
2488 touch_report->x); in wtp_touch_event()
2489 input_event(hidpp->input, EV_ABS, ABS_MT_POSITION_Y, in wtp_touch_event()
2490 wd->flip_y ? wd->y_size - touch_report->y : in wtp_touch_event()
2491 touch_report->y); in wtp_touch_event()
2492 input_event(hidpp->input, EV_ABS, ABS_MT_PRESSURE, in wtp_touch_event()
2493 touch_report->area); in wtp_touch_event()
2503 wtp_touch_event(hidpp, &(raw->fingers[i])); in wtp_send_raw_xy_event()
2505 if (raw->end_of_frame && in wtp_send_raw_xy_event()
2506 !(hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS)) in wtp_send_raw_xy_event()
2507 input_event(hidpp->input, EV_KEY, BTN_LEFT, raw->button); in wtp_send_raw_xy_event()
2509 if (raw->end_of_frame || raw->finger_count <= 2) { in wtp_send_raw_xy_event()
2510 input_mt_sync_frame(hidpp->input); in wtp_send_raw_xy_event()
2511 input_sync(hidpp->input); in wtp_send_raw_xy_event()
2517 struct wtp_data *wd = hidpp->private_data; in wtp_mouse_raw_xy_event()
2543 .finger_count = wd->maxcontacts, in wtp_mouse_raw_xy_event()
2557 struct wtp_data *wd = hidpp->private_data; in wtp_raw_event()
2561 if (!wd || !hidpp->input) in wtp_raw_event()
2571 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { in wtp_raw_event()
2572 input_event(hidpp->input, EV_KEY, BTN_LEFT, in wtp_raw_event()
2574 input_event(hidpp->input, EV_KEY, BTN_RIGHT, in wtp_raw_event()
2576 input_sync(hidpp->input); in wtp_raw_event()
2585 if ((report->fap.feature_index != wd->mt_feature_index) || in wtp_raw_event()
2586 (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) in wtp_raw_event()
2599 struct wtp_data *wd = hidpp->private_data; in wtp_get_config()
2605 &wd->mt_feature_index, &feature_type); in wtp_get_config()
2610 ret = hidpp_touchpad_get_raw_info(hidpp, wd->mt_feature_index, in wtp_get_config()
2615 wd->x_size = raw_info.x_size; in wtp_get_config()
2616 wd->y_size = raw_info.y_size; in wtp_get_config()
2617 wd->maxcontacts = raw_info.maxcontacts; in wtp_get_config()
2618 wd->flip_y = raw_info.origin == TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT; in wtp_get_config()
2619 wd->resolution = raw_info.res; in wtp_get_config()
2620 if (!wd->resolution) in wtp_get_config()
2621 wd->resolution = WTP_MANUAL_RESOLUTION; in wtp_get_config()
2631 wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), in wtp_allocate()
2634 return -ENOMEM; in wtp_allocate()
2636 hidpp->private_data = wd; in wtp_allocate()
2644 struct wtp_data *wd = hidpp->private_data; in wtp_connect()
2647 if (!wd->x_size) { in wtp_connect()
2655 return hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, in wtp_connect()
2659 /* ------------------------------------------------------------------------- */
2661 /* ------------------------------------------------------------------------- */
2670 * is different from the odd press and the even press.
2672 * forward button -> Super_R
2673 * backward button -> Super_L+'d' (press only)
2674 * middle button -> 1st time: Alt_L+SuperL+XF86TouchpadOff (press only)
2675 * 2nd time: left-click (press only)
2676 * NB: press-only means that when the button is pressed, the
2684 * - it never sends a keyboard key event
2685 * - for the three mouse button it sends:
2686 * middle button press 11<xx>0a 3500af00...
2687 * side 1 button (forward) press 11<xx>0a 3500b000...
2688 * side 2 button (backward) press 11<xx>0a 3500ae00...
2726 if (!hidpp->input) { in m560_raw_event()
2728 return -EINVAL; in m560_raw_event()
2742 * data[1] = device-id in m560_raw_event()
2744 * data[5] = 0xaf -> middle in m560_raw_event()
2745 * 0xb0 -> forward in m560_raw_event()
2746 * 0xae -> backward in m560_raw_event()
2747 * 0x00 -> release all in m560_raw_event()
2753 input_report_key(hidpp->input, BTN_MIDDLE, 1); in m560_raw_event()
2756 input_report_key(hidpp->input, BTN_FORWARD, 1); in m560_raw_event()
2759 input_report_key(hidpp->input, BTN_BACK, 1); in m560_raw_event()
2762 input_report_key(hidpp->input, BTN_BACK, 0); in m560_raw_event()
2763 input_report_key(hidpp->input, BTN_FORWARD, 0); in m560_raw_event()
2764 input_report_key(hidpp->input, BTN_MIDDLE, 0); in m560_raw_event()
2770 input_sync(hidpp->input); in m560_raw_event()
2784 input_report_key(hidpp->input, BTN_LEFT, in m560_raw_event()
2786 input_report_key(hidpp->input, BTN_RIGHT, in m560_raw_event()
2790 input_report_rel(hidpp->input, REL_HWHEEL, -1); in m560_raw_event()
2791 input_report_rel(hidpp->input, REL_HWHEEL_HI_RES, in m560_raw_event()
2792 -120); in m560_raw_event()
2794 input_report_rel(hidpp->input, REL_HWHEEL, 1); in m560_raw_event()
2795 input_report_rel(hidpp->input, REL_HWHEEL_HI_RES, in m560_raw_event()
2800 input_report_rel(hidpp->input, REL_X, v); in m560_raw_event()
2803 input_report_rel(hidpp->input, REL_Y, v); in m560_raw_event()
2807 hidpp_scroll_counter_handle_scroll(hidpp->input, in m560_raw_event()
2808 &hidpp->vertical_wheel_counter, v); in m560_raw_event()
2810 input_sync(hidpp->input); in m560_raw_event()
2819 __set_bit(EV_KEY, input_dev->evbit); in m560_populate_input()
2820 __set_bit(BTN_MIDDLE, input_dev->keybit); in m560_populate_input()
2821 __set_bit(BTN_RIGHT, input_dev->keybit); in m560_populate_input()
2822 __set_bit(BTN_LEFT, input_dev->keybit); in m560_populate_input()
2823 __set_bit(BTN_BACK, input_dev->keybit); in m560_populate_input()
2824 __set_bit(BTN_FORWARD, input_dev->keybit); in m560_populate_input()
2826 __set_bit(EV_REL, input_dev->evbit); in m560_populate_input()
2827 __set_bit(REL_X, input_dev->relbit); in m560_populate_input()
2828 __set_bit(REL_Y, input_dev->relbit); in m560_populate_input()
2829 __set_bit(REL_WHEEL, input_dev->relbit); in m560_populate_input()
2830 __set_bit(REL_HWHEEL, input_dev->relbit); in m560_populate_input()
2831 __set_bit(REL_WHEEL_HI_RES, input_dev->relbit); in m560_populate_input()
2832 __set_bit(REL_HWHEEL_HI_RES, input_dev->relbit); in m560_populate_input()
2837 unsigned long **bit, int *max) in m560_input_mapping()
2839 return -1; in m560_input_mapping()
2842 /* ------------------------------------------------------------------------- */
2844 /* ------------------------------------------------------------------------- */
2849 * tap-to-click but the setting is not remembered accross reset, annoying some
2862 struct k400_private_data *k400 = hidpp->private_data; in k400_disable_tap_to_click()
2867 if (!k400->feature_index) { in k400_disable_tap_to_click()
2870 &k400->feature_index, &feature_type); in k400_disable_tap_to_click()
2876 ret = hidpp_touchpad_fw_items_set(hidpp, k400->feature_index, &items); in k400_disable_tap_to_click()
2888 k400 = devm_kzalloc(&hdev->dev, sizeof(struct k400_private_data), in k400_allocate()
2891 return -ENOMEM; in k400_allocate()
2893 hidpp->private_data = k400; in k400_allocate()
2908 /* ------------------------------------------------------------------------- */
2910 /* ------------------------------------------------------------------------- */
2926 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index, in g920_ff_set_autocenter()
2931 hid_warn(hidpp->hid_dev, "Failed to autocenter device!\n"); in g920_ff_set_autocenter()
2933 data->slot_autocenter = response.fap.params[0]; in g920_ff_set_autocenter()
2949 &data->feature_index, &feature_type); in g920_get_config()
2954 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index, in g920_get_config()
2961 hid_err(hidpp->hid_dev, in g920_get_config()
2963 return -EPROTO; in g920_get_config()
2966 data->num_effects = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS; in g920_get_config()
2969 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index, in g920_get_config()
2974 hid_warn(hidpp->hid_dev, "Failed to reset all forces!\n"); in g920_get_config()
2976 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index, in g920_get_config()
2981 hid_warn(hidpp->hid_dev, in g920_get_config()
2984 data->range = ret ? in g920_get_config()
2988 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index, in g920_get_config()
2993 hid_warn(hidpp->hid_dev, in g920_get_config()
2995 data->gain = ret ? in g920_get_config()
3003 /* -------------------------------------------------------------------------- */
3005 /* -------------------------------------------------------------------------- */
3010 unsigned long **bit, int *max) in lg_dinovo_input_mapping()
3012 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) in lg_dinovo_input_mapping()
3015 switch (usage->hid & HID_USAGE) { in lg_dinovo_input_mapping()
3023 /* -------------------------------------------------------------------------- */
3025 /* -------------------------------------------------------------------------- */
3038 if (!hidpp->input) in hidpp10_wheel_raw_event()
3039 return -EINVAL; in hidpp10_wheel_raw_event()
3050 input_report_rel(hidpp->input, REL_WHEEL, value); in hidpp10_wheel_raw_event()
3051 input_report_rel(hidpp->input, REL_WHEEL_HI_RES, value * 120); in hidpp10_wheel_raw_event()
3052 input_report_rel(hidpp->input, REL_HWHEEL, hvalue); in hidpp10_wheel_raw_event()
3053 input_report_rel(hidpp->input, REL_HWHEEL_HI_RES, hvalue * 120); in hidpp10_wheel_raw_event()
3054 input_sync(hidpp->input); in hidpp10_wheel_raw_event()
3062 __set_bit(EV_REL, input_dev->evbit); in hidpp10_wheel_populate_input()
3063 __set_bit(REL_WHEEL, input_dev->relbit); in hidpp10_wheel_populate_input()
3064 __set_bit(REL_WHEEL_HI_RES, input_dev->relbit); in hidpp10_wheel_populate_input()
3065 __set_bit(REL_HWHEEL, input_dev->relbit); in hidpp10_wheel_populate_input()
3066 __set_bit(REL_HWHEEL_HI_RES, input_dev->relbit); in hidpp10_wheel_populate_input()
3069 /* -------------------------------------------------------------------------- */
3071 /* -------------------------------------------------------------------------- */
3084 if (!hidpp->input) in hidpp10_extra_mouse_buttons_raw_event()
3085 return -EINVAL; in hidpp10_extra_mouse_buttons_raw_event()
3098 * the same usb-id show different behavior, so we handle both cases. in hidpp10_extra_mouse_buttons_raw_event()
3101 input_report_key(hidpp->input, BTN_MOUSE + i, in hidpp10_extra_mouse_buttons_raw_event()
3106 input_report_key(hidpp->input, BTN_MISC + i, in hidpp10_extra_mouse_buttons_raw_event()
3109 input_sync(hidpp->input); in hidpp10_extra_mouse_buttons_raw_event()
3116 /* BTN_MOUSE - BTN_MOUSE+7 are set already by the descriptor */ in hidpp10_extra_mouse_buttons_populate_input()
3117 __set_bit(BTN_0, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3118 __set_bit(BTN_1, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3119 __set_bit(BTN_2, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3120 __set_bit(BTN_3, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3121 __set_bit(BTN_4, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3122 __set_bit(BTN_5, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3123 __set_bit(BTN_6, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3124 __set_bit(BTN_7, input_dev->keybit); in hidpp10_extra_mouse_buttons_populate_input()
3127 /* -------------------------------------------------------------------------- */
3128 /* HID++1.0 kbds which only report 0x10xx consumer usages through sub-id 0x03 */
3129 /* -------------------------------------------------------------------------- */
3131 /* Find the consumer-page input report desc and change Maximums to 0x107f */
3150 size = *rsize - (consumer_rdesc - rdesc); in hidpp10_consumer_keys_report_fixup()
3186 hid_report_raw_event(hidpp->hid_dev, HID_INPUT_REPORT, in hidpp10_consumer_keys_raw_event()
3192 /* -------------------------------------------------------------------------- */
3193 /* High-resolution scroll wheels */
3194 /* -------------------------------------------------------------------------- */
3201 if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2121) { in hi_res_scroll_enable()
3205 } else if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_X2120) { in hi_res_scroll_enable()
3208 } else /* if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL_1P0) */ { in hi_res_scroll_enable()
3218 hidpp->vertical_wheel_counter.wheel_multiplier = multiplier; in hi_res_scroll_enable()
3219 hid_dbg(hidpp->hid_dev, "wheel multiplier = %d\n", multiplier); in hi_res_scroll_enable()
3223 /* -------------------------------------------------------------------------- */
3225 /* -------------------------------------------------------------------------- */
3236 if (hdev->group == HID_GROUP_LOGITECH_27MHZ_DEVICE || in hidpp_report_fixup()
3237 (hidpp->quirks & HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS)) in hidpp_report_fixup()
3245 unsigned long **bit, int *max) in hidpp_input_mapping()
3252 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) in hidpp_input_mapping()
3254 else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560 && in hidpp_input_mapping()
3255 field->application != HID_GD_MOUSE) in hidpp_input_mapping()
3258 if (hdev->product == DINOVO_MINI_PRODUCT_ID) in hidpp_input_mapping()
3266 unsigned long **bit, int *max) in hidpp_input_mapped()
3274 if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) { in hidpp_input_mapped()
3275 if (usage->type == EV_ABS && (usage->code == ABS_X || in hidpp_input_mapped()
3276 usage->code == ABS_Y || usage->code == ABS_Z || in hidpp_input_mapped()
3277 usage->code == ABS_RZ)) { in hidpp_input_mapped()
3278 field->application = HID_GD_MULTIAXIS; in hidpp_input_mapped()
3289 hidpp->input = input; in hidpp_populate_input()
3291 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) in hidpp_populate_input()
3293 else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560) in hidpp_populate_input()
3296 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_WHEELS) in hidpp_populate_input()
3299 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS) in hidpp_populate_input()
3307 struct input_dev *input = hidinput->input; in hidpp_input_configured()
3320 struct hidpp_report *question = hidpp->send_receive_buf; in hidpp_raw_hidpp_event()
3321 struct hidpp_report *answer = hidpp->send_receive_buf; in hidpp_raw_hidpp_event()
3329 if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { in hidpp_raw_hidpp_event()
3337 hidpp->answer_available = true; in hidpp_raw_hidpp_event()
3338 wake_up(&hidpp->wait); in hidpp_raw_hidpp_event()
3341 * We return 1 to hid-core to avoid forwarding the in hidpp_raw_hidpp_event()
3350 atomic_set(&hidpp->connected, in hidpp_raw_hidpp_event()
3351 !(report->rap.params[0] & (1 << 6))); in hidpp_raw_hidpp_event()
3352 if (schedule_work(&hidpp->work) == 0) in hidpp_raw_hidpp_event()
3357 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_BATTERY) { in hidpp_raw_hidpp_event()
3369 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP10_BATTERY) { in hidpp_raw_hidpp_event()
3375 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_WHEELS) { in hidpp_raw_hidpp_event()
3381 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS) { in hidpp_raw_hidpp_event()
3387 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS) { in hidpp_raw_hidpp_event()
3408 if (size != hidpp->very_long_report_length) { in hidpp_raw_event()
3438 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) in hidpp_raw_event()
3440 else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560) in hidpp_raw_event()
3458 counter = &hidpp->vertical_wheel_counter; in hidpp_event()
3460 * the input device set, or high-res scroll enabling may fail. In such in hidpp_event()
3464 if (!(hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) || value == 0 in hidpp_event()
3465 || hidpp->input == NULL || counter->wheel_multiplier == 0) in hidpp_event()
3468 hidpp_scroll_counter_handle_scroll(hidpp->input, counter, value); in hidpp_event()
3476 struct power_supply_desc *desc = &hidpp->battery.desc; in hidpp_initialize_battery()
3480 unsigned long n; in hidpp_initialize_battery()
3483 if (hidpp->battery.ps) in hidpp_initialize_battery()
3486 hidpp->battery.feature_index = 0xff; in hidpp_initialize_battery()
3487 hidpp->battery.solar_feature_index = 0xff; in hidpp_initialize_battery()
3488 hidpp->battery.voltage_feature_index = 0xff; in hidpp_initialize_battery()
3490 if (hidpp->protocol_major >= 2) { in hidpp_initialize_battery()
3491 if (hidpp->quirks & HIDPP_QUIRK_CLASS_K750) in hidpp_initialize_battery()
3501 hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP20_BATTERY; in hidpp_initialize_battery()
3507 return -ENOENT; in hidpp_initialize_battery()
3508 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_MILEAGE; in hidpp_initialize_battery()
3510 hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS; in hidpp_initialize_battery()
3512 hidpp->capabilities |= HIDPP_CAPABILITY_HIDPP10_BATTERY; in hidpp_initialize_battery()
3515 battery_props = devm_kmemdup(&hidpp->hid_dev->dev, in hidpp_initialize_battery()
3520 return -ENOMEM; in hidpp_initialize_battery()
3522 num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 3; in hidpp_initialize_battery()
3524 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE) in hidpp_initialize_battery()
3528 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS) in hidpp_initialize_battery()
3532 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_VOLTAGE) in hidpp_initialize_battery()
3536 battery = &hidpp->battery; in hidpp_initialize_battery()
3538 n = atomic_inc_return(&battery_no) - 1; in hidpp_initialize_battery()
3539 desc->properties = battery_props; in hidpp_initialize_battery()
3540 desc->num_properties = num_battery_props; in hidpp_initialize_battery()
3541 desc->get_property = hidpp_battery_get_property; in hidpp_initialize_battery()
3542 sprintf(battery->name, "hidpp_battery_%ld", n); in hidpp_initialize_battery()
3543 desc->name = battery->name; in hidpp_initialize_battery()
3544 desc->type = POWER_SUPPLY_TYPE_BATTERY; in hidpp_initialize_battery()
3545 desc->use_for_apm = 0; in hidpp_initialize_battery()
3547 battery->ps = devm_power_supply_register(&hidpp->hid_dev->dev, in hidpp_initialize_battery()
3548 &battery->desc, in hidpp_initialize_battery()
3550 if (IS_ERR(battery->ps)) in hidpp_initialize_battery()
3551 return PTR_ERR(battery->ps); in hidpp_initialize_battery()
3553 power_supply_powers(battery->ps, &hidpp->hid_dev->dev); in hidpp_initialize_battery()
3563 if (hidpp->protocol_major < 2) in hidpp_overwrite_name()
3572 snprintf(hdev->name, sizeof(hdev->name), "%s", name); in hidpp_overwrite_name()
3594 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); in hidpp_allocate_input()
3601 input_dev->open = hidpp_input_open; in hidpp_allocate_input()
3602 input_dev->close = hidpp_input_close; in hidpp_allocate_input()
3604 input_dev->name = hidpp->name; in hidpp_allocate_input()
3605 input_dev->phys = hdev->phys; in hidpp_allocate_input()
3606 input_dev->uniq = hdev->uniq; in hidpp_allocate_input()
3607 input_dev->id.bustype = hdev->bus; in hidpp_allocate_input()
3608 input_dev->id.vendor = hdev->vendor; in hidpp_allocate_input()
3609 input_dev->id.product = hdev->product; in hidpp_allocate_input()
3610 input_dev->id.version = hdev->version; in hidpp_allocate_input()
3611 input_dev->dev.parent = &hdev->dev; in hidpp_allocate_input()
3618 struct hid_device *hdev = hidpp->hid_dev; in hidpp_connect_event()
3620 bool connected = atomic_read(&hidpp->connected); in hidpp_connect_event()
3625 if (hidpp->battery.ps) { in hidpp_connect_event()
3626 hidpp->battery.online = false; in hidpp_connect_event()
3627 hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN; in hidpp_connect_event()
3628 hidpp->battery.level = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN; in hidpp_connect_event()
3629 power_supply_changed(hidpp->battery.ps); in hidpp_connect_event()
3634 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { in hidpp_connect_event()
3638 } else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560) { in hidpp_connect_event()
3642 } else if (hidpp->quirks & HIDPP_QUIRK_CLASS_K400) { in hidpp_connect_event()
3648 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_WHEELS) { in hidpp_connect_event()
3654 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_EXTRA_MOUSE_BTNS) { in hidpp_connect_event()
3660 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS) { in hidpp_connect_event()
3668 if (!hidpp->protocol_major) { in hidpp_connect_event()
3676 if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) { in hidpp_connect_event()
3679 devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, in hidpp_connect_event()
3685 hidpp->name = devm_name; in hidpp_connect_event()
3692 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP10_BATTERY) { in hidpp_connect_event()
3694 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE) in hidpp_connect_event()
3698 } else if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_BATTERY) { in hidpp_connect_event()
3699 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_VOLTAGE) in hidpp_connect_event()
3704 if (hidpp->battery.ps) in hidpp_connect_event()
3705 power_supply_changed(hidpp->battery.ps); in hidpp_connect_event()
3707 if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) in hidpp_connect_event()
3710 if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) in hidpp_connect_event()
3726 hidpp->delayed_input = input; in hidpp_connect_event()
3745 re = &(hdev->report_enum[HID_OUTPUT_REPORT]); in hidpp_get_report_length()
3746 report = re->report_id_hash[id]; in hidpp_get_report_length()
3750 return report->field[0]->report_count + 1; in hidpp_get_report_length()
3785 hidpp->very_long_report_length = report_length; in hidpp_validate_device()
3801 report_list = &hdev->report_enum[HID_INPUT_REPORT].report_list; in hidpp_application_equals()
3803 return report && report->application == application; in hidpp_application_equals()
3816 hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL); in hidpp_probe()
3818 return -ENOMEM; in hidpp_probe()
3820 hidpp->hid_dev = hdev; in hidpp_probe()
3821 hidpp->name = hdev->name; in hidpp_probe()
3822 hidpp->quirks = id->driver_data; in hidpp_probe()
3834 hidpp->supported_reports = hidpp_validate_device(hdev); in hidpp_probe()
3836 if (!hidpp->supported_reports) { in hidpp_probe()
3838 devm_kfree(&hdev->dev, hidpp); in hidpp_probe()
3842 if (id->group == HID_GROUP_LOGITECH_DJ_DEVICE) in hidpp_probe()
3843 hidpp->quirks |= HIDPP_QUIRK_UNIFYING; in hidpp_probe()
3845 if (id->group == HID_GROUP_LOGITECH_27MHZ_DEVICE && in hidpp_probe()
3847 hidpp->quirks |= HIDPP_QUIRK_HIDPP_WHEELS | in hidpp_probe()
3850 if (id->group == HID_GROUP_LOGITECH_27MHZ_DEVICE && in hidpp_probe()
3852 hidpp->quirks |= HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS; in hidpp_probe()
3855 hidpp->quirks &= ~HIDPP_QUIRK_CLASS_WTP; in hidpp_probe()
3856 hidpp->quirks &= ~HIDPP_QUIRK_NO_HIDINPUT; in hidpp_probe()
3859 if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { in hidpp_probe()
3863 } else if (hidpp->quirks & HIDPP_QUIRK_CLASS_K400) { in hidpp_probe()
3869 if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT || in hidpp_probe()
3870 hidpp->quirks & HIDPP_QUIRK_UNIFYING) in hidpp_probe()
3873 INIT_WORK(&hidpp->work, delayed_work_cb); in hidpp_probe()
3874 mutex_init(&hidpp->send_mutex); in hidpp_probe()
3875 init_waitqueue_head(&hidpp->wait); in hidpp_probe()
3878 ret = sysfs_create_group(&hdev->dev.kobj, &ps_attribute_group); in hidpp_probe()
3881 hdev->name); in hidpp_probe()
3895 dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n", in hidpp_probe()
3903 if (hidpp->quirks & HIDPP_QUIRK_UNIFYING) in hidpp_probe()
3905 else if (hid_is_usb(hidpp->hid_dev)) in hidpp_probe()
3909 atomic_set(&hidpp->connected, connected); in hidpp_probe()
3910 if (!(hidpp->quirks & HIDPP_QUIRK_UNIFYING)) { in hidpp_probe()
3912 ret = -ENODEV; in hidpp_probe()
3920 if (connected && hidpp->protocol_major >= 2) { in hidpp_probe()
3922 if (ret == -ENOENT) in hidpp_probe()
3923 hidpp->wireless_feature_index = 0; in hidpp_probe()
3929 if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) { in hidpp_probe()
3933 } else if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_G920)) { in hidpp_probe()
3947 if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) in hidpp_probe()
3958 if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) { in hidpp_probe()
3961 hid_warn(hidpp->hid_dev, in hidpp_probe()
3973 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group); in hidpp_probe()
3974 cancel_work_sync(&hidpp->work); in hidpp_probe()
3975 mutex_destroy(&hidpp->send_mutex); in hidpp_probe()
3986 sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group); in hidpp_remove()
3989 cancel_work_sync(&hidpp->work); in hidpp_remove()
3990 mutex_destroy(&hidpp->send_mutex); in hidpp_remove()
4055 { /* Keyboard MX5000 (Bluetooth-receiver in HID proxy mode) */
4058 { /* Dinovo Edge (Bluetooth-receiver in HID proxy mode) */
4061 { /* Keyboard MX5500 (Bluetooth-receiver in HID proxy mode) */
4067 { /* Keyboard LX501 (Y-RR53) */
4070 { /* Keyboard MX3000 (Y-RAM74) */
4073 { /* Keyboard MX3200 (Y-RAV80) */
4126 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
4130 .name = "logitech-hidpp-device",