Lines Matching +full:report +full:- +full:error
1 // SPDX-License-Identifier: GPL-2.0+
7 * "Kid-friendly Wired Controller" PS3OFMINIPAD SONY
19 #include "hid-ids.h"
32 * 0x75, 0x01, // Report Size (1)
33 * 0x95, 0x0D, // Report Count (13)
38 * 0x95, 0x03, // Report Count (3)
43 * 0x75, 0x04, // Report Size (4)
44 * 0x95, 0x01, // Report Count (1)
49 * 0x95, 0x01, // Report Count (1)
57 * 0x75, 0x08, // Report Size (8)
58 * 0x95, 0x04, // Report Count (4)
73 * 0x95, 0x0C, // Report Count (12)
76 * 0x95, 0x08, // Report Count (8)
77 …02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
79 …x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
86 * 0x75, 0x10, // Report Size (16)
87 * 0x95, 0x04, // Report Count (4)
97 * - map buttons according to gamepad.rst
98 * - assign right stick from Z/Rz to Rx/Ry
99 * - map previously unused analog trigger data to Z/RZ
100 * - simplify feature and output descriptor
110 0x75, 0x01, /* Report Size (1) */
111 0x95, 0x0D, /* Report Count (13) */
127 0x75, 0x01, /* Report Size (1) */
128 0x95, 0x03, /* Report Count (3) */
133 0x75, 0x04, /* Report Size (4) */
134 0x95, 0x01, /* Report Count (1) */
139 0x95, 0x01, /* Report Count (1) */
147 0x75, 0x08, /* Report Size (8) */
148 0x95, 0x04, /* Report Count (4) */
150 0x95, 0x0A, /* Report Count (10) */
157 0x95, 0x02, /* Report Count (2) */
159 0x95, 0x08, /* Report Count (8) */
162 …0xB1, 0x02, /* Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-…
164 0x95, 0x08, /* Report Count (8) */
165 …0x91, 0x02, /* Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-v…
167 0x95, 0x08, /* Report Count (8) */
176 struct hid_report *report; member
180 u8 left_motor_force; /* left motor force 0-255 */
192 struct hid_field *report_field = bigben->report->field[0]; in bigben_worker()
194 if (bigben->removed || !report_field) in bigben_worker()
197 if (bigben->work_led) { in bigben_worker()
198 bigben->work_led = false; in bigben_worker()
199 report_field->value[0] = 0x01; /* 1 = led message */ in bigben_worker()
200 report_field->value[1] = 0x08; /* reserved value, always 8 */ in bigben_worker()
201 report_field->value[2] = bigben->led_state; in bigben_worker()
202 report_field->value[3] = 0x00; /* padding */ in bigben_worker()
203 report_field->value[4] = 0x00; /* padding */ in bigben_worker()
204 report_field->value[5] = 0x00; /* padding */ in bigben_worker()
205 report_field->value[6] = 0x00; /* padding */ in bigben_worker()
206 report_field->value[7] = 0x00; /* padding */ in bigben_worker()
207 hid_hw_request(bigben->hid, bigben->report, HID_REQ_SET_REPORT); in bigben_worker()
210 if (bigben->work_ff) { in bigben_worker()
211 bigben->work_ff = false; in bigben_worker()
212 report_field->value[0] = 0x02; /* 2 = rumble effect message */ in bigben_worker()
213 report_field->value[1] = 0x08; /* reserved value, always 8 */ in bigben_worker()
214 report_field->value[2] = bigben->right_motor_on; in bigben_worker()
215 report_field->value[3] = bigben->left_motor_force; in bigben_worker()
216 report_field->value[4] = 0xff; /* duration 0-254 (255 = nonstop) */ in bigben_worker()
217 report_field->value[5] = 0x00; /* padding */ in bigben_worker()
218 report_field->value[6] = 0x00; /* padding */ in bigben_worker()
219 report_field->value[7] = 0x00; /* padding */ in bigben_worker()
220 hid_hw_request(bigben->hid, bigben->report, HID_REQ_SET_REPORT); in bigben_worker()
237 if (effect->type != FF_RUMBLE) in hid_bigben_play_effect()
240 right_motor_on = effect->u.rumble.weak_magnitude ? 1 : 0; in hid_bigben_play_effect()
241 left_motor_force = effect->u.rumble.strong_magnitude / 256; in hid_bigben_play_effect()
243 if (right_motor_on != bigben->right_motor_on || in hid_bigben_play_effect()
244 left_motor_force != bigben->left_motor_force) { in hid_bigben_play_effect()
245 bigben->right_motor_on = right_motor_on; in hid_bigben_play_effect()
246 bigben->left_motor_force = left_motor_force; in hid_bigben_play_effect()
247 bigben->work_ff = true; in hid_bigben_play_effect()
248 schedule_work(&bigben->worker); in hid_bigben_play_effect()
257 struct device *dev = led->dev->parent; in bigben_set_led()
269 if (led == bigben->leds[n]) { in bigben_set_led()
271 work = (bigben->led_state & BIT(n)); in bigben_set_led()
272 bigben->led_state &= ~BIT(n); in bigben_set_led()
274 work = !(bigben->led_state & BIT(n)); in bigben_set_led()
275 bigben->led_state |= BIT(n); in bigben_set_led()
279 bigben->work_led = true; in bigben_set_led()
280 schedule_work(&bigben->worker); in bigben_set_led()
289 struct device *dev = led->dev->parent; in bigben_get_led()
300 if (led == bigben->leds[n]) in bigben_get_led()
301 return (bigben->led_state & BIT(n)) ? LED_ON : LED_OFF; in bigben_get_led()
311 bigben->removed = true; in bigben_remove()
312 cancel_work_sync(&bigben->worker); in bigben_remove()
325 int n, error; in bigben_probe() local
327 bigben = devm_kzalloc(&hid->dev, sizeof(*bigben), GFP_KERNEL); in bigben_probe()
329 return -ENOMEM; in bigben_probe()
331 bigben->hid = hid; in bigben_probe()
332 bigben->removed = false; in bigben_probe()
334 error = hid_parse(hid); in bigben_probe()
335 if (error) { in bigben_probe()
337 return error; in bigben_probe()
340 error = hid_hw_start(hid, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); in bigben_probe()
341 if (error) { in bigben_probe()
343 return error; in bigben_probe()
346 report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; in bigben_probe()
347 bigben->report = list_entry(report_list->next, in bigben_probe()
350 if (list_empty(&hid->inputs)) { in bigben_probe()
352 error = -ENODEV; in bigben_probe()
356 hidinput = list_first_entry(&hid->inputs, struct hid_input, list); in bigben_probe()
357 set_bit(FF_RUMBLE, hidinput->input->ffbit); in bigben_probe()
359 INIT_WORK(&bigben->worker, bigben_worker); in bigben_probe()
361 error = input_ff_create_memless(hidinput->input, NULL, in bigben_probe()
363 if (error) in bigben_probe()
366 name_sz = strlen(dev_name(&hid->dev)) + strlen(":red:bigben#") + 1; in bigben_probe()
370 &hid->dev, in bigben_probe()
375 error = -ENOMEM; in bigben_probe()
381 dev_name(&hid->dev), n + 1 in bigben_probe()
383 led->name = name; in bigben_probe()
384 led->brightness = (n == 0) ? LED_ON : LED_OFF; in bigben_probe()
385 led->max_brightness = 1; in bigben_probe()
386 led->brightness_get = bigben_get_led; in bigben_probe()
387 led->brightness_set = bigben_set_led; in bigben_probe()
388 bigben->leds[n] = led; in bigben_probe()
389 error = devm_led_classdev_register(&hid->dev, led); in bigben_probe()
390 if (error) in bigben_probe()
395 bigben->led_state = BIT(0); in bigben_probe()
396 bigben->right_motor_on = 0; in bigben_probe()
397 bigben->left_motor_force = 0; in bigben_probe()
398 bigben->work_led = true; in bigben_probe()
399 bigben->work_ff = true; in bigben_probe()
400 schedule_work(&bigben->worker); in bigben_probe()
408 return error; in bigben_probe()