Lines Matching defs:data
709 static int hidpp10_battery_event(struct hidpp_device *hidpp, u8 *data, int size)
711 struct hidpp_report *report = (struct hidpp_report *)data;
1109 static int hidpp20_batterylevel_map_status_capacity(u8 data[3], int *capacity,
1115 *capacity = data[0];
1116 *next_capacity = data[1];
1122 switch (data[2]) {
1252 u8 *data, int size)
1254 struct hidpp_report *report = (struct hidpp_report *)data;
1296 static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage,
1301 long flags = (long) data[2];
1334 *voltage = get_unaligned_be16(data);
1399 u8 *data, int size)
1401 struct hidpp_report *report = (struct hidpp_report *)data;
1642 u8 *data, int size)
1644 struct hidpp_report *report = (struct hidpp_report *)data;
1832 static void hidpp_touchpad_touch_event(u8 *data,
1835 u8 x_m = data[0] << 2;
1836 u8 y_m = data[2] << 2;
1838 finger->x = x_m << 6 | data[1];
1839 finger->y = y_m << 6 | data[3];
1841 finger->contact_type = data[0] >> 6;
1842 finger->contact_status = data[2] >> 6;
1844 finger->z = data[4];
1845 finger->area = data[5];
1846 finger->finger_id = data[6] >> 4;
1850 u8 *data, struct hidpp_touchpad_raw_xy *raw_xy)
1853 raw_xy->end_of_frame = data[8] & 0x01;
1854 raw_xy->spurious_flag = (data[8] >> 1) & 0x01;
1855 raw_xy->finger_count = data[15] & 0x0f;
1856 raw_xy->button = (data[8] >> 2) & 0x01;
1859 hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]);
1860 hidpp_touchpad_touch_event(&data[9], &raw_xy->fingers[1]);
1919 struct hidpp_ff_private_data *data;
1963 static u8 hidpp_ff_find_effect(struct hidpp_ff_private_data *data, int effect_id)
1967 for (i = 0; i < data->num_effects; i++)
1968 if (data->effect_ids[i] == effect_id)
1977 struct hidpp_ff_private_data *data = wd->data;
1985 wd->params[0] = data->slot_autocenter;
1992 wd->params[0] = hidpp_ff_find_effect(data, wd->effect_id);
1997 ret = hidpp_send_fap_command_sync(data->hidpp, data->feature_index,
2001 hid_err(data->hidpp->hid_dev, "Failed to send command to device!\n");
2005 /* parse return data */
2009 if (slot > 0 && slot <= data->num_effects) {
2012 data->effect_ids[slot-1] = wd->effect_id;
2015 data->slot_autocenter = slot;
2021 data->effect_ids[wd->params[0]-1] = -1;
2024 data->slot_autocenter = 0;
2027 data->gain = (wd->params[0] << 8) + wd->params[1];
2030 data->range = (wd->params[0] << 8) + wd->params[1];
2038 atomic_dec(&data->workqueue_size);
2042 static int hidpp_ff_queue_work(struct hidpp_ff_private_data *data, int effect_id, u8 command, u8 *params, u8 size)
2052 wd->data = data;
2058 atomic_inc(&data->workqueue_size);
2059 queue_work(data->wq, &wd->work);
2062 s = atomic_read(&data->workqueue_size);
2064 hid_warn(data->hidpp->hid_dev, "Force feedback command queue contains %d commands, causing substantial delays!", s);
2071 struct hidpp_ff_private_data *data = dev->ff->private;
2123 hid_err(data->hidpp->hid_dev, "Unexpected periodic waveform type %i!\n", effect->u.periodic.waveform);
2208 hid_err(data->hidpp->hid_dev, "Unexpected force type %i!\n", effect->type);
2212 return hidpp_ff_queue_work(data, effect->id, HIDPP_FF_DOWNLOAD_EFFECT, params, size);
2217 struct hidpp_ff_private_data *data = dev->ff->private;
2224 return hidpp_ff_queue_work(data, effect_id, HIDPP_FF_SET_EFFECT_STATE, params, ARRAY_SIZE(params));
2229 struct hidpp_ff_private_data *data = dev->ff->private;
2234 return hidpp_ff_queue_work(data, effect_id, HIDPP_FF_DESTROY_EFFECT, &slot, 1);
2239 struct hidpp_ff_private_data *data = dev->ff->private;
2256 hidpp_ff_queue_work(data, HIDPP_FF_EFFECTID_AUTOCENTER, HIDPP_FF_DOWNLOAD_EFFECT, params, ARRAY_SIZE(params));
2261 struct hidpp_ff_private_data *data = dev->ff->private;
2271 hidpp_ff_queue_work(data, HIDPP_FF_EFFECTID_NONE, HIDPP_FF_SET_GLOBAL_GAINS, params, ARRAY_SIZE(params));
2279 struct hidpp_ff_private_data *data = idev->ff->private;
2281 return scnprintf(buf, PAGE_SIZE, "%u\n", data->range);
2289 struct hidpp_ff_private_data *data = idev->ff->private;
2298 hidpp_ff_queue_work(data, -1, HIDPP_FF_SET_APERTURE, params, ARRAY_SIZE(params));
2307 struct hidpp_ff_private_data *data = ff->private;
2308 struct hid_device *hid = data->hidpp->hid_dev;
2313 destroy_workqueue(data->wq);
2314 kfree(data->effect_ids);
2318 struct hidpp_ff_private_data *data)
2326 int error, j, num_slots = data->num_effects;
2358 * Create a copy of passed data, so we can transfer memory
2361 data = kmemdup(data, sizeof(*data), GFP_KERNEL);
2362 if (!data)
2364 data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL);
2365 if (!data->effect_ids) {
2366 kfree(data);
2369 data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
2370 if (!data->wq) {
2371 kfree(data->effect_ids);
2372 kfree(data);
2376 data->hidpp = hidpp;
2377 data->version = version;
2379 data->effect_ids[j] = -1;
2382 ff->private = data;
2397 atomic_set(&data->workqueue_size, 0);
2470 /* no actual data */
2507 static int wtp_mouse_raw_xy_event(struct hidpp_device *hidpp, u8 *data)
2510 u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) +
2511 (data[7] >> 4) * (data[7] >> 4)) / 2;
2512 u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) +
2513 (data[13] >> 4) * (data[13] >> 4)) / 2;
2515 .timestamp = data[1],
2519 .contact_status = !!data[7],
2520 .x = get_unaligned_le16(&data[3]),
2521 .y = get_unaligned_le16(&data[5]),
2524 .finger_id = data[2],
2527 .contact_status = !!data[13],
2528 .x = get_unaligned_le16(&data[9]),
2529 .y = get_unaligned_le16(&data[11]),
2532 .finger_id = data[8],
2537 .end_of_frame = (data[0] >> 7) == 0,
2538 .button = data[0] & 0x01,
2546 static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size)
2550 struct hidpp_report *report = (struct hidpp_report *)data;
2556 switch (data[0]) {
2565 !!(data[1] & 0x01));
2567 !!(data[1] & 0x02));
2573 return wtp_mouse_raw_xy_event(hidpp, &data[7]);
2580 hidpp_touchpad_raw_xy_event(hidpp, data + 4, &raw);
2713 static int m560_raw_event(struct hid_device *hdev, u8 *data, int size)
2728 if (data[0] == REPORT_ID_HIDPP_LONG &&
2729 data[2] == M560_SUB_ID && data[6] == 0x00) {
2733 * data[0] = 0x11
2734 * data[1] = device-id
2735 * data[2] = 0x0a
2736 * data[5] = 0xaf -> middle
2740 * data[6] = 0x00
2743 switch (data[5]) {
2764 } else if (data[0] == 0x02) {
2768 * data[0] = type (0x02)
2769 * data[1..2] = buttons
2770 * data[3..5] = xy
2771 * data[6] = wheel
2777 !!(data[1] & M560_MOUSE_BTN_LEFT));
2779 !!(data[1] & M560_MOUSE_BTN_RIGHT));
2781 if (data[1] & M560_MOUSE_BTN_WHEEL_LEFT) {
2785 } else if (data[1] & M560_MOUSE_BTN_WHEEL_RIGHT) {
2791 v = hid_snto32(hid_field_extract(hdev, data+3, 0, 12), 12);
2794 v = hid_snto32(hid_field_extract(hdev, data+3, 12, 12), 12);
2797 v = hid_snto32(data[6], 8);
2907 struct hidpp_ff_private_data *data)
2918 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2925 data->slot_autocenter = response.fap.params[0];
2931 struct hidpp_ff_private_data *data)
2937 memset(data, 0, sizeof(*data));
2941 &data->feature_index, &feature_type);
2946 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2958 data->num_effects = response.fap.params[0] - HIDPP_FF_RESERVED_SLOTS;
2961 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2968 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2976 data->range = ret ?
2980 ret = hidpp_send_fap_command_sync(hidpp, data->feature_index,
2987 data->gain = ret ?
2992 return g920_ff_set_autocenter(hidpp, data);
3026 u8 *data, int size)
3036 if (data[0] != REPORT_ID_HIDPP_SHORT || data[2] != HIDPP_SUB_ID_ROLLER)
3039 value = data[3];
3040 hvalue = data[4];
3072 u8 *data, int size)
3082 if (data[0] != REPORT_ID_HIDPP_SHORT ||
3083 data[2] != HIDPP_SUB_ID_MOUSE_EXTRA_BTNS)
3094 (data[3] & (1 << i)));
3099 (data[4] & (1 << i)));
3160 u8 *data, int size)
3167 if (data[0] != REPORT_ID_HIDPP_SHORT ||
3168 data[2] != HIDPP_SUB_ID_CONSUMER_VENDOR_KEYS)
3172 * Build a normal consumer report (3) out of the data, this detour
3176 memcpy(&consumer_report[1], &data[3], 4);
3309 static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data,
3314 struct hidpp_report *report = (struct hidpp_report *)data;
3350 ret = hidpp20_battery_event(hidpp, data, size);
3353 ret = hidpp_solar_battery_event(hidpp, data, size);
3356 ret = hidpp20_battery_voltage_event(hidpp, data, size);
3362 ret = hidpp10_battery_event(hidpp, data, size);
3368 ret = hidpp10_wheel_raw_event(hidpp, data, size);
3374 ret = hidpp10_extra_mouse_buttons_raw_event(hidpp, data, size);
3380 ret = hidpp10_consumer_keys_raw_event(hidpp, data, size);
3389 u8 *data, int size)
3398 switch (data[0]) {
3405 ret = hidpp_raw_hidpp_event(hidpp, data, size);
3413 ret = hidpp_raw_hidpp_event(hidpp, data, size);
3421 ret = hidpp_raw_hidpp_event(hidpp, data, size);
3431 return wtp_raw_event(hdev, data, size);
3433 return m560_raw_event(hdev, data, size);
3811 struct hidpp_ff_private_data data;
3916 ret = g920_get_config(hidpp, &data);
3935 ret = hidpp_ff_init(hidpp, &data);