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()
955 const u8 ping_byte = 0x5a; in hidpp_root_get_protocol_version()
956 u8 ping_data[3] = { 0, 0, ping_byte }; in hidpp_root_get_protocol_version()
968 hidpp->protocol_minor = 0; in hidpp_root_get_protocol_version()
976 if (ret > 0) { in hidpp_root_get_protocol_version()
977 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_root_get_protocol_version()
985 hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", in hidpp_root_get_protocol_version()
990 hidpp->protocol_major = response.rap.params[0]; in hidpp_root_get_protocol_version()
1001 return 0; in hidpp_root_get_protocol_version()
1005 /* 0x0003: Device Information */
1008 #define HIDPP_PAGE_DEVICE_INFORMATION 0x0003
1010 #define CMD_GET_DEVICE_INFO 0x00
1027 NULL, 0, &response); in hidpp_get_serial()
1033 return 0; in hidpp_get_serial()
1049 return 0; in hidpp_serial_init()
1053 /* 0x0005: GetDeviceNameType */
1056 #define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005
1058 #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x00
1059 #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x10
1060 #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x20
1069 CMD_GET_DEVICE_NAME_TYPE_GET_COUNT, NULL, 0, &response); in hidpp_devicenametype_get_count()
1071 if (ret > 0) { in hidpp_devicenametype_get_count()
1072 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_count()
1079 *nameLength = response.fap.params[0]; in hidpp_devicenametype_get_count()
1095 if (ret > 0) { in hidpp_devicenametype_get_device_name()
1096 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_devicenametype_get_device_name()
1120 for (i = 0; i < count; i++) in hidpp_devicenametype_get_device_name()
1132 unsigned index = 0; in hidpp_get_device_name()
1153 if (ret <= 0) { in hidpp_get_device_name()
1160 /* include the terminating '\0' */ in hidpp_get_device_name()
1167 /* 0x1000: Battery level status */
1170 #define HIDPP_PAGE_BATTERY_LEVEL_STATUS 0x1000
1172 #define CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_LEVEL_STATUS 0x00
1173 #define CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_CAPABILITY 0x10
1175 #define EVENT_BATTERY_LEVEL_STATUS_BROADCAST 0x00
1177 #define FLAG_BATTERY_LEVEL_DISABLE_OSD BIT(0)
1202 *capacity = data[0]; in hidpp20_batterylevel_map_status_capacity()
1207 * For all other states the device reports 0 (unknown). in hidpp20_batterylevel_map_status_capacity()
1210 case 0: /* discharging (in use) */ in hidpp20_batterylevel_map_status_capacity()
1252 NULL, 0, &response); in hidpp20_batterylevel_get_battery_capacity()
1256 if (ret > 0) { in hidpp20_batterylevel_get_battery_capacity()
1257 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_capacity()
1268 return 0; in hidpp20_batterylevel_get_battery_capacity()
1281 NULL, 0, &response); in hidpp20_batterylevel_get_battery_info()
1282 if (ret > 0) { in hidpp20_batterylevel_get_battery_info()
1283 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_batterylevel_get_battery_info()
1290 level_count = params[0]; in hidpp20_batterylevel_get_battery_info()
1298 return 0; in hidpp20_batterylevel_get_battery_info()
1307 if (hidpp->battery.feature_index == 0xff) { in hidpp20_query_battery_info_1000()
1335 return 0; in hidpp20_query_battery_info_1000()
1347 return 0; in hidpp20_battery_event_1000()
1370 return 0; in hidpp20_battery_event_1000()
1374 /* 0x1001: Battery voltage */
1377 #define HIDPP_PAGE_BATTERY_VOLTAGE 0x1001
1379 #define CMD_BATTERY_VOLTAGE_GET_BATTERY_VOLTAGE 0x00
1381 #define EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST 0x00
1391 if (flags & 0x80) in hidpp20_battery_map_status_voltage()
1392 switch (flags & 0x07) { in hidpp20_battery_map_status_voltage()
1393 case 0: in hidpp20_battery_map_status_voltage()
1437 NULL, 0, &response); in hidpp20_battery_get_battery_voltage()
1439 if (ret > 0) { in hidpp20_battery_get_battery_voltage()
1440 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_battery_get_battery_voltage()
1452 return 0; in hidpp20_battery_get_battery_voltage()
1482 for (i = 0; i < ARRAY_SIZE(voltages); i++) { in hidpp20_map_battery_capacity()
1487 return 0; in hidpp20_map_battery_capacity()
1496 if (hidpp->battery.voltage_feature_index == 0xff) { in hidpp20_query_battery_voltage_info()
1519 return 0; in hidpp20_query_battery_voltage_info()
1530 return 0; in hidpp20_battery_voltage_event()
1547 return 0; in hidpp20_battery_voltage_event()
1551 /* 0x1004: Unified battery */
1554 #define HIDPP_PAGE_UNIFIED_BATTERY 0x1004
1556 #define CMD_UNIFIED_BATTERY_GET_CAPABILITIES 0x00
1557 #define CMD_UNIFIED_BATTERY_GET_STATUS 0x10
1559 #define EVENT_UNIFIED_BATTERY_STATUS_EVENT 0x00
1561 #define FLAG_UNIFIED_BATTERY_LEVEL_CRITICAL BIT(0)
1566 #define FLAG_UNIFIED_BATTERY_FLAGS_RECHARGEABLE BIT(0)
1579 return 0; in hidpp20_unifiedbattery_get_capabilities()
1584 NULL, 0, &response); in hidpp20_unifiedbattery_get_capabilities()
1588 if (ret > 0) { in hidpp20_unifiedbattery_get_capabilities()
1589 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_unifiedbattery_get_capabilities()
1605 hidpp->battery.supported_levels_1004 = 0; in hidpp20_unifiedbattery_get_capabilities()
1608 hidpp->battery.supported_levels_1004 = params[0]; in hidpp20_unifiedbattery_get_capabilities()
1611 return 0; in hidpp20_unifiedbattery_get_capabilities()
1621 case 0: /* discharging */ in hidpp20_unifiedbattery_map_status()
1674 NULL, 0, &response); in hidpp20_unifiedbattery_get_status()
1678 if (ret > 0) { in hidpp20_unifiedbattery_get_status()
1679 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_unifiedbattery_get_status()
1686 *state_of_charge = params[0]; in hidpp20_unifiedbattery_get_status()
1690 return 0; in hidpp20_unifiedbattery_get_status()
1700 if (hidpp->battery.feature_index == 0xff) { in hidpp20_query_battery_info_1004()
1728 return 0; in hidpp20_query_battery_info_1004()
1741 return 0; in hidpp20_battery_event_1004()
1743 state_of_charge = params[0]; in hidpp20_battery_event_1004()
1761 return 0; in hidpp20_battery_event_1004()
1775 0, /* placeholder for POWER_SUPPLY_PROP_CAPACITY, */
1776 0, /* placeholder for POWER_SUPPLY_PROP_CAPACITY_LEVEL, */
1777 0, /* placeholder for POWER_SUPPLY_PROP_VOLTAGE_NOW, */
1785 int ret = 0; in hidpp_battery_get_property()
1831 /* 0x1d4b: Wireless device status */
1833 #define HIDPP_PAGE_WIRELESS_DEVICE_STATUS 0x1d4b
1848 /* 0x1f20: ADC measurement */
1851 #define HIDPP_PAGE_ADC_MEASUREMENT 0x1f20
1853 #define CMD_ADC_MEASUREMENT_GET_ADC_MEASUREMENT 0x00
1855 #define EVENT_ADC_MEASUREMENT_STATUS_BROADCAST 0x00
1881 if (voltage == 0) in hidpp20_map_adc_measurement_1f20_capacity()
1882 return 0; in hidpp20_map_adc_measurement_1f20_capacity()
1889 for (i = 0; i < ARRAY_SIZE(voltages); i++) { in hidpp20_map_adc_measurement_1f20_capacity()
1894 return 0; in hidpp20_map_adc_measurement_1f20_capacity()
1905 case 0x01: in hidpp20_map_adc_measurement_1f20()
1908 case 0x03: in hidpp20_map_adc_measurement_1f20()
1911 case 0x07: in hidpp20_map_adc_measurement_1f20()
1914 case 0x0F: in hidpp20_map_adc_measurement_1f20()
1922 dbg_hid("Parsed 1f20 data as flag 0x%02x voltage %dmV\n", in hidpp20_map_adc_measurement_1f20()
1938 *voltage = 0; in hidpp20_get_adc_measurement_1f20()
1941 NULL, 0, &response); in hidpp20_get_adc_measurement_1f20()
1943 if (ret > 0) { in hidpp20_get_adc_measurement_1f20()
1944 hid_dbg(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp20_get_adc_measurement_1f20()
1957 if (hidpp->battery.adc_measurement_feature_index == 0xff) { in hidpp20_query_adc_measurement_info_1f20()
1977 return 0; in hidpp20_query_adc_measurement_info_1f20()
1988 return 0; in hidpp20_adc_measurement_event_1f20()
2002 return 0; in hidpp20_adc_measurement_event_1f20()
2006 /* 0x2120: Hi-resolution scrolling */
2009 #define HIDPP_PAGE_HI_RESOLUTION_SCROLLING 0x2120
2011 #define CMD_HI_RESOLUTION_SCROLLING_SET_HIGHRES_SCROLLING_MODE 0x10
2029 params[0] = enabled ? BIT(0) : 0; in hidpp_hrs_set_highres_scrolling_mode()
2036 return 0; in hidpp_hrs_set_highres_scrolling_mode()
2040 /* 0x2121: HiRes Wheel */
2043 #define HIDPP_PAGE_HIRES_WHEEL 0x2121
2045 #define CMD_HIRES_WHEEL_GET_WHEEL_CAPABILITY 0x00
2046 #define CMD_HIRES_WHEEL_SET_WHEEL_MODE 0x20
2063 NULL, 0, &response); in hidpp_hrw_get_wheel_capability()
2067 *multiplier = response.fap.params[0]; in hidpp_hrw_get_wheel_capability()
2068 return 0; in hidpp_hrw_get_wheel_capability()
2089 params[0] = (invert ? BIT(2) : 0) | in hidpp_hrw_set_wheel_mode()
2090 (high_resolution ? BIT(1) : 0) | in hidpp_hrw_set_wheel_mode()
2091 (use_hidpp ? BIT(0) : 0); in hidpp_hrw_set_wheel_mode()
2099 /* 0x4301: Solar Keyboard */
2102 #define HIDPP_PAGE_SOLAR_KEYBOARD 0x4301
2104 #define CMD_SOLAR_SET_LIGHT_MEASURE 0x00
2106 #define EVENT_SOLAR_BATTERY_BROADCAST 0x00
2107 #define EVENT_SOLAR_BATTERY_LIGHT_MEASURE 0x10
2108 #define EVENT_SOLAR_CHECK_LIGHT_BUTTON 0x20
2117 if (hidpp->battery.feature_index == 0xff) { in hidpp_solar_request_battery_event()
2130 if (ret > 0) { in hidpp_solar_request_battery_event()
2131 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_solar_request_battery_event()
2140 return 0; in hidpp_solar_request_battery_event()
2157 return 0; in hidpp_solar_battery_event()
2159 capacity = report->fap.params[0]; in hidpp_solar_battery_event()
2190 return 0; in hidpp_solar_battery_event()
2194 /* 0x6010: Touchpad FW items */
2197 #define HIDPP_PAGE_TOUCHPAD_FW_ITEMS 0x6010
2199 #define CMD_TOUCHPAD_FW_ITEMS_SET 0x10
2223 if (ret > 0) { in hidpp_touchpad_fw_items_set()
2224 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_fw_items_set()
2231 items->presence = params[0]; in hidpp_touchpad_fw_items_set()
2236 return 0; in hidpp_touchpad_fw_items_set()
2240 /* 0x6100: TouchPadRawXY */
2243 #define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100
2245 #define CMD_TOUCHPAD_GET_RAW_INFO 0x00
2246 #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x20
2248 #define EVENT_TOUCHPAD_RAW_XY 0x00
2250 #define TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT 0x01
2251 #define TOUCHPAD_RAW_XY_ORIGIN_UPPER_LEFT 0x03
2291 CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response); in hidpp_touchpad_get_raw_info()
2293 if (ret > 0) { in hidpp_touchpad_get_raw_info()
2294 hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", in hidpp_touchpad_get_raw_info()
2301 raw_info->x_size = get_unaligned_be16(&params[0]); in hidpp_touchpad_get_raw_info()
2321 * bit 0 - enable raw in hidpp_touchpad_set_raw_report_state()
2337 u8 x_m = data[0] << 2; in hidpp_touchpad_touch_event()
2343 finger->contact_type = data[0] >> 6; in hidpp_touchpad_touch_event()
2354 memset(raw_xy, 0, sizeof(struct hidpp_touchpad_raw_xy)); in hidpp_touchpad_raw_xy_event()
2355 raw_xy->end_of_frame = data[8] & 0x01; in hidpp_touchpad_raw_xy_event()
2356 raw_xy->spurious_flag = (data[8] >> 1) & 0x01; in hidpp_touchpad_raw_xy_event()
2357 raw_xy->finger_count = data[15] & 0x0f; in hidpp_touchpad_raw_xy_event()
2358 raw_xy->button = (data[8] >> 2) & 0x01; in hidpp_touchpad_raw_xy_event()
2361 hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]); in hidpp_touchpad_raw_xy_event()
2367 /* 0x8123: Force feedback support */
2370 #define HIDPP_FF_GET_INFO 0x01
2371 #define HIDPP_FF_RESET_ALL 0x11
2372 #define HIDPP_FF_DOWNLOAD_EFFECT 0x21
2373 #define HIDPP_FF_SET_EFFECT_STATE 0x31
2374 #define HIDPP_FF_DESTROY_EFFECT 0x41
2375 #define HIDPP_FF_GET_APERTURE 0x51
2376 #define HIDPP_FF_SET_APERTURE 0x61
2377 #define HIDPP_FF_GET_GLOBAL_GAINS 0x71
2378 #define HIDPP_FF_SET_GLOBAL_GAINS 0x81
2380 #define HIDPP_FF_EFFECT_STATE_GET 0x00
2381 #define HIDPP_FF_EFFECT_STATE_STOP 0x01
2382 #define HIDPP_FF_EFFECT_STATE_PLAY 0x02
2383 #define HIDPP_FF_EFFECT_STATE_PAUSE 0x03
2385 #define HIDPP_FF_EFFECT_CONSTANT 0x00
2386 #define HIDPP_FF_EFFECT_PERIODIC_SINE 0x01
2387 #define HIDPP_FF_EFFECT_PERIODIC_SQUARE 0x02
2388 #define HIDPP_FF_EFFECT_PERIODIC_TRIANGLE 0x03
2389 #define HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHUP 0x04
2390 #define HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHDOWN 0x05
2391 #define HIDPP_FF_EFFECT_SPRING 0x06
2392 #define HIDPP_FF_EFFECT_DAMPER 0x07
2393 #define HIDPP_FF_EFFECT_FRICTION 0x08
2394 #define HIDPP_FF_EFFECT_INERTIA 0x09
2395 #define HIDPP_FF_EFFECT_RAMP 0x0A
2397 #define HIDPP_FF_EFFECT_AUTOSTART 0x80
2469 for (i = 0; i < data->num_effects; i++) in hidpp_ff_find_effect()
2473 return 0; in hidpp_ff_find_effect()
2487 wd->params[0] = data->slot_autocenter; in hidpp_ff_work_handler()
2494 wd->params[0] = hidpp_ff_find_effect(data, wd->effect_id); in hidpp_ff_work_handler()
2510 slot = response.fap.params[0]; in hidpp_ff_work_handler()
2511 if (slot > 0 && slot <= data->num_effects) { in hidpp_ff_work_handler()
2512 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2521 if (wd->effect_id >= 0) in hidpp_ff_work_handler()
2523 data->effect_ids[wd->params[0]-1] = -1; in hidpp_ff_work_handler()
2526 data->slot_autocenter = 0; in hidpp_ff_work_handler()
2529 data->gain = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2532 data->range = (wd->params[0] << 8) + wd->params[1]; in hidpp_ff_work_handler()
2564 if (s >= 20 && s % 20 == 0) in hidpp_ff_queue_work()
2567 return 0; in hidpp_ff_queue_work()
2685 params[6] = effect->u.condition[0].left_saturation >> 9; in hidpp_ff_upload_effect()
2686 params[7] = (effect->u.condition[0].left_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2687 params[8] = effect->u.condition[0].left_coeff >> 8; in hidpp_ff_upload_effect()
2688 params[9] = effect->u.condition[0].left_coeff & 255; in hidpp_ff_upload_effect()
2689 params[10] = effect->u.condition[0].deadband >> 9; in hidpp_ff_upload_effect()
2690 params[11] = (effect->u.condition[0].deadband >> 1) & 255; in hidpp_ff_upload_effect()
2691 params[12] = effect->u.condition[0].center >> 8; in hidpp_ff_upload_effect()
2692 params[13] = effect->u.condition[0].center & 255; in hidpp_ff_upload_effect()
2693 params[14] = effect->u.condition[0].right_coeff >> 8; in hidpp_ff_upload_effect()
2694 params[15] = effect->u.condition[0].right_coeff & 255; in hidpp_ff_upload_effect()
2695 params[16] = effect->u.condition[0].right_saturation >> 9; in hidpp_ff_upload_effect()
2696 params[17] = (effect->u.condition[0].right_saturation >> 1) & 255; in hidpp_ff_upload_effect()
2700 effect->u.condition[0].left_coeff, in hidpp_ff_upload_effect()
2701 effect->u.condition[0].left_saturation, in hidpp_ff_upload_effect()
2702 effect->u.condition[0].right_coeff, in hidpp_ff_upload_effect()
2703 effect->u.condition[0].right_saturation); in hidpp_ff_upload_effect()
2705 effect->u.condition[0].deadband, in hidpp_ff_upload_effect()
2706 effect->u.condition[0].center); in hidpp_ff_upload_effect()
2731 u8 slot = 0; in hidpp_ff_erase_effect()
2748 params[2] = params[3] = params[4] = params[5] = 0; in hidpp_ff_set_autocenter()
2755 params[10] = params[11] = params[12] = params[13] = 0; in hidpp_ff_set_autocenter()
2767 params[0] = gain >> 8; in hidpp_ff_set_gain()
2769 params[2] = 0; /* no boost */ in hidpp_ff_set_gain()
2770 params[3] = 0; in hidpp_ff_set_gain()
2796 params[0] = range >> 8; in hidpp_ff_range_store()
2797 params[1] = range & 0x00FF; in hidpp_ff_range_store()
2853 for (j = 0; hidpp_ff_effects[j] >= 0; j++) in hidpp_ff_init()
2856 for (j = 0; hidpp_ff_effects_v2[j] >= 0; j++) in hidpp_ff_init()
2886 for (j = 0; j < num_slots; j++) in hidpp_ff_init()
2905 atomic_set(&data->workqueue_size, 0); in hidpp_ff_init()
2910 return 0; in hidpp_ff_init()
2952 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); in wtp_populate_input()
2954 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); in wtp_populate_input()
2958 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 50, 0, 0); in wtp_populate_input()
3002 for (i = 0; i < 2; i++) in wtp_send_raw_xy_event()
3018 u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) + in wtp_mouse_raw_xy_event()
3020 u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) + in wtp_mouse_raw_xy_event()
3026 .contact_type = 0, in wtp_mouse_raw_xy_event()
3034 .contact_type = 0, in wtp_mouse_raw_xy_event()
3044 .spurious_flag = 0, in wtp_mouse_raw_xy_event()
3045 .end_of_frame = (data[0] >> 7) == 0, in wtp_mouse_raw_xy_event()
3046 .button = data[0] & 0x01, in wtp_mouse_raw_xy_event()
3064 switch (data[0]) { in wtp_raw_event()
3065 case 0x02: in wtp_raw_event()
3073 !!(data[1] & 0x01)); in wtp_raw_event()
3075 !!(data[1] & 0x02)); in wtp_raw_event()
3077 return 0; in wtp_raw_event()
3091 return 0; in wtp_raw_event()
3094 return 0; in wtp_raw_event()
3100 struct hidpp_touchpad_raw_info raw_info = {0}; in wtp_get_config()
3123 return 0; in wtp_get_config()
3138 return 0; in wtp_allocate()
3182 * 10<xx>0a 3500af03 (where <xx> is the mouse id),
3186 * middle button press 11<xx>0a 3500af00...
3187 * side 1 button (forward) press 11<xx>0a 3500b000...
3188 * side 2 button (backward) press 11<xx>0a 3500ae00...
3189 * middle/side1/side2 button release 11<xx>0a 35000000...
3192 static const u8 m560_config_parameter[] = {0x00, 0xaf, 0x03};
3195 #define M560_MOUSE_BTN_LEFT 0x01
3196 #define M560_MOUSE_BTN_RIGHT 0x02
3197 #define M560_MOUSE_BTN_WHEEL_LEFT 0x08
3198 #define M560_MOUSE_BTN_WHEEL_RIGHT 0x10
3200 #define M560_SUB_ID 0x0a
3201 #define M560_BUTTON_MODE_REGISTER 0x35
3233 return 0; in m560_raw_event()
3236 if (data[0] == REPORT_ID_HIDPP_LONG && in m560_raw_event()
3237 data[2] == M560_SUB_ID && data[6] == 0x00) { in m560_raw_event()
3241 * data[0] = 0x11 in m560_raw_event()
3243 * data[2] = 0x0a in m560_raw_event()
3244 * data[5] = 0xaf -> middle in m560_raw_event()
3245 * 0xb0 -> forward in m560_raw_event()
3246 * 0xae -> backward in m560_raw_event()
3247 * 0x00 -> release all in m560_raw_event()
3248 * data[6] = 0x00 in m560_raw_event()
3252 case 0xaf: in m560_raw_event()
3255 case 0xb0: in m560_raw_event()
3258 case 0xae: in m560_raw_event()
3261 case 0x00: in m560_raw_event()
3262 input_report_key(hidpp->input, BTN_BACK, 0); in m560_raw_event()
3263 input_report_key(hidpp->input, BTN_FORWARD, 0); in m560_raw_event()
3264 input_report_key(hidpp->input, BTN_MIDDLE, 0); in m560_raw_event()
3268 return 0; in m560_raw_event()
3272 } else if (data[0] == 0x02) { in m560_raw_event()
3276 * data[0] = type (0x02) in m560_raw_event()
3299 v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12); in m560_raw_event()
3306 if (v != 0) in m560_raw_event()
3352 * We can toggle this feature from the host by using the feature 0x6010:
3380 return 0; in k400_disable_tap_to_click()
3395 return 0; in k400_allocate()
3403 return 0; in k400_connect()
3412 #define HIDPP_PAGE_G920_FORCE_FEEDBACK 0x8123
3425 dbg_hid("Setting autocenter to 0.\n"); in g920_ff_set_autocenter()
3433 data->slot_autocenter = response.fap.params[0]; in g920_ff_set_autocenter()
3445 memset(data, 0, sizeof(*data)); in g920_get_config()
3456 NULL, 0, in g920_get_config()
3459 if (ret < 0) in g920_get_config()
3462 "%s: received protocol error 0x%02x\n", __func__, ret); in g920_get_config()
3466 data->num_effects = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS; in g920_get_config()
3471 NULL, 0, in g920_get_config()
3478 NULL, 0, in g920_get_config()
3485 900 : get_unaligned_be16(&response.fap.params[0]); in g920_get_config()
3490 NULL, 0, in g920_get_config()
3496 0xffff : get_unaligned_be16(&response.fap.params[0]); in g920_get_config()
3506 #define DINOVO_MINI_PRODUCT_ID 0xb30c
3513 return 0; in lg_dinovo_input_mapping()
3516 case 0x00d: lg_map_key_clear(KEY_MEDIA); break; in lg_dinovo_input_mapping()
3518 return 0; in lg_dinovo_input_mapping()
3528 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_wheel_connect()
3542 return 0; in hidpp10_wheel_raw_event()
3544 if (data[0] != REPORT_ID_HIDPP_SHORT || data[2] != HIDPP_SUB_ID_ROLLER) in hidpp10_wheel_raw_event()
3545 return 0; in hidpp10_wheel_raw_event()
3574 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_extra_mouse_buttons_connect()
3588 return 0; in hidpp10_extra_mouse_buttons_raw_event()
3590 if (data[0] != REPORT_ID_HIDPP_SHORT || in hidpp10_extra_mouse_buttons_raw_event()
3592 return 0; in hidpp10_extra_mouse_buttons_raw_event()
3600 for (i = 0; i < 8; i++) in hidpp10_extra_mouse_buttons_raw_event()
3605 for (i = 0; i < 8; i++) in hidpp10_extra_mouse_buttons_raw_event()
3628 /* HID++1.0 kbds which only report 0x10xx consumer usages through sub-id 0x03 */
3631 /* Find the consumer-page input report desc and change Maximums to 0x107f */
3635 /* Note 0 terminated so we can use strnstr to search for this. */ in hidpp10_consumer_keys_report_fixup()
3637 0x05, 0x0C, /* USAGE_PAGE (Consumer Devices) */ in hidpp10_consumer_keys_report_fixup()
3638 0x09, 0x01, /* USAGE (Consumer Control) */ in hidpp10_consumer_keys_report_fixup()
3639 0xA1, 0x01, /* COLLECTION (Application) */ in hidpp10_consumer_keys_report_fixup()
3640 0x85, 0x03, /* REPORT_ID = 3 */ in hidpp10_consumer_keys_report_fixup()
3641 0x75, 0x10, /* REPORT_SIZE (16) */ in hidpp10_consumer_keys_report_fixup()
3642 0x95, 0x02, /* REPORT_COUNT (2) */ in hidpp10_consumer_keys_report_fixup()
3643 0x15, 0x01, /* LOGICAL_MIN (1) */ in hidpp10_consumer_keys_report_fixup()
3644 0x26, 0x00 /* LOGICAL_MAX (... */ in hidpp10_consumer_keys_report_fixup()
3652 consumer_rdesc[15] = 0x7f; in hidpp10_consumer_keys_report_fixup()
3653 consumer_rdesc[16] = 0x10; in hidpp10_consumer_keys_report_fixup()
3654 consumer_rdesc[20] = 0x7f; in hidpp10_consumer_keys_report_fixup()
3655 consumer_rdesc[21] = 0x10; in hidpp10_consumer_keys_report_fixup()
3662 return hidpp10_set_register(hidpp, HIDPP_REG_ENABLE_REPORTS, 0, in hidpp10_consumer_keys_connect()
3673 return 0; in hidpp10_consumer_keys_raw_event()
3675 if (data[0] != REPORT_ID_HIDPP_SHORT || in hidpp10_consumer_keys_raw_event()
3677 return 0; in hidpp10_consumer_keys_raw_event()
3681 * is necessary to get some keyboards to report their 0x10xx usages. in hidpp10_consumer_keys_raw_event()
3683 consumer_report[0] = 0x03; in hidpp10_consumer_keys_raw_event()
3703 if (ret == 0) in hi_res_scroll_enable()
3718 if (multiplier == 0) { in hi_res_scroll_enable()
3720 "Invalid multiplier 0 from device, setting it to 1\n"); in hi_res_scroll_enable()
3726 return 0; in hi_res_scroll_enable()
3745 return 0; in hidpp_initialize_hires_scroll()
3763 return 0; in hidpp_initialize_hires_scroll()
3793 return 0; in hidpp_input_mapping()
3804 return 0; in hidpp_input_mapping()
3814 return 0; in hidpp_input_mapped()
3825 return 0; in hidpp_input_mapped()
3853 return 0; in hidpp_input_configured()
3857 return 0; in hidpp_input_configured()
3893 if (schedule_work(&hidpp->work) == 0) in hidpp_raw_hidpp_event()
3899 data[0] == REPORT_ID_HIDPP_SHORT && in hidpp_raw_hidpp_event()
3910 if (ret != 0) in hidpp_raw_hidpp_event()
3913 if (ret != 0) in hidpp_raw_hidpp_event()
3916 if (ret != 0) in hidpp_raw_hidpp_event()
3919 if (ret != 0) in hidpp_raw_hidpp_event()
3922 if (ret != 0) in hidpp_raw_hidpp_event()
3928 if (ret != 0) in hidpp_raw_hidpp_event()
3934 if (ret != 0) in hidpp_raw_hidpp_event()
3940 if (ret != 0) in hidpp_raw_hidpp_event()
3946 if (ret != 0) in hidpp_raw_hidpp_event()
3950 return 0; in hidpp_raw_hidpp_event()
3957 int ret = 0; in hidpp_raw_event()
3960 return 0; in hidpp_raw_event()
3963 switch (data[0]) { in hidpp_raw_event()
3992 if (ret != 0) in hidpp_raw_event()
4000 return 0; in hidpp_raw_event()
4013 return 0; in hidpp_event()
4022 || value == 0 || hidpp->input == NULL in hidpp_event()
4023 || counter->wheel_multiplier == 0) in hidpp_event()
4024 return 0; in hidpp_event()
4032 static atomic_t battery_no = ATOMIC_INIT(0); in hidpp_initialize_battery()
4042 return 0; in hidpp_initialize_battery()
4044 hidpp->battery.feature_index = 0xff; in hidpp_initialize_battery()
4045 hidpp->battery.solar_feature_index = 0xff; in hidpp_initialize_battery()
4046 hidpp->battery.voltage_feature_index = 0xff; in hidpp_initialize_battery()
4047 hidpp->battery.adc_measurement_feature_index = 0xff; in hidpp_initialize_battery()
4115 desc->use_for_apm = 0; in hidpp_initialize_battery()
4324 return 0; in hidpp_get_report_length()
4326 return report->field[0]->report_count + 1; in hidpp_get_report_length()
4333 u8 supported_reports = 0; in hidpp_validate_device()
4445 * First call hid_hw_start(hdev, 0) to allow IO without connecting any in hidpp_probe()
4450 ret = hid_hw_start(hdev, 0); in hidpp_probe()
4457 if (ret < 0) { in hidpp_probe()
4543 LDJ_DEVICE(0x4011),
4547 LDJ_DEVICE(0x4101),
4554 LDJ_DEVICE(0x1017), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4556 LDJ_DEVICE(0x402d),
4559 LDJ_DEVICE(0x101b), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4561 LDJ_DEVICE(0x101a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_1P0 },
4563 LDJ_DEVICE(0x4024),
4566 LDJ_DEVICE(0x4002),
4569 LDJ_DEVICE(0xb305),
4572 LDJ_DEVICE(0xb309),
4575 LDJ_DEVICE(0xb30b),
4581 L27MHZ_DEVICE(0x0049),
4584 L27MHZ_DEVICE(0x0057),
4587 L27MHZ_DEVICE(0x005c),
4590 L27MHZ_DEVICE(0x00fe),
4596 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082) },
4598 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08D) },
4600 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) },
4602 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
4604 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
4606 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC086) },
4608 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) },
4610 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08A) },
4612 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC090) },
4614 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC091) },
4616 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC343) },
4624 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC094) },
4626 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC09b) },
4629 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0x0a87),
4633 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305),
4636 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb309),
4639 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b),
4642 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb35f) },
4644 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
4646 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
4648 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
4650 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb019) },
4652 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
4653 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
4655 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb020) },
4657 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb02a) },
4659 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023) },
4661 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb025) },
4663 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb034) },
4665 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb038) },