Lines Matching +full:motion +full:- +full:sensors

1 // SPDX-License-Identifier: GPL-2.0+
19 * and re-enable it when the input device is closed, so as not to break user
26 * - it will not send any command to the controller.
27 * - this input device will be removed, to avoid double input of the same
31 * For additional functions, such as changing the right-pad margin or switching
32 * the led, you can use the user-space tool at:
46 #include "hid-ids.h"
70 /* Accelerometer has 16 bit resolution and a range of +/- 2g */
74 /* Gyroscope has 16 bit resolution and a range of +/- 2000 dps */
300 struct input_dev __rcu *sensors; member
325 r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0]; in steam_recv_report()
327 hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted - nothing to read\n"); in steam_recv_report()
328 return -EINVAL; in steam_recv_report()
332 return -EINVAL; in steam_recv_report()
336 return -ENOMEM; in steam_recv_report()
344 ret = hid_hw_raw_request(steam->hdev, 0x00, in steam_recv_report()
348 memcpy(data, buf + 1, min(size, ret - 1)); in steam_recv_report()
361 r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0]; in steam_send_report()
363 hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted - nothing to read\n"); in steam_send_report()
364 return -EINVAL; in steam_send_report()
368 return -EINVAL; in steam_send_report()
372 return -ENOMEM; in steam_send_report()
384 ret = hid_hw_raw_request(steam->hdev, 0, in steam_send_report()
387 if (ret != -EPIPE) in steam_send_report()
390 } while (--retries); in steam_send_report()
394 hid_err(steam->hdev, "%s: error %d (%*ph)\n", __func__, in steam_send_report()
446 u8 cmd[] = {ID_GET_STRING_ATTRIBUTE, sizeof(steam->serial_no), ATTRIB_STR_UNIT_SERIAL}; in steam_get_serial()
449 mutex_lock(&steam->report_mutex); in steam_get_serial()
457 reply[1] > sizeof(steam->serial_no) || reply[2] != ATTRIB_STR_UNIT_SERIAL) { in steam_get_serial()
458 ret = -EIO; in steam_get_serial()
462 strscpy(steam->serial_no, reply + 3, reply[1]); in steam_get_serial()
464 mutex_unlock(&steam->report_mutex); in steam_get_serial()
476 mutex_lock(&steam->report_mutex); in steam_request_conn_status()
478 mutex_unlock(&steam->report_mutex); in steam_request_conn_status()
486 * and gain is measured in decibels, ranging from -24 to +6
507 mutex_lock(&steam->report_mutex); in steam_haptic_pulse()
509 mutex_unlock(&steam->report_mutex); in steam_haptic_pulse()
529 mutex_lock(&steam->report_mutex); in steam_haptic_rumble()
531 mutex_unlock(&steam->report_mutex); in steam_haptic_rumble()
539 steam_haptic_rumble(steam, 0, steam->rumble_left, in steam_haptic_rumble_cb()
540 steam->rumble_right, 2, 0); in steam_haptic_rumble_cb()
549 steam->rumble_left = effect->u.rumble.strong_magnitude; in steam_play_effect()
550 steam->rumble_right = effect->u.rumble.weak_magnitude; in steam_play_effect()
552 return schedule_work(&steam->rumble_work); in steam_play_effect()
558 if (steam->gamepad_mode) in steam_set_lizard_mode()
562 mutex_lock(&steam->report_mutex); in steam_set_lizard_mode()
567 mutex_unlock(&steam->report_mutex); in steam_set_lizard_mode()
569 mutex_lock(&steam->report_mutex); in steam_set_lizard_mode()
573 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_set_lizard_mode()
581 mutex_unlock(&steam->report_mutex); in steam_set_lizard_mode()
587 mutex_unlock(&steam->report_mutex); in steam_set_lizard_mode()
603 if (!(steam->quirks & STEAM_QUIRK_DECK)) { in steam_input_open()
604 spin_lock_irqsave(&steam->lock, flags); in steam_input_open()
605 set_lizard_mode = !steam->client_opened && lizard_mode; in steam_input_open()
606 spin_unlock_irqrestore(&steam->lock, flags); in steam_input_open()
620 if (!(steam->quirks & STEAM_QUIRK_DECK)) { in steam_input_close()
621 spin_lock_irqsave(&steam->lock, flags); in steam_input_close()
622 set_lizard_mode = !steam->client_opened && lizard_mode; in steam_input_close()
623 spin_unlock_irqrestore(&steam->lock, flags); in steam_input_close()
646 spin_lock_irqsave(&steam->lock, flags); in steam_battery_get_property()
647 volts = steam->voltage; in steam_battery_get_property()
648 batt = steam->battery_charge; in steam_battery_get_property()
649 spin_unlock_irqrestore(&steam->lock, flags); in steam_battery_get_property()
653 val->intval = 1; in steam_battery_get_property()
656 val->intval = POWER_SUPPLY_SCOPE_DEVICE; in steam_battery_get_property()
659 val->intval = volts * 1000; /* mV -> uV */ in steam_battery_get_property()
662 val->intval = batt; in steam_battery_get_property()
665 ret = -EINVAL; in steam_battery_get_property()
678 steam->battery_desc.type = POWER_SUPPLY_TYPE_BATTERY; in steam_battery_register()
679 steam->battery_desc.properties = steam_battery_props; in steam_battery_register()
680 steam->battery_desc.num_properties = ARRAY_SIZE(steam_battery_props); in steam_battery_register()
681 steam->battery_desc.get_property = steam_battery_get_property; in steam_battery_register()
682 steam->battery_desc.name = devm_kasprintf(&steam->hdev->dev, in steam_battery_register()
683 GFP_KERNEL, "steam-controller-%s-battery", in steam_battery_register()
684 steam->serial_no); in steam_battery_register()
685 if (!steam->battery_desc.name) in steam_battery_register()
686 return -ENOMEM; in steam_battery_register()
689 spin_lock_irqsave(&steam->lock, flags); in steam_battery_register()
690 steam->voltage = 3000; in steam_battery_register()
691 steam->battery_charge = 100; in steam_battery_register()
692 spin_unlock_irqrestore(&steam->lock, flags); in steam_battery_register()
694 battery = power_supply_register(&steam->hdev->dev, in steam_battery_register()
695 &steam->battery_desc, &battery_cfg); in steam_battery_register()
698 hid_err(steam->hdev, in steam_battery_register()
703 rcu_assign_pointer(steam->battery, battery); in steam_battery_register()
704 power_supply_powers(battery, &steam->hdev->dev); in steam_battery_register()
710 struct hid_device *hdev = steam->hdev; in steam_input_register()
715 input = rcu_dereference(steam->input); in steam_input_register()
724 return -ENOMEM; in steam_input_register()
727 input->dev.parent = &hdev->dev; in steam_input_register()
728 input->open = steam_input_open; in steam_input_register()
729 input->close = steam_input_close; in steam_input_register()
731 input->name = (steam->quirks & STEAM_QUIRK_WIRELESS) ? "Wireless Steam Controller" : in steam_input_register()
732 (steam->quirks & STEAM_QUIRK_DECK) ? "Steam Deck" : in steam_input_register()
734 input->phys = hdev->phys; in steam_input_register()
735 input->uniq = steam->serial_no; in steam_input_register()
736 input->id.bustype = hdev->bus; in steam_input_register()
737 input->id.vendor = hdev->vendor; in steam_input_register()
738 input->id.product = hdev->product; in steam_input_register()
739 input->id.version = hdev->version; in steam_input_register()
760 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
771 input_set_abs_params(input, ABS_X, -32767, 32767, 0, 0); in steam_input_register()
772 input_set_abs_params(input, ABS_Y, -32767, 32767, 0, 0); in steam_input_register()
774 input_set_abs_params(input, ABS_HAT0X, -32767, 32767, in steam_input_register()
776 input_set_abs_params(input, ABS_HAT0Y, -32767, 32767, in steam_input_register()
779 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
783 input_set_abs_params(input, ABS_RX, -32767, 32767, 0, 0); in steam_input_register()
784 input_set_abs_params(input, ABS_RY, -32767, 32767, 0, 0); in steam_input_register()
786 input_set_abs_params(input, ABS_HAT1X, -32767, 32767, in steam_input_register()
788 input_set_abs_params(input, ABS_HAT1Y, -32767, 32767, in steam_input_register()
803 input_set_abs_params(input, ABS_RX, -32767, 32767, in steam_input_register()
805 input_set_abs_params(input, ABS_RY, -32767, 32767, in steam_input_register()
819 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
831 rcu_assign_pointer(steam->input, input); in steam_input_register()
841 struct hid_device *hdev = steam->hdev; in steam_sensors_register()
842 struct input_dev *sensors; in steam_sensors_register() local
845 if (!(steam->quirks & STEAM_QUIRK_DECK)) in steam_sensors_register()
849 sensors = rcu_dereference(steam->sensors); in steam_sensors_register()
851 if (sensors) { in steam_sensors_register()
856 sensors = input_allocate_device(); in steam_sensors_register()
857 if (!sensors) in steam_sensors_register()
858 return -ENOMEM; in steam_sensors_register()
860 input_set_drvdata(sensors, steam); in steam_sensors_register()
861 sensors->dev.parent = &hdev->dev; in steam_sensors_register()
863 sensors->name = "Steam Deck Motion Sensors"; in steam_sensors_register()
864 sensors->phys = hdev->phys; in steam_sensors_register()
865 sensors->uniq = steam->serial_no; in steam_sensors_register()
866 sensors->id.bustype = hdev->bus; in steam_sensors_register()
867 sensors->id.vendor = hdev->vendor; in steam_sensors_register()
868 sensors->id.product = hdev->product; in steam_sensors_register()
869 sensors->id.version = hdev->version; in steam_sensors_register()
871 __set_bit(INPUT_PROP_ACCELEROMETER, sensors->propbit); in steam_sensors_register()
872 __set_bit(EV_MSC, sensors->evbit); in steam_sensors_register()
873 __set_bit(MSC_TIMESTAMP, sensors->mscbit); in steam_sensors_register()
875 input_set_abs_params(sensors, ABS_X, -STEAM_DECK_ACCEL_RANGE, in steam_sensors_register()
877 input_set_abs_params(sensors, ABS_Y, -STEAM_DECK_ACCEL_RANGE, in steam_sensors_register()
879 input_set_abs_params(sensors, ABS_Z, -STEAM_DECK_ACCEL_RANGE, in steam_sensors_register()
881 input_abs_set_res(sensors, ABS_X, STEAM_DECK_ACCEL_RES_PER_G); in steam_sensors_register()
882 input_abs_set_res(sensors, ABS_Y, STEAM_DECK_ACCEL_RES_PER_G); in steam_sensors_register()
883 input_abs_set_res(sensors, ABS_Z, STEAM_DECK_ACCEL_RES_PER_G); in steam_sensors_register()
885 input_set_abs_params(sensors, ABS_RX, -STEAM_DECK_GYRO_RANGE, in steam_sensors_register()
887 input_set_abs_params(sensors, ABS_RY, -STEAM_DECK_GYRO_RANGE, in steam_sensors_register()
889 input_set_abs_params(sensors, ABS_RZ, -STEAM_DECK_GYRO_RANGE, in steam_sensors_register()
891 input_abs_set_res(sensors, ABS_RX, STEAM_DECK_GYRO_RES_PER_DPS); in steam_sensors_register()
892 input_abs_set_res(sensors, ABS_RY, STEAM_DECK_GYRO_RES_PER_DPS); in steam_sensors_register()
893 input_abs_set_res(sensors, ABS_RZ, STEAM_DECK_GYRO_RES_PER_DPS); in steam_sensors_register()
895 ret = input_register_device(sensors); in steam_sensors_register()
899 rcu_assign_pointer(steam->sensors, sensors); in steam_sensors_register()
903 input_free_device(sensors); in steam_sensors_register()
911 input = rcu_dereference(steam->input); in steam_input_unregister()
915 RCU_INIT_POINTER(steam->input, NULL); in steam_input_unregister()
922 struct input_dev *sensors; in steam_sensors_unregister() local
924 if (!(steam->quirks & STEAM_QUIRK_DECK)) in steam_sensors_unregister()
928 sensors = rcu_dereference(steam->sensors); in steam_sensors_unregister()
931 if (!sensors) in steam_sensors_unregister()
933 RCU_INIT_POINTER(steam->sensors, NULL); in steam_sensors_unregister()
935 input_unregister_device(sensors); in steam_sensors_unregister()
943 battery = rcu_dereference(steam->battery); in steam_battery_unregister()
948 RCU_INIT_POINTER(steam->battery, NULL); in steam_battery_unregister()
965 if (!steam->serial_no[0]) { in steam_register()
971 strscpy(steam->serial_no, "XXXXXXXXXX", in steam_register()
972 sizeof(steam->serial_no)); in steam_register()
974 hid_info(steam->hdev, "Steam Controller '%s' connected", in steam_register()
975 steam->serial_no); in steam_register()
978 if (steam->quirks & STEAM_QUIRK_WIRELESS) in steam_register()
982 if (list_empty(&steam->list)) in steam_register()
983 list_add(&steam->list, &steam_devices); in steam_register()
987 spin_lock_irqsave(&steam->lock, flags); in steam_register()
988 client_opened = steam->client_opened; in steam_register()
989 spin_unlock_irqrestore(&steam->lock, flags); in steam_register()
1013 if (steam->serial_no[0]) { in steam_unregister()
1014 hid_info(steam->hdev, "Steam Controller '%s' disconnected", in steam_unregister()
1015 steam->serial_no); in steam_unregister()
1017 list_del_init(&steam->list); in steam_unregister()
1019 steam->serial_no[0] = 0; in steam_unregister()
1031 spin_lock_irqsave(&steam->lock, flags); in steam_work_connect_cb()
1032 connected = steam->connected; in steam_work_connect_cb()
1033 spin_unlock_irqrestore(&steam->lock, flags); in steam_work_connect_cb()
1038 hid_err(steam->hdev, in steam_work_connect_cb()
1053 steam->gamepad_mode = !steam->gamepad_mode; in steam_mode_switch_cb()
1057 if (steam->gamepad_mode) in steam_mode_switch_cb()
1060 spin_lock_irqsave(&steam->lock, flags); in steam_mode_switch_cb()
1061 client_opened = steam->client_opened; in steam_mode_switch_cb()
1062 spin_unlock_irqrestore(&steam->lock, flags); in steam_mode_switch_cb()
1068 if (steam->gamepad_mode) { in steam_mode_switch_cb()
1086 * 1-4: slots where up to 4 real game pads will be connected to. in steam_is_valve_interface()
1090 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; in steam_is_valve_interface()
1091 return !list_empty(&rep_enum->report_list); in steam_is_valve_interface()
1096 struct steam_device *steam = hdev->driver_data; in steam_client_ll_parse()
1098 return hid_parse_report(hdev, steam->hdev->dev_rdesc, in steam_client_ll_parse()
1099 steam->hdev->dev_rsize); in steam_client_ll_parse()
1113 struct steam_device *steam = hdev->driver_data; in steam_client_ll_open()
1116 spin_lock_irqsave(&steam->lock, flags); in steam_client_ll_open()
1117 steam->client_opened++; in steam_client_ll_open()
1118 spin_unlock_irqrestore(&steam->lock, flags); in steam_client_ll_open()
1128 struct steam_device *steam = hdev->driver_data; in steam_client_ll_close()
1133 spin_lock_irqsave(&steam->lock, flags); in steam_client_ll_close()
1134 steam->client_opened--; in steam_client_ll_close()
1135 connected = steam->connected && !steam->client_opened; in steam_client_ll_close()
1136 spin_unlock_irqrestore(&steam->lock, flags); in steam_client_ll_close()
1150 struct steam_device *steam = hdev->driver_data; in steam_client_ll_raw_request()
1152 return hid_hw_raw_request(steam->hdev, reportnum, buf, count, in steam_client_ll_raw_request()
1173 client_hdev->ll_driver = &steam_client_ll_driver; in steam_create_client_hid()
1174 client_hdev->dev.parent = hdev->dev.parent; in steam_create_client_hid()
1175 client_hdev->bus = hdev->bus; in steam_create_client_hid()
1176 client_hdev->vendor = hdev->vendor; in steam_create_client_hid()
1177 client_hdev->product = hdev->product; in steam_create_client_hid()
1178 client_hdev->version = hdev->version; in steam_create_client_hid()
1179 client_hdev->type = hdev->type; in steam_create_client_hid()
1180 client_hdev->country = hdev->country; in steam_create_client_hid()
1181 strscpy(client_hdev->name, hdev->name, in steam_create_client_hid()
1182 sizeof(client_hdev->name)); in steam_create_client_hid()
1183 strscpy(client_hdev->phys, hdev->phys, in steam_create_client_hid()
1184 sizeof(client_hdev->phys)); in steam_create_client_hid()
1190 client_hdev->group = HID_GROUP_STEAM; in steam_create_client_hid()
1211 if (hdev->group == HID_GROUP_STEAM) in steam_probe()
1214 * The non-valve interfaces (mouse and keyboard emulation) are in steam_probe()
1220 steam = devm_kzalloc(&hdev->dev, sizeof(*steam), GFP_KERNEL); in steam_probe()
1222 return -ENOMEM; in steam_probe()
1224 steam->hdev = hdev; in steam_probe()
1226 spin_lock_init(&steam->lock); in steam_probe()
1227 mutex_init(&steam->report_mutex); in steam_probe()
1228 steam->quirks = id->driver_data; in steam_probe()
1229 INIT_WORK(&steam->work_connect, steam_work_connect_cb); in steam_probe()
1230 INIT_DELAYED_WORK(&steam->mode_switch, steam_mode_switch_cb); in steam_probe()
1231 INIT_LIST_HEAD(&steam->list); in steam_probe()
1232 INIT_WORK(&steam->rumble_work, steam_haptic_rumble_cb); in steam_probe()
1233 steam->sensor_timestamp_us = 0; in steam_probe()
1251 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_probe()
1254 steam->connected = false; in steam_probe()
1258 steam->connected = true; in steam_probe()
1268 steam->client_hdev = steam_create_client_hid(hdev); in steam_probe()
1269 if (IS_ERR(steam->client_hdev)) { in steam_probe()
1270 ret = PTR_ERR(steam->client_hdev); in steam_probe()
1273 steam->client_hdev->driver_data = steam; in steam_probe()
1275 ret = hid_add_device(steam->client_hdev); in steam_probe()
1282 hid_destroy_device(steam->client_hdev); in steam_probe()
1284 if (steam->connected) in steam_probe()
1291 cancel_work_sync(&steam->work_connect); in steam_probe()
1292 cancel_delayed_work_sync(&steam->mode_switch); in steam_probe()
1293 cancel_work_sync(&steam->rumble_work); in steam_probe()
1302 if (!steam || hdev->group == HID_GROUP_STEAM) { in steam_remove()
1307 cancel_delayed_work_sync(&steam->mode_switch); in steam_remove()
1308 cancel_work_sync(&steam->work_connect); in steam_remove()
1309 hid_destroy_device(steam->client_hdev); in steam_remove()
1310 steam->client_hdev = NULL; in steam_remove()
1311 steam->client_opened = 0; in steam_remove()
1312 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_remove()
1325 spin_lock_irqsave(&steam->lock, flags); in steam_do_connect_event()
1326 changed = steam->connected != connected; in steam_do_connect_event()
1327 steam->connected = connected; in steam_do_connect_event()
1328 spin_unlock_irqrestore(&steam->lock, flags); in steam_do_connect_event()
1330 if (changed && schedule_work(&steam->work_connect) == 0) in steam_do_connect_event()
1337 * Clamp the values to 32767..-32767 so that the range is
1344 return x == -32768 ? -32767 : x; in steam_le16()
1353 * -------+-------+-----------+--------------------------
1354 * 4-7 | u32 | -- | sequence number
1355 * 8-10 | 24bit | see below | buttons
1358 * 13-15 | -- | -- | always 0
1359 * 16-17 | s16 | ABS_X/ABS_HAT0X | X value
1360 * 18-19 | s16 | ABS_Y/ABS_HAT0Y | Y value
1361 * 20-21 | s16 | ABS_RX | right-pad X value
1362 * 22-23 | s16 | ABS_RY | right-pad Y value
1363 * 24-25 | s16 | -- | * left trigger
1364 * 26-27 | s16 | -- | * right trigger
1365 * 28-29 | s16 | -- | * accelerometer X value
1366 * 30-31 | s16 | -- | * accelerometer Y value
1367 * 32-33 | s16 | -- | * accelerometer Z value
1368 * 34-35 | s16 | -- | gyro X value
1369 * 36-36 | s16 | -- | gyro Y value
1370 * 38-39 | s16 | -- | gyro Z value
1371 * 40-41 | s16 | -- | quaternion W value
1372 * 42-43 | s16 | -- | quaternion X value
1373 * 44-45 | s16 | -- | quaternion Y value
1374 * 46-47 | s16 | -- | quaternion Z value
1375 * 48-49 | -- | -- | always 0
1376 * 50-51 | s16 | -- | * left trigger (uncalibrated)
1377 * 52-53 | s16 | -- | * right trigger (uncalibrated)
1378 * 54-55 | s16 | -- | * joystick X value (uncalibrated)
1379 * 56-57 | s16 | -- | * joystick Y value (uncalibrated)
1380 * 58-59 | s16 | -- | * left-pad X value
1381 * 60-61 | s16 | -- | * left-pad Y value
1382 * 62-63 | u16 | -- | * battery voltage
1386 * ------+------------+--------------------------------
1395 * 9.0 | BTN_DPAD_UP | left-pad up
1396 * 9.1 | BTN_DPAD_RIGHT | left-pad right
1397 * 9.2 | BTN_DPAD_LEFT | left-pad left
1398 * 9.3 | BTN_DPAD_DOWN | left-pad down
1404 * 10.1 | -- | left-pad clicked
1405 * 10.2 | BTN_THUMBR | right-pad clicked
1406 * 10.3 | BTN_THUMB | left-pad touched (but see explanation below)
1407 * 10.4 | BTN_THUMB2 | right-pad touched
1408 * 10.5 | -- | unknown
1410 * 10.7 | -- | lpad_and_joy
1439 y = -steam_le16(data + 18); in steam_do_input_event()
1455 input_report_abs(input, ABS_RY, -steam_le16(data + 22)); in steam_do_input_event()
1486 * -------+-------+-----------+--------------------------
1487 * 4-7 | u32 | -- | sequence number
1488 * 8-15 | u64 | see below | buttons
1489 * 16-17 | s16 | ABS_HAT0X | left-pad X value
1490 * 18-19 | s16 | ABS_HAT0Y | left-pad Y value
1491 * 20-21 | s16 | ABS_HAT1X | right-pad X value
1492 * 22-23 | s16 | ABS_HAT1Y | right-pad Y value
1493 * 24-25 | s16 | IMU ABS_X | accelerometer X value
1494 * 26-27 | s16 | IMU ABS_Z | accelerometer Y value
1495 * 28-29 | s16 | IMU ABS_Y | accelerometer Z value
1496 * 30-31 | s16 | IMU ABS_RX | gyro X value
1497 * 32-33 | s16 | IMU ABS_RZ | gyro Y value
1498 * 34-35 | s16 | IMU ABS_RY | gyro Z value
1499 * 36-37 | s16 | -- | quaternion W value
1500 * 38-39 | s16 | -- | quaternion X value
1501 * 40-41 | s16 | -- | quaternion Y value
1502 * 42-43 | s16 | -- | quaternion Z value
1503 * 44-45 | u16 | ABS_HAT2Y | left trigger (uncalibrated)
1504 * 46-47 | u16 | ABS_HAT2X | right trigger (uncalibrated)
1505 * 48-49 | s16 | ABS_X | left joystick X
1506 * 50-51 | s16 | ABS_Y | left joystick Y
1507 * 52-53 | s16 | ABS_RX | right joystick X
1508 * 54-55 | s16 | ABS_RY | right joystick Y
1509 * 56-57 | u16 | -- | left pad pressure
1510 * 58-59 | u16 | -- | right pad pressure
1514 * ------+------------+--------------------------------
1523 * 9.0 | BTN_DPAD_UP | left-pad up
1524 * 9.1 | BTN_DPAD_RIGHT | left-pad right
1525 * 9.2 | BTN_DPAD_LEFT | left-pad left
1526 * 9.3 | BTN_DPAD_DOWN | left-pad down
1534 * 10.3 | -- | left pad touched
1535 * 10.4 | -- | right pad touched
1536 * 10.5 | -- | unknown
1538 * 10.7 | -- | unknown
1539 * 11.0 | -- | unknown
1540 * 11.1 | -- | unknown
1542 * 11.3 | -- | unknown
1543 * 11.4 | -- | unknown
1544 * 11.5 | -- | unknown
1545 * 11.6 | -- | unknown
1546 * 11.7 | -- | unknown
1547 * 12.0 | -- | unknown
1548 * 12.1 | -- | unknown
1549 * 12.2 | -- | unknown
1550 * 12.3 | -- | unknown
1551 * 12.4 | -- | unknown
1552 * 12.5 | -- | unknown
1553 * 12.6 | -- | unknown
1554 * 12.7 | -- | unknown
1555 * 13.0 | -- | unknown
1558 * 13.3 | -- | unknown
1559 * 13.4 | -- | unknown
1560 * 13.5 | -- | unknown
1561 * 13.6 | -- | left joystick touched
1562 * 13.7 | -- | right joystick touched
1563 * 14.0 | -- | unknown
1564 * 14.1 | -- | unknown
1566 * 14.3 | -- | unknown
1567 * 14.4 | -- | unknown
1568 * 14.5 | -- | unknown
1569 * 14.6 | -- | unknown
1570 * 14.7 | -- | unknown
1571 * 15.0 | -- | unknown
1572 * 15.1 | -- | unknown
1573 * 15.2 | -- | unknown
1574 * 15.3 | -- | unknown
1575 * 15.4 | -- | unknown
1576 * 15.5 | -- | unknown
1577 * 15.6 | -- | unknown
1578 * 15.7 | -- | unknown
1593 if (!(b9 & BIT(6)) && steam->did_mode_switch) { in steam_do_deck_input_event()
1594 steam->did_mode_switch = false; in steam_do_deck_input_event()
1595 cancel_delayed_work_sync(&steam->mode_switch); in steam_do_deck_input_event()
1596 } else if (!steam->client_opened && (b9 & BIT(6)) && !steam->did_mode_switch) { in steam_do_deck_input_event()
1597 steam->did_mode_switch = true; in steam_do_deck_input_event()
1598 schedule_delayed_work(&steam->mode_switch, 45 * HZ / 100); in steam_do_deck_input_event()
1601 if (!steam->gamepad_mode) in steam_do_deck_input_event()
1624 input_report_abs(input, ABS_Y, -steam_le16(data + 50)); in steam_do_deck_input_event()
1626 input_report_abs(input, ABS_RY, -steam_le16(data + 54)); in steam_do_deck_input_event()
1660 struct input_dev *sensors, u8 *data) in steam_do_deck_sensors_event() argument
1664 * with a jitter of +/- 4 ms even though the USB descriptor claims in steam_do_deck_sensors_event()
1669 steam->sensor_timestamp_us += 4000; in steam_do_deck_sensors_event()
1671 if (!steam->gamepad_mode) in steam_do_deck_sensors_event()
1674 input_event(sensors, EV_MSC, MSC_TIMESTAMP, steam->sensor_timestamp_us); in steam_do_deck_sensors_event()
1675 input_report_abs(sensors, ABS_X, steam_le16(data + 24)); in steam_do_deck_sensors_event()
1676 input_report_abs(sensors, ABS_Z, -steam_le16(data + 26)); in steam_do_deck_sensors_event()
1677 input_report_abs(sensors, ABS_Y, steam_le16(data + 28)); in steam_do_deck_sensors_event()
1678 input_report_abs(sensors, ABS_RX, steam_le16(data + 30)); in steam_do_deck_sensors_event()
1679 input_report_abs(sensors, ABS_RZ, -steam_le16(data + 32)); in steam_do_deck_sensors_event()
1680 input_report_abs(sensors, ABS_RY, steam_le16(data + 34)); in steam_do_deck_sensors_event()
1682 input_sync(sensors); in steam_do_deck_sensors_event()
1689 * -------+-------+---------------------------
1690 * 4-7 | u32 | sequence number
1691 * 8-11 | -- | always 0
1692 * 12-13 | u16 | voltage (mV)
1705 battery = rcu_dereference(steam->battery); in steam_do_battery_event()
1707 spin_lock_irqsave(&steam->lock, flags); in steam_do_battery_event()
1708 steam->voltage = volts; in steam_do_battery_event()
1709 steam->battery_charge = batt; in steam_do_battery_event()
1710 spin_unlock_irqrestore(&steam->lock, flags); in steam_do_battery_event()
1722 struct input_dev *sensors; in steam_raw_event() local
1728 if (steam->client_opened) in steam_raw_event()
1729 hid_input_report(steam->client_hdev, HID_FEATURE_REPORT, in steam_raw_event()
1732 * All messages are size=64, all values little-endian. in steam_raw_event()
1735 * -------+-------------------------------------------- in steam_raw_event()
1736 * 0-1 | always 0x01, 0x00, maybe protocol version? in steam_raw_event()
1739 * 4-n | payload data, depends on the type in steam_raw_event()
1753 if (steam->client_opened) in steam_raw_event()
1756 input = rcu_dereference(steam->input); in steam_raw_event()
1762 if (steam->client_opened) in steam_raw_event()
1765 input = rcu_dereference(steam->input); in steam_raw_event()
1768 sensors = rcu_dereference(steam->sensors); in steam_raw_event()
1769 if (likely(sensors)) in steam_raw_event()
1770 steam_do_deck_sensors_event(steam, sensors, data); in steam_raw_event()
1789 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_raw_event()
1791 battery = rcu_dereference(steam->battery); in steam_raw_event()
1819 if (!steam->client_opened) in steam_param_set_lizard_mode()
1856 .name = "hid-steam",