Lines Matching +full:abs +full:- +full:flat

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
33 * https://www.psdevwiki.com/ps4/DS4-USB
80 0x81, 0x02, /* Input (Data,Var,Abs) */
89 0x81, 0x42, /* Input (Data,Var,Abs,Null State) */
99 0x81, 0x02, /* Input (Data,Var,Abs) */
106 0x81, 0x02, /* Input (Data,Var,Abs) */
114 0x81, 0x02, /* Input (Data,Var,Abs) */
117 0x09, 0x08, /* Usage (Multi-axis Controller) */
124 0x81, 0x02, /* Input (Data,Var,Abs) */
130 0x81, 0x02, /* Input (Data,Var,Abs) */
134 0x16, 0x00, 0x80, /* Logical Minimum (-32768) */
138 0x81, 0x02, /* Input (Data,Var,Abs) */
141 0x16, 0x00, 0x80, /* Logical Minimum (-32768) */
144 0x81, 0x02, /* Input (Data,Var,Abs) */
166 0x81, 0x02, /* Input (Data,Var,Abs) */
183 0x81, 0x02, /* Input (Data,Var,Abs) */
186 0x81, 0x03, /* Input (Data,Var,Abs) */
189 0x55, 0x0C, /* Unit Exponent (-4) */
195 0x81, 0x02, /* Input (Data,Var,Abs) */
205 0x81, 0x02, /* Input (Data,Var,Abs) */
210 0x81, 0x02, /* Input (Data,Var,Abs) */
213 0x55, 0x0E, /* Unit Exponent (-2) */
219 0x81, 0x02, /* Input (Data,Var,Abs) */
223 0x81, 0x02, /* Input (Data,Var,Abs) */
234 0x81, 0x02, /* Input (Data,Var,Abs) */
239 0x81, 0x02, /* Input (Data,Var,Abs) */
242 0x55, 0x0E, /* Unit Exponent (-2) */
248 0x81, 0x02, /* Input (Data,Var,Abs) */
252 0x81, 0x02, /* Input (Data,Var,Abs) */
258 0x55, 0x0C, /* Unit Exponent (-4) */
264 0x81, 0x02, /* Input (Data,Var,Abs) */
274 0x81, 0x02, /* Input (Data,Var,Abs) */
279 0x81, 0x02, /* Input (Data,Var,Abs) */
282 0x55, 0x0E, /* Unit Exponent (-2) */
288 0x81, 0x02, /* Input (Data,Var,Abs) */
292 0x81, 0x02, /* Input (Data,Var,Abs) */
303 0x81, 0x02, /* Input (Data,Var,Abs) */
308 0x81, 0x02, /* Input (Data,Var,Abs) */
311 0x55, 0x0E, /* Unit Exponent (-2) */
317 0x81, 0x02, /* Input (Data,Var,Abs) */
321 0x81, 0x02, /* Input (Data,Var,Abs) */
327 0x55, 0x0C, /* Unit Exponent (-4) */
333 0x81, 0x02, /* Input (Data,Var,Abs) */
343 0x81, 0x02, /* Input (Data,Var,Abs) */
348 0x81, 0x02, /* Input (Data,Var,Abs) */
351 0x55, 0x0E, /* Unit Exponent (-2) */
357 0x81, 0x02, /* Input (Data,Var,Abs) */
361 0x81, 0x02, /* Input (Data,Var,Abs) */
372 0x81, 0x02, /* Input (Data,Var,Abs) */
377 0x81, 0x02, /* Input (Data,Var,Abs) */
380 0x55, 0x0E, /* Unit Exponent (-2) */
386 0x81, 0x02, /* Input (Data,Var,Abs) */
390 0x81, 0x02, /* Input (Data,Var,Abs) */
404 0x91, 0x02, /* Output (Data,Var,Abs) */
408 0xB1, 0x02, /* Feature (Data,Var,Abs) */
412 0xB1, 0x02, /* Feature (Data,Var,Abs) */
416 0xB1, 0x02, /* Feature (Data,Var,Abs) */
420 0xB1, 0x02, /* Feature (Data,Var,Abs) */
424 0xB1, 0x02, /* Feature (Data,Var,Abs) */
429 0xB1, 0x02, /* Feature (Data,Var,Abs) */
433 0xB1, 0x02, /* Feature (Data,Var,Abs) */
438 0xB1, 0x02, /* Feature (Data,Var,Abs) */
442 0xB1, 0x02, /* Feature (Data,Var,Abs) */
444 0x85, 0x80, /* Report ID (-128) */
447 0xB1, 0x02, /* Feature (Data,Var,Abs) */
448 0x85, 0x81, /* Report ID (-127) */
451 0xB1, 0x02, /* Feature (Data,Var,Abs) */
452 0x85, 0x82, /* Report ID (-126) */
455 0xB1, 0x02, /* Feature (Data,Var,Abs) */
456 0x85, 0x83, /* Report ID (-125) */
459 0xB1, 0x02, /* Feature (Data,Var,Abs) */
460 0x85, 0x84, /* Report ID (-124) */
463 0xB1, 0x02, /* Feature (Data,Var,Abs) */
464 0x85, 0x85, /* Report ID (-123) */
467 0xB1, 0x02, /* Feature (Data,Var,Abs) */
468 0x85, 0x86, /* Report ID (-122) */
471 0xB1, 0x02, /* Feature (Data,Var,Abs) */
472 0x85, 0x87, /* Report ID (-121) */
475 0xB1, 0x02, /* Feature (Data,Var,Abs) */
476 0x85, 0x88, /* Report ID (-120) */
479 0xB1, 0x02, /* Feature (Data,Var,Abs) */
480 0x85, 0x89, /* Report ID (-119) */
483 0xB1, 0x02, /* Feature (Data,Var,Abs) */
484 0x85, 0x90, /* Report ID (-112) */
487 0xB1, 0x02, /* Feature (Data,Var,Abs) */
488 0x85, 0x91, /* Report ID (-111) */
491 0xB1, 0x02, /* Feature (Data,Var,Abs) */
492 0x85, 0x92, /* Report ID (-110) */
495 0xB1, 0x02, /* Feature (Data,Var,Abs) */
496 0x85, 0x93, /* Report ID (-109) */
499 0xB1, 0x02, /* Feature (Data,Var,Abs) */
500 0x85, 0xA0, /* Report ID (-96) */
503 0xB1, 0x02, /* Feature (Data,Var,Abs) */
504 0x85, 0xA1, /* Report ID (-95) */
507 0xB1, 0x02, /* Feature (Data,Var,Abs) */
508 0x85, 0xA2, /* Report ID (-94) */
511 0xB1, 0x02, /* Feature (Data,Var,Abs) */
512 0x85, 0xA3, /* Report ID (-93) */
515 0xB1, 0x02, /* Feature (Data,Var,Abs) */
516 0x85, 0xA4, /* Report ID (-92) */
519 0xB1, 0x02, /* Feature (Data,Var,Abs) */
520 0x85, 0xA5, /* Report ID (-91) */
523 0xB1, 0x02, /* Feature (Data,Var,Abs) */
524 0x85, 0xA6, /* Report ID (-90) */
527 0xB1, 0x02, /* Feature (Data,Var,Abs) */
528 0x85, 0xF0, /* Report ID (-16) */
531 0xB1, 0x02, /* Feature (Data,Var,Abs) */
532 0x85, 0xF1, /* Report ID (-15) */
535 0xB1, 0x02, /* Feature (Data,Var,Abs) */
536 0x85, 0xF2, /* Report ID (-14) */
539 0xB1, 0x02, /* Feature (Data,Var,Abs) */
540 0x85, 0xA7, /* Report ID (-89) */
543 0xB1, 0x02, /* Feature (Data,Var,Abs) */
544 0x85, 0xA8, /* Report ID (-88) */
547 0xB1, 0x02, /* Feature (Data,Var,Abs) */
548 0x85, 0xA9, /* Report ID (-87) */
551 0xB1, 0x02, /* Feature (Data,Var,Abs) */
552 0x85, 0xAA, /* Report ID (-86) */
555 0xB1, 0x02, /* Feature (Data,Var,Abs) */
556 0x85, 0xAB, /* Report ID (-85) */
559 0xB1, 0x02, /* Feature (Data,Var,Abs) */
560 0x85, 0xAC, /* Report ID (-84) */
563 0xB1, 0x02, /* Feature (Data,Var,Abs) */
564 0x85, 0xAD, /* Report ID (-83) */
567 0xB1, 0x02, /* Feature (Data,Var,Abs) */
568 0x85, 0xAE, /* Report ID (-82) */
571 0xB1, 0x02, /* Feature (Data,Var,Abs) */
572 0x85, 0xAF, /* Report ID (-81) */
575 0xB1, 0x02, /* Feature (Data,Var,Abs) */
576 0x85, 0xB0, /* Report ID (-80) */
579 0xB1, 0x02, /* Feature (Data,Var,Abs) */
712 { HIDMAP_ABS(HUP_GENERIC_DESKTOP, HUG_##usage, code), .flat = 15 }
810 for (i = 0; i < nitems(sc->calib_data); i++) { in ps4dsacc_data_cb()
811 if (sc->calib_data[i].usage == ctx.hi->usage) { in ps4dsacc_data_cb()
813 sc->calib_data[i].code, in ps4dsacc_data_cb()
814 -sc->calib_data[i].range, in ps4dsacc_data_cb()
815 sc->calib_data[i].range, 16, 0, in ps4dsacc_data_cb()
816 sc->calib_data[i].res); in ps4dsacc_data_cb()
817 HIDMAP_CB_UDATA = &sc->calib_data[i]; in ps4dsacc_data_cb()
825 evdev_push_abs(evdev, calib->code, in ps4dsacc_data_cb()
826 ((int64_t)ctx.data - calib->bias) * calib->sens_numer / in ps4dsacc_data_cb()
827 calib->sens_denom); in ps4dsacc_data_cb()
853 sc->ev_tstamp += (uint16_t)(tstamp - sc->hw_tstamp) * 16 / 3; in ps4dsacc_tstamp_cb()
854 sc->hw_tstamp = tstamp; in ps4dsacc_tstamp_cb()
855 evdev_push_msc(evdev, MSC_TIMESTAMP, sc->ev_tstamp); in ps4dsacc_tstamp_cb()
884 sc->npackets = MIN(PS4DS_MAX_TOUCHPAD_PACKETS,(u_int)ctx.data); in ps4dsmtp_npackets_cb()
886 sc->data_ptr = sc->data; in ps4dsmtp_npackets_cb()
898 *sc->data_ptr = ctx.data; in ps4dsmtp_data_cb()
899 ++sc->data_ptr; in ps4dsmtp_data_cb()
918 evdev_push_abs(evdev, ABS_MT_TRACKING_ID, -1); in ps4dsmtp_push_packet()
925 evdev_push_abs(evdev, ABS_MT_TRACKING_ID, -1); in ps4dsmtp_push_packet()
927 if (sc->do_tstamps) { in ps4dsmtp_push_packet()
929 * Export hardware timestamps in libinput-friendly way. in ps4dsmtp_push_packet()
930 * Make timestamp counter 32-bit, scale up hardware in ps4dsmtp_push_packet()
935 delta = hw_tstamp - sc->hw_tstamp; in ps4dsmtp_push_packet()
936 sc->hw_tstamp = hw_tstamp; in ps4dsmtp_push_packet()
939 if ((touch || sc->touch) && delta != 0) { in ps4dsmtp_push_packet()
940 if (sc->touch) in ps4dsmtp_push_packet()
941 sc->ev_tstamp += delta * 682; in ps4dsmtp_push_packet()
942 evdev_push_msc(evdev, MSC_TIMESTAMP, sc->ev_tstamp); in ps4dsmtp_push_packet()
945 sc->ev_tstamp = 0; in ps4dsmtp_push_packet()
946 sc->touch = touch; in ps4dsmtp_push_packet()
959 if (hid_test_quirk(hid_get_device_info(sc->hm.dev), in ps4dsmtp_final_cb()
961 sc->do_tstamps = true; in ps4dsmtp_final_cb()
970 sc->btn_loc = (struct hid_location) { 1, 0, 49 }; in ps4dsmtp_final_cb()
974 if (sc->do_tstamps) { in ps4dsmtp_final_cb()
980 evdev_support_abs(evdev, ABS_MT_TRACKING_ID, -1, 127, 0, 0, 0); in ps4dsmtp_final_cb()
993 HIDMAP_CB_GET_UDATA(&sc->btn_loc)); in ps4dsmtp_final_cb()
994 for (data = sc->data; in ps4dsmtp_final_cb()
995 data < sc->data + PS4DS_NTPUSAGES * sc->npackets; in ps4dsmtp_final_cb()
1013 hid_size_t osize = sc->is_bluetooth ? in ps4dshock_write()
1020 buf[0] = sc->is_bluetooth ? 0x11 : 0x05; in ps4dshock_write()
1021 offset = sc->is_bluetooth ? 3 : 1; in ps4dshock_write()
1022 led_on = sc->led_state != PS4DS_LED_OFF; in ps4dshock_write()
1023 led_blinks = sc->led_state == PS4DS_LED_BLINKING; in ps4dshock_write()
1026 .rumble_right = sc->rumble_right, in ps4dshock_write()
1027 .rumble_left = sc->rumble_left, in ps4dshock_write()
1028 .led_color_r = led_on ? sc->led_color.r : 0, in ps4dshock_write()
1029 .led_color_g = led_on ? sc->led_color.g : 0, in ps4dshock_write()
1030 .led_color_b = led_on ? sc->led_color.b : 0, in ps4dshock_write()
1032 .led_delay_on = led_blinks ? sc->led_delay_on / 10 : 0, in ps4dshock_write()
1033 .led_delay_off = led_blinks ? sc->led_delay_off / 10 : 0, in ps4dshock_write()
1036 return (hid_write(sc->hm.dev, buf, osize)); in ps4dshock_write()
1046 if (oidp->oid_arg1 == NULL || oidp->oid_arg2 < 0 || in ps4dshock_sysctl()
1047 oidp->oid_arg2 > PD4DSHOCK_SYSCTL_LAST) in ps4dshock_sysctl()
1050 sc = oidp->oid_arg1; in ps4dshock_sysctl()
1051 sx_xlock(&sc->lock); in ps4dshock_sysctl()
1054 arg = *(int *)((char *)sc + oidp->oid_arg2); in ps4dshock_sysctl()
1058 if (error || !req->newptr) in ps4dshock_sysctl()
1065 switch (oidp->oid_arg2) { in ps4dshock_sysctl()
1087 *(int *)((char *)sc + oidp->oid_arg2) = arg; in ps4dshock_sysctl()
1091 sx_unlock(&sc->lock); in ps4dshock_sysctl()
1111 hidmap_set_debug_var(&sc->hm, &HID_DEBUG_VAR); in ps4dshock_probe()
1113 HIDMAP_PROBE(&sc->hm, dev, ps4dshock_devs, ps4dshock_map, NULL) in ps4dshock_probe()
1122 hidmap_set_debug_var(&sc->hm, &HID_DEBUG_VAR); in ps4dsacc_probe()
1124 HIDMAP_PROBE(&sc->hm, dev, ps4dsacc_devs, ps4dsacc_map, "Sensors") in ps4dsacc_probe()
1144 hidmap_set_debug_var(&sc->hm, &HID_DEBUG_VAR); in ps4dsmtp_probe()
1146 HIDMAP_PROBE(&sc->hm, dev, ps4dsmtp_devs, ps4dsmtp_map, "Touchpad") in ps4dsmtp_probe()
1157 sc->led_state = PS4DS_LED_ON; in ps4dshock_attach()
1158 sc->led_color = ps4ds_leds[device_get_unit(dev) % nitems(ps4ds_leds)]; in ps4dshock_attach()
1159 sc->led_delay_on = 500; /* 1 Hz */ in ps4dshock_attach()
1160 sc->led_delay_off = 500; in ps4dshock_attach()
1163 sx_init(&sc->lock, "ps4dshock"); in ps4dshock_attach()
1168 "LED state: 0 - off, 1 - on, 2 - blinking."); in ps4dshock_attach()
1195 return (hidmap_attach(&sc->hm)); in ps4dshock_attach()
1221 sc->calib_data[0].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_RX); in ps4dsacc_attach()
1222 sc->calib_data[0].code = ABS_RX; in ps4dsacc_attach()
1223 sc->calib_data[0].range = PS4DS_GYRO_RES_PER_DEG_S * 2048; in ps4dsacc_attach()
1224 sc->calib_data[0].res = PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1225 sc->calib_data[0].bias = HGETW(&buf[1]); in ps4dsacc_attach()
1226 sc->calib_data[0].sens_numer = speed_2x * PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1227 sc->calib_data[0].sens_denom = HGETW(&buf[7]) - HGETW(&buf[9]); in ps4dsacc_attach()
1229 /* sc->calib_data[0].sens_denom = HGETW(&buf[7]) - HGETW(&buf[13]); */ in ps4dsacc_attach()
1231 sc->calib_data[1].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_RY); in ps4dsacc_attach()
1232 sc->calib_data[1].code = ABS_RY; in ps4dsacc_attach()
1233 sc->calib_data[1].range = PS4DS_GYRO_RES_PER_DEG_S * 2048; in ps4dsacc_attach()
1234 sc->calib_data[1].res = PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1235 sc->calib_data[1].bias = HGETW(&buf[3]); in ps4dsacc_attach()
1236 sc->calib_data[1].sens_numer = speed_2x * PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1237 sc->calib_data[1].sens_denom = HGETW(&buf[11]) - HGETW(&buf[13]); in ps4dsacc_attach()
1239 /* sc->calib_data[1].sens_denom = HGETW(&buf[9]) - HGETW(&buf[15]); */ in ps4dsacc_attach()
1241 sc->calib_data[2].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_RZ); in ps4dsacc_attach()
1242 sc->calib_data[2].code = ABS_RZ; in ps4dsacc_attach()
1243 sc->calib_data[2].range = PS4DS_GYRO_RES_PER_DEG_S * 2048; in ps4dsacc_attach()
1244 sc->calib_data[2].res = PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1245 sc->calib_data[2].bias = HGETW(&buf[5]); in ps4dsacc_attach()
1246 sc->calib_data[2].sens_numer = speed_2x * PS4DS_GYRO_RES_PER_DEG_S; in ps4dsacc_attach()
1247 sc->calib_data[2].sens_denom = HGETW(&buf[15]) - HGETW(&buf[17]); in ps4dsacc_attach()
1249 /* sc->calib_data[2].sens_denom = HGETW(&buf[11]) - HGETW(&buf[17]); */ in ps4dsacc_attach()
1255 range_2g = HGETW(&buf[23]) - HGETW(&buf[25]); in ps4dsacc_attach()
1256 sc->calib_data[3].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X); in ps4dsacc_attach()
1257 sc->calib_data[3].code = ABS_X; in ps4dsacc_attach()
1258 sc->calib_data[3].range = PS4DS_ACC_RES_PER_G * 4; in ps4dsacc_attach()
1259 sc->calib_data[3].res = PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1260 sc->calib_data[3].bias = HGETW(&buf[23]) - range_2g / 2; in ps4dsacc_attach()
1261 sc->calib_data[3].sens_numer = 2 * PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1262 sc->calib_data[3].sens_denom = range_2g; in ps4dsacc_attach()
1264 range_2g = HGETW(&buf[27]) - HGETW(&buf[29]); in ps4dsacc_attach()
1265 sc->calib_data[4].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y); in ps4dsacc_attach()
1266 sc->calib_data[4].code = ABS_Y; in ps4dsacc_attach()
1267 sc->calib_data[4].range = PS4DS_ACC_RES_PER_G * 4; in ps4dsacc_attach()
1268 sc->calib_data[4].res = PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1269 sc->calib_data[4].bias = HGETW(&buf[27]) - range_2g / 2; in ps4dsacc_attach()
1270 sc->calib_data[4].sens_numer = 2 * PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1271 sc->calib_data[4].sens_denom = range_2g; in ps4dsacc_attach()
1273 range_2g = HGETW(&buf[31]) - HGETW(&buf[33]); in ps4dsacc_attach()
1274 sc->calib_data[5].usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z); in ps4dsacc_attach()
1275 sc->calib_data[5].code = ABS_Z; in ps4dsacc_attach()
1276 sc->calib_data[5].range = PS4DS_ACC_RES_PER_G * 4; in ps4dsacc_attach()
1277 sc->calib_data[5].res = PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1278 sc->calib_data[5].bias = HGETW(&buf[31]) - range_2g / 2; in ps4dsacc_attach()
1279 sc->calib_data[5].sens_numer = 2 * PS4DS_ACC_RES_PER_G; in ps4dsacc_attach()
1280 sc->calib_data[5].sens_denom = range_2g; in ps4dsacc_attach()
1282 return (hidmap_attach(&sc->hm)); in ps4dsacc_attach()
1296 return (hidmap_attach(&sc->hm)); in ps4dsmtp_attach()
1304 hidmap_detach(&sc->hm); in ps4dshock_detach()
1305 sc->led_state = PS4DS_LED_OFF; in ps4dshock_detach()
1307 sx_destroy(&sc->lock); in ps4dshock_detach()
1317 return (hidmap_detach(&sc->hm)); in ps4dsacc_detach()
1331 return (hidmap_detach(&sc->hm)); in ps4dsmtp_detach()