Lines Matching +full:0 +full:x4301

42 #define LINUX_KERNEL_SW_ID			0x01
44 #define REPORT_ID_HIDPP_SHORT 0x10
45 #define REPORT_ID_HIDPP_LONG 0x11
46 #define REPORT_ID_HIDPP_VERY_LONG 0x12
52 #define HIDPP_REPORT_SHORT_SUPPORTED BIT(0)
56 #define HIDPP_SUB_ID_CONSUMER_VENDOR_KEYS 0x03
57 #define HIDPP_SUB_ID_ROLLER 0x05
58 #define HIDPP_SUB_ID_MOUSE_EXTRA_BTNS 0x06
59 #define HIDPP_SUB_ID_USER_IFACE_EVENT 0x08
62 #define HIDPP_QUIRK_CLASS_WTP BIT(0)
88 #define HIDPP_CAPABILITY_HIDPP10_BATTERY BIT(0)
116 * is 0xFF for the receiver), and all messages (short or long) with a device
212 #define HIDPP_ERROR 0x8f
213 #define HIDPP_ERROR_SUCCESS 0x00
214 #define HIDPP_ERROR_INVALID_SUBID 0x01
215 #define HIDPP_ERROR_INVALID_ADRESS 0x02
216 #define HIDPP_ERROR_INVALID_VALUE 0x03
217 #define HIDPP_ERROR_CONNECT_FAIL 0x04
218 #define HIDPP_ERROR_TOO_MANY_DEVICES 0x05
219 #define HIDPP_ERROR_ALREADY_EXISTS 0x06
220 #define HIDPP_ERROR_BUSY 0x07
221 #define HIDPP_ERROR_UNKNOWN_DEVICE 0x08
222 #define HIDPP_ERROR_RESOURCE_ERROR 0x09
223 #define HIDPP_ERROR_REQUEST_UNAVAILABLE 0x0a
224 #define HIDPP_ERROR_INVALID_PARAM_VALUE 0x0b
225 #define HIDPP_ERROR_WRONG_PIN_CODE 0x0c
227 #define HIDPP20_ERROR_NO_ERROR 0x00
228 #define HIDPP20_ERROR_UNKNOWN 0x01
229 #define HIDPP20_ERROR_INVALID_ARGS 0x02
230 #define HIDPP20_ERROR_OUT_OF_RANGE 0x03
231 #define HIDPP20_ERROR_HW_ERROR 0x04
232 #define HIDPP20_ERROR_NOT_ALLOWED 0x05
233 #define HIDPP20_ERROR_INVALID_FEATURE_INDEX 0x06
234 #define HIDPP20_ERROR_INVALID_FUNCTION_ID 0x07
235 #define HIDPP20_ERROR_BUSY 0x08
236 #define HIDPP20_ERROR_UNSUPPORTED 0x09
237 #define HIDPP20_ERROR 0xff
263 hidpp_report->device_index = 0xff; in __hidpp_send_report()
273 return ret == fields_count ? 0 : -1; in __hidpp_send_report()
282 * - success on 0
306 memset(response, 0, sizeof(struct hidpp_report)); in __do_hidpp_send_message_sync()
313 memset(response, 0, sizeof(struct hidpp_report)); in __do_hidpp_send_message_sync()
332 return 0; in __do_hidpp_send_message_sync()
336 * hidpp_send_message_sync() returns 0 in case of success, and something else
365 * hidpp_send_fap_command_sync() returns 0 in case of success, and something else
404 * hidpp_send_rap_command_sync() returns 0 in case of success, and something else
465 (answer->fap.params[0] == question->fap.funcindex_clientid); in hidpp_match_error()
474 (report->rap.sub_id == 0x41)); in hidpp_report_is_connect_event()
488 strncmp(*name, "Logitech ", PREFIX_LENGTH) == 0) in hidpp_prefix_name()
550 direction = hi_res_value > 0 ? 1 : -1; in hidpp_scroll_counter_handle_scroll()
562 remainder = 0; in hidpp_scroll_counter_handle_scroll()
579 if (low_res_value == 0) in hidpp_scroll_counter_handle_scroll()
580 low_res_value = (hi_res_value > 0 ? 1 : -1); in hidpp_scroll_counter_handle_scroll()
591 #define HIDPP_SET_REGISTER 0x80
592 #define HIDPP_GET_REGISTER 0x81
593 #define HIDPP_SET_LONG_REGISTER 0x82
594 #define HIDPP_GET_LONG_REGISTER 0x83
603 * Return: 0 if successful, otherwise a negative error code.
610 u8 params[3] = { 0 }; in hidpp10_set_register()
616 NULL, 0, &response); in hidpp10_set_register()
632 #define HIDPP_REG_ENABLE_REPORTS 0x00
633 #define HIDPP_ENABLE_CONSUMER_REPORT BIT(0)
641 return hidpp10_set_register(hidpp_dev, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_enable_battery_reporting()
645 #define HIDPP_REG_FEATURES 0x01
652 return hidpp10_set_register(hidpp_dev, HIDPP_REG_FEATURES, 0, in hidpp10_enable_scrolling_acceleration()
656 #define HIDPP_REG_BATTERY_STATUS 0x07
687 case 0x00: in hidpp10_battery_status_map_status()
691 case 0x21: /* (standard) charging */ in hidpp10_battery_status_map_status()
692 case 0x24: /* fast charging */ in hidpp10_battery_status_map_status()
693 case 0x25: /* slow charging */ in hidpp10_battery_status_map_status()
696 case 0x26: /* topping charge */ in hidpp10_battery_status_map_status()
697 case 0x22: /* charge complete */ in hidpp10_battery_status_map_status()
700 case 0x20: /* unknown */ in hidpp10_battery_status_map_status()
704 * 0x01...0x1F = reserved (not charging) in hidpp10_battery_status_map_status()
705 * 0x23 = charging error in hidpp10_battery_status_map_status()
706 * 0x27..0xff = reserved in hidpp10_battery_status_map_status()
725 NULL, 0, &response); in hidpp10_query_battery_status()
730 hidpp10_battery_status_map_level(response.rap.params[0]); in hidpp10_query_battery_status()
737 return 0; in hidpp10_query_battery_status()
740 #define HIDPP_REG_BATTERY_MILEAGE 0x0D
747 case 0x00: in hidpp10_battery_mileage_map_status()
751 case 0x01: /* charging */ in hidpp10_battery_mileage_map_status()
754 case 0x02: /* charge complete */ in hidpp10_battery_mileage_map_status()
758 * 0x03 = charging error in hidpp10_battery_mileage_map_status()
777 NULL, 0, &response); in hidpp10_query_battery_mileage()
781 hidpp->battery.capacity = response.rap.params[0]; in hidpp10_query_battery_mileage()
788 return 0; in hidpp10_query_battery_mileage()
798 return 0; in hidpp10_battery_event()
807 capacity = report->rap.params[0]; in hidpp10_battery_event()
812 return 0; in hidpp10_battery_event()
830 return 0; in hidpp10_battery_event()
833 #define HIDPP_REG_PAIRING_INFORMATION 0xB5
834 #define HIDPP_EXTENDED_PAIRING 0x30
835 #define HIDPP_DEVICE_NAME 0x40
867 /* include the terminating '\0' */ in hidpp_unifying_get_name()
892 return 0; in hidpp_unifying_get_serial()
917 return 0; in hidpp_unifying_init()
921 /* 0x0000: Root */
924 #define HIDPP_PAGE_ROOT 0x0000
925 #define HIDPP_PAGE_ROOT_IDX 0x00
927 #define CMD_ROOT_GET_FEATURE 0x00
928 #define CMD_ROOT_GET_PROTOCOL_VERSION 0x10
935 u8 params[2] = { feature >> 8, feature & 0x00FF }; in hidpp_root_get_feature()
944 if (response.fap.params[0] == 0) in hidpp_root_get_feature()
947 *feature_index = response.fap.params[0]; in hidpp_root_get_feature()
954 const u8 ping_byte = 0x5a; in hidpp_root_get_protocol_version()
955 u8 ping_data[3] = { 0, 0, ping_byte }; in hidpp_root_get_protocol_version()
967 hidpp->protocol_minor = 0; in hidpp_root_get_protocol_version()
975 if (ret > 0) { in hidpp_root_get_protocol_version()
976 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_root_get_protocol_version()
984 hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", in hidpp_root_get_protocol_version()
989 hidpp->protocol_major = response.rap.params[0]; in hidpp_root_get_protocol_version()
1000 return 0; in hidpp_root_get_protocol_version()
1004 /* 0x0003: Device Information */
1007 #define HIDPP_PAGE_DEVICE_INFORMATION 0x0003
1009 #define CMD_GET_DEVICE_INFO 0x00
1024 NULL, 0, &response); in hidpp_get_serial()
1030 return 0; in hidpp_get_serial()
1046 return 0; in hidpp_serial_init()
1050 /* 0x0005: GetDeviceNameType */
1053 #define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005
1055 #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x00
1056 #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x10
1057 #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x20
1066 CMD_GET_DEVICE_NAME_TYPE_GET_COUNT, NULL, 0, &response); in hidpp_devicenametype_get_count()
1068 if (ret > 0) { in hidpp_devicenametype_get_count()
1069 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_count()
1076 *nameLength = response.fap.params[0]; in hidpp_devicenametype_get_count()
1092 if (ret > 0) { in hidpp_devicenametype_get_device_name()
1093 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_device_name()
1117 for (i = 0; i < count; i++) in hidpp_devicenametype_get_device_name()
1128 unsigned index = 0; in hidpp_get_device_name()
1149 if (ret <= 0) { in hidpp_get_device_name()
1156 /* include the terminating '\0' */ in hidpp_get_device_name()
1163 /* 0x1000: Battery level status */
1166 #define HIDPP_PAGE_BATTERY_LEVEL_STATUS 0x1000
1168 #define CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_LEVEL_STATUS 0x00
1169 #define CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_CAPABILITY 0x10
1171 #define EVENT_BATTERY_LEVEL_STATUS_BROADCAST 0x00
1173 #define FLAG_BATTERY_LEVEL_DISABLE_OSD BIT(0)
1198 *capacity = data[0]; in hidpp20_batterylevel_map_status_capacity()
1203 * For all other states the device reports 0 (unknown). in hidpp20_batterylevel_map_status_capacity()
1206 case 0: /* discharging (in use) */ in hidpp20_batterylevel_map_status_capacity()
1248 NULL, 0, &response); in hidpp20_batterylevel_get_battery_capacity()
1252 if (ret > 0) { in hidpp20_batterylevel_get_battery_capacity()
1253 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_capacity()
1264 return 0; in hidpp20_batterylevel_get_battery_capacity()
1277 NULL, 0, &response); in hidpp20_batterylevel_get_battery_info()
1278 if (ret > 0) { in hidpp20_batterylevel_get_battery_info()
1279 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_info()
1286 level_count = params[0]; in hidpp20_batterylevel_get_battery_info()
1294 return 0; in hidpp20_batterylevel_get_battery_info()
1302 if (hidpp->battery.feature_index == 0xff) { in hidpp20_query_battery_info_1000()
1329 return 0; in hidpp20_query_battery_info_1000()
1341 return 0; in hidpp20_battery_event_1000()
1364 return 0; in hidpp20_battery_event_1000()
1368 /* 0x1001: Battery voltage */
1371 #define HIDPP_PAGE_BATTERY_VOLTAGE 0x1001
1373 #define CMD_BATTERY_VOLTAGE_GET_BATTERY_VOLTAGE 0x00
1375 #define EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST 0x00
1385 if (flags & 0x80) in hidpp20_battery_map_status_voltage()
1386 switch (flags & 0x07) { in hidpp20_battery_map_status_voltage()
1387 case 0: in hidpp20_battery_map_status_voltage()
1431 NULL, 0, &response); in hidpp20_battery_get_battery_voltage()
1433 if (ret > 0) { in hidpp20_battery_get_battery_voltage()
1434 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_battery_get_battery_voltage()
1446 return 0; in hidpp20_battery_get_battery_voltage()
1476 for (i = 0; i < ARRAY_SIZE(voltages); i++) { in hidpp20_map_battery_capacity()
1481 return 0; in hidpp20_map_battery_capacity()
1489 if (hidpp->battery.voltage_feature_index == 0xff) { in hidpp20_query_battery_voltage_info()
1511 return 0; in hidpp20_query_battery_voltage_info()
1522 return 0; in hidpp20_battery_voltage_event()
1539 return 0; in hidpp20_battery_voltage_event()
1543 /* 0x1004: Unified battery */
1546 #define HIDPP_PAGE_UNIFIED_BATTERY 0x1004
1548 #define CMD_UNIFIED_BATTERY_GET_CAPABILITIES 0x00
1549 #define CMD_UNIFIED_BATTERY_GET_STATUS 0x10
1551 #define EVENT_UNIFIED_BATTERY_STATUS_EVENT 0x00
1553 #define FLAG_UNIFIED_BATTERY_LEVEL_CRITICAL BIT(0)
1558 #define FLAG_UNIFIED_BATTERY_FLAGS_RECHARGEABLE BIT(0)
1571 return 0; in hidpp20_unifiedbattery_get_capabilities()
1576 NULL, 0, &response); in hidpp20_unifiedbattery_get_capabilities()
1580 if (ret > 0) { in hidpp20_unifiedbattery_get_capabilities()
1581 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_unifiedbattery_get_capabilities()
1597 hidpp->battery.supported_levels_1004 = 0; in hidpp20_unifiedbattery_get_capabilities()
1600 hidpp->battery.supported_levels_1004 = params[0]; in hidpp20_unifiedbattery_get_capabilities()
1603 return 0; in hidpp20_unifiedbattery_get_capabilities()
1613 case 0: /* discharging */ in hidpp20_unifiedbattery_map_status()
1666 NULL, 0, &response); in hidpp20_unifiedbattery_get_status()
1670 if (ret > 0) { in hidpp20_unifiedbattery_get_status()
1671 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_unifiedbattery_get_status()
1678 *state_of_charge = params[0]; in hidpp20_unifiedbattery_get_status()
1682 return 0; in hidpp20_unifiedbattery_get_status()
1691 if (hidpp->battery.feature_index == 0xff) { in hidpp20_query_battery_info_1004()
1718 return 0; in hidpp20_query_battery_info_1004()
1731 return 0; in hidpp20_battery_event_1004()
1733 state_of_charge = params[0]; in hidpp20_battery_event_1004()
1751 return 0; in hidpp20_battery_event_1004()
1765 0, /* placeholder for POWER_SUPPLY_PROP_CAPACITY, */
1766 0, /* placeholder for POWER_SUPPLY_PROP_CAPACITY_LEVEL, */
1767 0, /* placeholder for POWER_SUPPLY_PROP_VOLTAGE_NOW, */
1775 int ret = 0; in hidpp_battery_get_property()
1821 /* 0x1d4b: Wireless device status */
1823 #define HIDPP_PAGE_WIRELESS_DEVICE_STATUS 0x1d4b
1833 /* 0x1f20: ADC measurement */
1836 #define HIDPP_PAGE_ADC_MEASUREMENT 0x1f20
1838 #define CMD_ADC_MEASUREMENT_GET_ADC_MEASUREMENT 0x00
1840 #define EVENT_ADC_MEASUREMENT_STATUS_BROADCAST 0x00
1866 if (voltage == 0) in hidpp20_map_adc_measurement_1f20_capacity()
1867 return 0; in hidpp20_map_adc_measurement_1f20_capacity()
1874 for (i = 0; i < ARRAY_SIZE(voltages); i++) { in hidpp20_map_adc_measurement_1f20_capacity()
1879 return 0; in hidpp20_map_adc_measurement_1f20_capacity()
1890 case 0x01: in hidpp20_map_adc_measurement_1f20()
1893 case 0x03: in hidpp20_map_adc_measurement_1f20()
1896 case 0x07: in hidpp20_map_adc_measurement_1f20()
1899 case 0x0F: in hidpp20_map_adc_measurement_1f20()
1907 dbg_hid("Parsed 1f20 data as flag 0x%02x voltage %dmV\n", in hidpp20_map_adc_measurement_1f20()
1923 *voltage = 0; in hidpp20_get_adc_measurement_1f20()
1926 NULL, 0, &response); in hidpp20_get_adc_measurement_1f20()
1928 if (ret > 0) { in hidpp20_get_adc_measurement_1f20()
1929 hid_dbg(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_get_adc_measurement_1f20()
1940 if (hidpp->battery.adc_measurement_feature_index == 0xff) { in hidpp20_query_adc_measurement_info_1f20()
1959 return 0; in hidpp20_query_adc_measurement_info_1f20()
1970 return 0; in hidpp20_adc_measurement_event_1f20()
1984 return 0; in hidpp20_adc_measurement_event_1f20()
1988 /* 0x2120: Hi-resolution scrolling */
1991 #define HIDPP_PAGE_HI_RESOLUTION_SCROLLING 0x2120
1993 #define CMD_HI_RESOLUTION_SCROLLING_SET_HIGHRES_SCROLLING_MODE 0x10
2009 params[0] = enabled ? BIT(0) : 0; in hidpp_hrs_set_highres_scrolling_mode()
2016 return 0; in hidpp_hrs_set_highres_scrolling_mode()
2020 /* 0x2121: HiRes Wheel */
2023 #define HIDPP_PAGE_HIRES_WHEEL 0x2121
2025 #define CMD_HIRES_WHEEL_GET_WHEEL_CAPABILITY 0x00
2026 #define CMD_HIRES_WHEEL_SET_WHEEL_MODE 0x20
2042 NULL, 0, &response); in hidpp_hrw_get_wheel_capability()
2046 *multiplier = response.fap.params[0]; in hidpp_hrw_get_wheel_capability()
2047 return 0; in hidpp_hrw_get_wheel_capability()
2067 params[0] = (invert ? BIT(2) : 0) | in hidpp_hrw_set_wheel_mode()
2068 (high_resolution ? BIT(1) : 0) | in hidpp_hrw_set_wheel_mode()
2069 (use_hidpp ? BIT(0) : 0); in hidpp_hrw_set_wheel_mode()
2077 /* 0x4301: Solar Keyboard */
2080 #define HIDPP_PAGE_SOLAR_KEYBOARD 0x4301
2082 #define CMD_SOLAR_SET_LIGHT_MEASURE 0x00
2084 #define EVENT_SOLAR_BATTERY_BROADCAST 0x00
2085 #define EVENT_SOLAR_BATTERY_LIGHT_MEASURE 0x10
2086 #define EVENT_SOLAR_CHECK_LIGHT_BUTTON 0x20
2094 if (hidpp->battery.feature_index == 0xff) { in hidpp_solar_request_battery_event()
2106 if (ret > 0) { in hidpp_solar_request_battery_event()
2107 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_solar_request_battery_event()
2116 return 0; in hidpp_solar_request_battery_event()
2133 return 0; in hidpp_solar_battery_event()
2135 capacity = report->fap.params[0]; in hidpp_solar_battery_event()
2166 return 0; in hidpp_solar_battery_event()
2170 /* 0x6010: Touchpad FW items */
2173 #define HIDPP_PAGE_TOUCHPAD_FW_ITEMS 0x6010
2175 #define CMD_TOUCHPAD_FW_ITEMS_SET 0x10
2199 if (ret > 0) { in hidpp_touchpad_fw_items_set()
2200 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_fw_items_set()
2207 items->presence = params[0]; in hidpp_touchpad_fw_items_set()
2212 return 0; in hidpp_touchpad_fw_items_set()
2216 /* 0x6100: TouchPadRawXY */
2219 #define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100
2221 #define CMD_TOUCHPAD_GET_RAW_INFO 0x00
2222 #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x20
2224 #define EVENT_TOUCHPAD_RAW_XY 0x00
2226 #define TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT 0x01
2227 #define TOUCHPAD_RAW_XY_ORIGIN_UPPER_LEFT 0x03
2267 CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response); in hidpp_touchpad_get_raw_info()
2269 if (ret > 0) { in hidpp_touchpad_get_raw_info()
2270 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_get_raw_info()
2277 raw_info->x_size = get_unaligned_be16(&params[0]); in hidpp_touchpad_get_raw_info()
2297 * bit 0 - enable raw in hidpp_touchpad_set_raw_report_state()
2313 u8 x_m = data[0] << 2; in hidpp_touchpad_touch_event()
2319 finger->contact_type = data[0] >> 6; in hidpp_touchpad_touch_event()
2330 memset(raw_xy, 0, sizeof(struct hidpp_touchpad_raw_xy)); in hidpp_touchpad_raw_xy_event()
2331 raw_xy->end_of_frame = data[8] & 0x01; in hidpp_touchpad_raw_xy_event()
2332 raw_xy->spurious_flag = (data[8] >> 1) & 0x01; in hidpp_touchpad_raw_xy_event()
2333 raw_xy->finger_count = data[15] & 0x0f; in hidpp_touchpad_raw_xy_event()
2334 raw_xy->button = (data[8] >> 2) & 0x01; in hidpp_touchpad_raw_xy_event()
2337 hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]); in hidpp_touchpad_raw_xy_event()
2343 /* 0x8123: Force feedback support */
2346 #define HIDPP_FF_GET_INFO 0x01
2347 #define HIDPP_FF_RESET_ALL 0x11
2348 #define HIDPP_FF_DOWNLOAD_EFFECT 0x21
2349 #define HIDPP_FF_SET_EFFECT_STATE 0x31
2350 #define HIDPP_FF_DESTROY_EFFECT 0x41
2351 #define HIDPP_FF_GET_APERTURE 0x51
2352 #define HIDPP_FF_SET_APERTURE 0x61
2353 #define HIDPP_FF_GET_GLOBAL_GAINS 0x71
2354 #define HIDPP_FF_SET_GLOBAL_GAINS 0x81
2356 #define HIDPP_FF_EFFECT_STATE_GET 0x00
2357 #define HIDPP_FF_EFFECT_STATE_STOP 0x01
2358 #define HIDPP_FF_EFFECT_STATE_PLAY 0x02
2359 #define HIDPP_FF_EFFECT_STATE_PAUSE 0x03
2361 #define HIDPP_FF_EFFECT_CONSTANT 0x00
2362 #define HIDPP_FF_EFFECT_PERIODIC_SINE 0x01
2363 #define HIDPP_FF_EFFECT_PERIODIC_SQUARE 0x02
2364 #define HIDPP_FF_EFFECT_PERIODIC_TRIANGLE 0x03
2365 #define HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHUP 0x04
2366 #define HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHDOWN 0x05
2367 #define HIDPP_FF_EFFECT_SPRING 0x06
2368 #define HIDPP_FF_EFFECT_DAMPER 0x07
2369 #define HIDPP_FF_EFFECT_FRICTION 0x08
2370 #define HIDPP_FF_EFFECT_INERTIA 0x09
2371 #define HIDPP_FF_EFFECT_RAMP 0x0A
2373 #define HIDPP_FF_EFFECT_AUTOSTART 0x80
2445 for (i = 0; i < data->num_effects; i++) in hidpp_ff_find_effect()
2449 return 0; in hidpp_ff_find_effect()
2463 wd->params[0] = data->slot_autocenter; in hidpp_ff_work_handler()
2470 wd->params[0] = hidpp_ff_find_effect(data, wd->effect_id); in hidpp_ff_work_handler()
2486 slot = response.fap.params[0]; in hidpp_ff_work_handler()
2487 if (slot > 0 && slot <= data->num_effects) { in hidpp_ff_work_handler()
2488 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2497 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2499 data->effect_ids[wd->params[0]-1] = -1; in hidpp_ff_work_handler()
2502 data->slot_autocenter = 0; in hidpp_ff_work_handler()
2505 data->gain = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2508 data->range = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2540 if (s >= 20 && s % 20 == 0) in hidpp_ff_queue_work()
2543 return 0; in hidpp_ff_queue_work()
2661 params[6] = effect->u.condition[0].left_saturation >> 9; in hidpp_ff_upload_effect()
2662 params[7] = (effect->u.condition[0].left_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2663 params[8] = effect->u.condition[0].left_coeff >> 8; in hidpp_ff_upload_effect()
2664 params[9] = effect->u.condition[0].left_coeff & 255; in hidpp_ff_upload_effect()
2665 params[10] = effect->u.condition[0].deadband >> 9; in hidpp_ff_upload_effect()
2666 params[11] = (effect->u.condition[0].deadband >> 1) & 255; in hidpp_ff_upload_effect()
2667 params[12] = effect->u.condition[0].center >> 8; in hidpp_ff_upload_effect()
2668 params[13] = effect->u.condition[0].center & 255; in hidpp_ff_upload_effect()
2669 params[14] = effect->u.condition[0].right_coeff >> 8; in hidpp_ff_upload_effect()
2670 params[15] = effect->u.condition[0].right_coeff & 255; in hidpp_ff_upload_effect()
2671 params[16] = effect->u.condition[0].right_saturation >> 9; in hidpp_ff_upload_effect()
2672 params[17] = (effect->u.condition[0].right_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2676 effect->u.condition[0].left_coeff, in hidpp_ff_upload_effect()
2677 effect->u.condition[0].left_saturation, in hidpp_ff_upload_effect()
2678 effect->u.condition[0].right_coeff, in hidpp_ff_upload_effect()
2679 effect->u.condition[0].right_saturation); in hidpp_ff_upload_effect()
2681 effect->u.condition[0].deadband, in hidpp_ff_upload_effect()
2682 effect->u.condition[0].center); in hidpp_ff_upload_effect()
2707 u8 slot = 0; in hidpp_ff_erase_effect()
2724 params[2] = params[3] = params[4] = params[5] = 0; in hidpp_ff_set_autocenter()
2731 params[10] = params[11] = params[12] = params[13] = 0; in hidpp_ff_set_autocenter()
2743 params[0] = gain >> 8; in hidpp_ff_set_gain()
2745 params[2] = 0; /* no boost */ in hidpp_ff_set_gain()
2746 params[3] = 0; in hidpp_ff_set_gain()
2772 params[0] = range >> 8; in hidpp_ff_range_store()
2773 params[1] = range & 0x00FF; in hidpp_ff_range_store()
2829 for (j = 0; hidpp_ff_effects[j] >= 0; j++) in hidpp_ff_init()
2832 for (j = 0; hidpp_ff_effects_v2[j] >= 0; j++) in hidpp_ff_init()
2862 for (j = 0; j < num_slots; j++) in hidpp_ff_init()
2881 atomic_set(&data->workqueue_size, 0); in hidpp_ff_init()
2886 return 0; in hidpp_ff_init()
2928 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); in wtp_populate_input()
2930 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); in wtp_populate_input()
2934 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 50, 0, 0); in wtp_populate_input()
2978 for (i = 0; i < 2; i++) in wtp_send_raw_xy_event()
2994 u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) + in wtp_mouse_raw_xy_event()
2996 u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) + in wtp_mouse_raw_xy_event()
3002 .contact_type = 0, in wtp_mouse_raw_xy_event()
3010 .contact_type = 0, in wtp_mouse_raw_xy_event()
3020 .spurious_flag = 0, in wtp_mouse_raw_xy_event()
3021 .end_of_frame = (data[0] >> 7) == 0, in wtp_mouse_raw_xy_event()
3022 .button = data[0] & 0x01, in wtp_mouse_raw_xy_event()
3040 switch (data[0]) { in wtp_raw_event()
3041 case 0x02: in wtp_raw_event()
3049 !!(data[1] & 0x01)); in wtp_raw_event()
3051 !!(data[1] & 0x02)); in wtp_raw_event()
3053 return 0; in wtp_raw_event()
3067 return 0; in wtp_raw_event()
3070 return 0; in wtp_raw_event()
3076 struct hidpp_touchpad_raw_info raw_info = {0}; in wtp_get_config()
3098 return 0; in wtp_get_config()
3113 return 0; in wtp_allocate()
3157 * 10<xx>0a 3500af03 (where <xx> is the mouse id),
3161 * middle button press 11<xx>0a 3500af00...
3162 * side 1 button (forward) press 11<xx>0a 3500b000...
3163 * side 2 button (backward) press 11<xx>0a 3500ae00...
3164 * middle/side1/side2 button release 11<xx>0a 35000000...
3167 static const u8 m560_config_parameter[] = {0x00, 0xaf, 0x03};
3170 #define M560_MOUSE_BTN_LEFT 0x01
3171 #define M560_MOUSE_BTN_RIGHT 0x02
3172 #define M560_MOUSE_BTN_WHEEL_LEFT 0x08
3173 #define M560_MOUSE_BTN_WHEEL_RIGHT 0x10
3175 #define M560_SUB_ID 0x0a
3176 #define M560_BUTTON_MODE_REGISTER 0x35
3208 return 0; in m560_raw_event()
3211 if (data[0] == REPORT_ID_HIDPP_LONG && in m560_raw_event()
3212 data[2] == M560_SUB_ID && data[6] == 0x00) { in m560_raw_event()
3216 * data[0] = 0x11 in m560_raw_event()
3218 * data[2] = 0x0a in m560_raw_event()
3219 * data[5] = 0xaf -> middle in m560_raw_event()
3220 * 0xb0 -> forward in m560_raw_event()
3221 * 0xae -> backward in m560_raw_event()
3222 * 0x00 -> release all in m560_raw_event()
3223 * data[6] = 0x00 in m560_raw_event()
3227 case 0xaf: in m560_raw_event()
3230 case 0xb0: in m560_raw_event()
3233 case 0xae: in m560_raw_event()
3236 case 0x00: in m560_raw_event()
3237 input_report_key(hidpp->input, BTN_BACK, 0); in m560_raw_event()
3238 input_report_key(hidpp->input, BTN_FORWARD, 0); in m560_raw_event()
3239 input_report_key(hidpp->input, BTN_MIDDLE, 0); in m560_raw_event()
3243 return 0; in m560_raw_event()
3247 } else if (data[0] == 0x02) { in m560_raw_event()
3251 * data[0] = type (0x02) in m560_raw_event()
3274 v = sign_extend32(hid_field_extract(hdev, data + 3, 0, 12), 11); in m560_raw_event()
3281 if (v != 0) in m560_raw_event()
3327 * We can toggle this feature from the host by using the feature 0x6010:
3354 return 0; in k400_disable_tap_to_click()
3369 return 0; in k400_allocate()
3377 return 0; in k400_connect()
3386 #define HIDPP_PAGE_G920_FORCE_FEEDBACK 0x8123
3399 dbg_hid("Setting autocenter to 0.\n"); in g920_ff_set_autocenter()
3407 data->slot_autocenter = response.fap.params[0]; in g920_ff_set_autocenter()
3418 memset(data, 0, sizeof(*data)); in g920_get_config()
3429 NULL, 0, in g920_get_config()
3432 if (ret < 0) in g920_get_config()
3435 "%s: received protocol error 0x%02x\n", __func__, ret); in g920_get_config()
3439 data->num_effects = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS; in g920_get_config()
3444 NULL, 0, in g920_get_config()
3451 NULL, 0, in g920_get_config()
3458 900 : get_unaligned_be16(&response.fap.params[0]); in g920_get_config()
3463 NULL, 0, in g920_get_config()
3469 0xffff : get_unaligned_be16(&response.fap.params[0]); in g920_get_config()
3479 #define DINOVO_MINI_PRODUCT_ID 0xb30c
3486 return 0; in lg_dinovo_input_mapping()
3489 case 0x00d: lg_map_key_clear(KEY_MEDIA); break; in lg_dinovo_input_mapping()
3491 return 0; in lg_dinovo_input_mapping()
3501 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_wheel_connect()
3515 return 0; in hidpp10_wheel_raw_event()
3517 if (data[0] != REPORT_ID_HIDPP_SHORT || data[2] != HIDPP_SUB_ID_ROLLER) in hidpp10_wheel_raw_event()
3518 return 0; in hidpp10_wheel_raw_event()
3547 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_extra_mouse_buttons_connect()
3561 return 0; in hidpp10_extra_mouse_buttons_raw_event()
3563 if (data[0] != REPORT_ID_HIDPP_SHORT || in hidpp10_extra_mouse_buttons_raw_event()
3565 return 0; in hidpp10_extra_mouse_buttons_raw_event()
3573 for (i = 0; i < 8; i++) in hidpp10_extra_mouse_buttons_raw_event()
3578 for (i = 0; i < 8; i++) in hidpp10_extra_mouse_buttons_raw_event()
3601 /* HID++1.0 kbds which only report 0x10xx consumer usages through sub-id 0x03 */
3604 /* Find the consumer-page input report desc and change Maximums to 0x107f */
3608 /* Note 0 terminated so we can use strnstr to search for this. */ in hidpp10_consumer_keys_report_fixup()
3610 0x05, 0x0C, /* USAGE_PAGE (Consumer Devices) */ in hidpp10_consumer_keys_report_fixup()
3611 0x09, 0x01, /* USAGE (Consumer Control) */ in hidpp10_consumer_keys_report_fixup()
3612 0xA1, 0x01, /* COLLECTION (Application) */ in hidpp10_consumer_keys_report_fixup()
3613 0x85, 0x03, /* REPORT_ID = 3 */ in hidpp10_consumer_keys_report_fixup()
3614 0x75, 0x10, /* REPORT_SIZE (16) */ in hidpp10_consumer_keys_report_fixup()
3615 0x95, 0x02, /* REPORT_COUNT (2) */ in hidpp10_consumer_keys_report_fixup()
3616 0x15, 0x01, /* LOGICAL_MIN (1) */ in hidpp10_consumer_keys_report_fixup()
3617 0x26, 0x00 /* LOGICAL_MAX (... */ in hidpp10_consumer_keys_report_fixup()
3625 consumer_rdesc[15] = 0x7f; in hidpp10_consumer_keys_report_fixup()
3626 consumer_rdesc[16] = 0x10; in hidpp10_consumer_keys_report_fixup()
3627 consumer_rdesc[20] = 0x7f; in hidpp10_consumer_keys_report_fixup()
3628 consumer_rdesc[21] = 0x10; in hidpp10_consumer_keys_report_fixup()
3635 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_consumer_keys_connect()
3646 return 0; in hidpp10_consumer_keys_raw_event()
3648 if (data[0] != REPORT_ID_HIDPP_SHORT || in hidpp10_consumer_keys_raw_event()
3650 return 0; in hidpp10_consumer_keys_raw_event()
3654 * is necessary to get some keyboards to report their 0x10xx usages. in hidpp10_consumer_keys_raw_event()
3656 consumer_report[0] = 0x03; in hidpp10_consumer_keys_raw_event()
3676 if (ret == 0) in hi_res_scroll_enable()
3691 if (multiplier == 0) { in hi_res_scroll_enable()
3693 "Invalid multiplier 0 from device, setting it to 1\n"); in hi_res_scroll_enable()
3699 return 0; in hi_res_scroll_enable()
3717 return 0; in hidpp_initialize_hires_scroll()
3735 return 0; in hidpp_initialize_hires_scroll()
3765 return 0; in hidpp_input_mapping()
3776 return 0; in hidpp_input_mapping()
3786 return 0; in hidpp_input_mapped()
3797 return 0; in hidpp_input_mapped()
3825 return 0; in hidpp_input_configured()
3829 return 0; in hidpp_input_configured()
3865 if (schedule_work(&hidpp->work) == 0) in hidpp_raw_hidpp_event()
3871 data[0] == REPORT_ID_HIDPP_SHORT && in hidpp_raw_hidpp_event()
3882 if (ret != 0) in hidpp_raw_hidpp_event()
3885 if (ret != 0) in hidpp_raw_hidpp_event()
3888 if (ret != 0) in hidpp_raw_hidpp_event()
3891 if (ret != 0) in hidpp_raw_hidpp_event()
3894 if (ret != 0) in hidpp_raw_hidpp_event()
3900 if (ret != 0) in hidpp_raw_hidpp_event()
3906 if (ret != 0) in hidpp_raw_hidpp_event()
3912 if (ret != 0) in hidpp_raw_hidpp_event()
3918 if (ret != 0) in hidpp_raw_hidpp_event()
3922 return 0; in hidpp_raw_hidpp_event()
3929 int ret = 0; in hidpp_raw_event()
3932 return 0; in hidpp_raw_event()
3935 switch (data[0]) { in hidpp_raw_event()
3964 if (ret != 0) in hidpp_raw_event()
3972 return 0; in hidpp_raw_event()
3985 return 0; in hidpp_event()
3994 || value == 0 || hidpp->input == NULL in hidpp_event()
3995 || counter->wheel_multiplier == 0) in hidpp_event()
3996 return 0; in hidpp_event()
4004 static atomic_t battery_no = ATOMIC_INIT(0); in hidpp_initialize_battery()
4014 return 0; in hidpp_initialize_battery()
4016 hidpp->battery.feature_index = 0xff; in hidpp_initialize_battery()
4017 hidpp->battery.solar_feature_index = 0xff; in hidpp_initialize_battery()
4018 hidpp->battery.voltage_feature_index = 0xff; in hidpp_initialize_battery()
4019 hidpp->battery.adc_measurement_feature_index = 0xff; in hidpp_initialize_battery()
4087 desc->use_for_apm = 0; in hidpp_initialize_battery()
4296 return 0; in hidpp_get_report_length()
4298 return report->field[0]->report_count + 1; in hidpp_get_report_length()
4305 u8 supported_reports = 0; in hidpp_validate_device()
4417 * First call hid_hw_start(hdev, 0) to allow IO without connecting any in hidpp_probe()
4422 ret = hid_hw_start(hdev, 0); in hidpp_probe()
4429 if (ret < 0) { in hidpp_probe()
4515 LDJ_DEVICE(0x4011),
4519 LDJ_DEVICE(0x4101),
4526 LDJ_DEVICE(0x1017), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4528 LDJ_DEVICE(0x402d),
4531 LDJ_DEVICE(0x101b), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4533 LDJ_DEVICE(0x101a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4535 LDJ_DEVICE(0x4024),
4538 LDJ_DEVICE(0x4002),
4541 LDJ_DEVICE(0xb305),
4544 LDJ_DEVICE(0xb309),
4547 LDJ_DEVICE(0xb30b),
4553 L27MHZ_DEVICE(0x0049),
4556 L27MHZ_DEVICE(0x0057),
4559 L27MHZ_DEVICE(0x005c),
4562 L27MHZ_DEVICE(0x00fe),
4568 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082) },
4570 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08D) },
4572 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) },
4574 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
4576 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
4578 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC086) },
4580 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) },
4582 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08A) },
4584 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
4586 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC091) },
4588 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC343) },
4596 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC094) },
4598 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC09b) },
4601 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0x0a87),
4605 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305),
4608 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb309),
4611 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b),
4614 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb35f) },
4616 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
4618 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
4620 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
4622 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb019) },
4624 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
4625 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
4627 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb020) },
4629 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb02a) },
4631 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023) },
4633 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb025) },
4635 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb034) },
4637 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb038) },