Lines Matching +full:input +full:- +full:value

1 // SPDX-License-Identifier: GPL-2.0+
18 * This driver will disable the lizard mode when the input device is opened
19 * and re-enable it when the input device is closed, so as not to break user
23 * the hidraw interface directly to create input devices (XTest, uinput...).
26 * - it will not send any command to the controller.
27 * - this input device will be removed, to avoid double input of the same
29 * When the client is closed, this input device will be created again.
31 * For additional functions, such as changing the right-pad margin or switching
32 * the led, you can use the user-space tool at:
38 #include <linux/input.h>
46 #include "hid-ids.h"
128 struct input_dev __rcu *input; member
150 r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0]; in steam_recv_report()
152 hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted - nothing to read\n"); in steam_recv_report()
153 return -EINVAL; in steam_recv_report()
157 return -EINVAL; in steam_recv_report()
161 return -ENOMEM; in steam_recv_report()
169 ret = hid_hw_raw_request(steam->hdev, 0x00, in steam_recv_report()
173 memcpy(data, buf + 1, min(size, ret - 1)); in steam_recv_report()
186 r = steam->hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0]; in steam_send_report()
188 hid_err(steam->hdev, "No HID_FEATURE_REPORT submitted - nothing to read\n"); in steam_send_report()
189 return -EINVAL; in steam_send_report()
193 return -EINVAL; in steam_send_report()
197 return -ENOMEM; in steam_send_report()
209 ret = hid_hw_raw_request(steam->hdev, 0, in steam_send_report()
212 if (ret != -EPIPE) in steam_send_report()
215 } while (--retries); in steam_send_report()
219 hid_err(steam->hdev, "%s: error %d (%*ph)\n", __func__, in steam_send_report()
281 return -EIO; in steam_get_serial()
283 strscpy(steam->serial_no, reply + 3, sizeof(steam->serial_no)); in steam_get_serial()
319 steam_haptic_rumble(steam, 0, steam->rumble_left, in steam_haptic_rumble_cb()
320 steam->rumble_right, 2, 0); in steam_haptic_rumble_cb()
329 steam->rumble_left = effect->u.rumble.strong_magnitude; in steam_play_effect()
330 steam->rumble_right = effect->u.rumble.weak_magnitude; in steam_play_effect()
332 return schedule_work(&steam->rumble_work); in steam_play_effect()
347 cancel_delayed_work_sync(&steam->heartbeat); in steam_set_lizard_mode()
352 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_set_lizard_mode()
364 if (!work_busy(&steam->heartbeat.work)) in steam_set_lizard_mode()
365 schedule_delayed_work(&steam->heartbeat, 5 * HZ); in steam_set_lizard_mode()
380 mutex_lock(&steam->mutex); in steam_input_open()
381 if (!steam->client_opened && lizard_mode) in steam_input_open()
383 mutex_unlock(&steam->mutex); in steam_input_open()
391 mutex_lock(&steam->mutex); in steam_input_close()
392 if (!steam->client_opened && lizard_mode) in steam_input_close()
394 mutex_unlock(&steam->mutex); in steam_input_close()
414 spin_lock_irqsave(&steam->lock, flags); in steam_battery_get_property()
415 volts = steam->voltage; in steam_battery_get_property()
416 batt = steam->battery_charge; in steam_battery_get_property()
417 spin_unlock_irqrestore(&steam->lock, flags); in steam_battery_get_property()
421 val->intval = 1; in steam_battery_get_property()
424 val->intval = POWER_SUPPLY_SCOPE_DEVICE; in steam_battery_get_property()
427 val->intval = volts * 1000; /* mV -> uV */ in steam_battery_get_property()
430 val->intval = batt; in steam_battery_get_property()
433 ret = -EINVAL; in steam_battery_get_property()
446 steam->battery_desc.type = POWER_SUPPLY_TYPE_BATTERY; in steam_battery_register()
447 steam->battery_desc.properties = steam_battery_props; in steam_battery_register()
448 steam->battery_desc.num_properties = ARRAY_SIZE(steam_battery_props); in steam_battery_register()
449 steam->battery_desc.get_property = steam_battery_get_property; in steam_battery_register()
450 steam->battery_desc.name = devm_kasprintf(&steam->hdev->dev, in steam_battery_register()
451 GFP_KERNEL, "steam-controller-%s-battery", in steam_battery_register()
452 steam->serial_no); in steam_battery_register()
453 if (!steam->battery_desc.name) in steam_battery_register()
454 return -ENOMEM; in steam_battery_register()
457 spin_lock_irqsave(&steam->lock, flags); in steam_battery_register()
458 steam->voltage = 3000; in steam_battery_register()
459 steam->battery_charge = 100; in steam_battery_register()
460 spin_unlock_irqrestore(&steam->lock, flags); in steam_battery_register()
462 battery = power_supply_register(&steam->hdev->dev, in steam_battery_register()
463 &steam->battery_desc, &battery_cfg); in steam_battery_register()
466 hid_err(steam->hdev, in steam_battery_register()
471 rcu_assign_pointer(steam->battery, battery); in steam_battery_register()
472 power_supply_powers(battery, &steam->hdev->dev); in steam_battery_register()
478 struct hid_device *hdev = steam->hdev; in steam_input_register()
479 struct input_dev *input; in steam_input_register() local
483 input = rcu_dereference(steam->input); in steam_input_register()
485 if (input) { in steam_input_register()
490 input = input_allocate_device(); in steam_input_register()
491 if (!input) in steam_input_register()
492 return -ENOMEM; in steam_input_register()
494 input_set_drvdata(input, steam); in steam_input_register()
495 input->dev.parent = &hdev->dev; in steam_input_register()
496 input->open = steam_input_open; in steam_input_register()
497 input->close = steam_input_close; in steam_input_register()
499 input->name = (steam->quirks & STEAM_QUIRK_WIRELESS) ? "Wireless Steam Controller" : in steam_input_register()
500 (steam->quirks & STEAM_QUIRK_DECK) ? "Steam Deck" : in steam_input_register()
502 input->phys = hdev->phys; in steam_input_register()
503 input->uniq = steam->serial_no; in steam_input_register()
504 input->id.bustype = hdev->bus; in steam_input_register()
505 input->id.vendor = hdev->vendor; in steam_input_register()
506 input->id.product = hdev->product; in steam_input_register()
507 input->id.version = hdev->version; in steam_input_register()
509 input_set_capability(input, EV_KEY, BTN_TR2); in steam_input_register()
510 input_set_capability(input, EV_KEY, BTN_TL2); in steam_input_register()
511 input_set_capability(input, EV_KEY, BTN_TR); in steam_input_register()
512 input_set_capability(input, EV_KEY, BTN_TL); in steam_input_register()
513 input_set_capability(input, EV_KEY, BTN_Y); in steam_input_register()
514 input_set_capability(input, EV_KEY, BTN_B); in steam_input_register()
515 input_set_capability(input, EV_KEY, BTN_X); in steam_input_register()
516 input_set_capability(input, EV_KEY, BTN_A); in steam_input_register()
517 input_set_capability(input, EV_KEY, BTN_DPAD_UP); in steam_input_register()
518 input_set_capability(input, EV_KEY, BTN_DPAD_RIGHT); in steam_input_register()
519 input_set_capability(input, EV_KEY, BTN_DPAD_LEFT); in steam_input_register()
520 input_set_capability(input, EV_KEY, BTN_DPAD_DOWN); in steam_input_register()
521 input_set_capability(input, EV_KEY, BTN_SELECT); in steam_input_register()
522 input_set_capability(input, EV_KEY, BTN_MODE); in steam_input_register()
523 input_set_capability(input, EV_KEY, BTN_START); in steam_input_register()
524 input_set_capability(input, EV_KEY, BTN_THUMBR); in steam_input_register()
525 input_set_capability(input, EV_KEY, BTN_THUMBL); in steam_input_register()
526 input_set_capability(input, EV_KEY, BTN_THUMB); in steam_input_register()
527 input_set_capability(input, EV_KEY, BTN_THUMB2); in steam_input_register()
528 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
529 input_set_capability(input, EV_KEY, BTN_BASE); in steam_input_register()
530 input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY1); in steam_input_register()
531 input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY2); in steam_input_register()
532 input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY3); in steam_input_register()
533 input_set_capability(input, EV_KEY, BTN_TRIGGER_HAPPY4); in steam_input_register()
535 input_set_capability(input, EV_KEY, BTN_GEAR_DOWN); in steam_input_register()
536 input_set_capability(input, EV_KEY, BTN_GEAR_UP); in steam_input_register()
539 input_set_abs_params(input, ABS_X, -32767, 32767, 0, 0); in steam_input_register()
540 input_set_abs_params(input, ABS_Y, -32767, 32767, 0, 0); in steam_input_register()
542 input_set_abs_params(input, ABS_HAT0X, -32767, 32767, in steam_input_register()
544 input_set_abs_params(input, ABS_HAT0Y, -32767, 32767, in steam_input_register()
547 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
548 input_set_abs_params(input, ABS_HAT2Y, 0, 32767, 0, 0); in steam_input_register()
549 input_set_abs_params(input, ABS_HAT2X, 0, 32767, 0, 0); in steam_input_register()
551 input_set_abs_params(input, ABS_RX, -32767, 32767, 0, 0); in steam_input_register()
552 input_set_abs_params(input, ABS_RY, -32767, 32767, 0, 0); in steam_input_register()
554 input_set_abs_params(input, ABS_HAT1X, -32767, 32767, in steam_input_register()
556 input_set_abs_params(input, ABS_HAT1Y, -32767, 32767, in steam_input_register()
559 input_abs_set_res(input, ABS_X, STEAM_DECK_JOYSTICK_RESOLUTION); in steam_input_register()
560 input_abs_set_res(input, ABS_Y, STEAM_DECK_JOYSTICK_RESOLUTION); in steam_input_register()
561 input_abs_set_res(input, ABS_RX, STEAM_DECK_JOYSTICK_RESOLUTION); in steam_input_register()
562 input_abs_set_res(input, ABS_RY, STEAM_DECK_JOYSTICK_RESOLUTION); in steam_input_register()
563 input_abs_set_res(input, ABS_HAT1X, STEAM_PAD_RESOLUTION); in steam_input_register()
564 input_abs_set_res(input, ABS_HAT1Y, STEAM_PAD_RESOLUTION); in steam_input_register()
565 input_abs_set_res(input, ABS_HAT2Y, STEAM_DECK_TRIGGER_RESOLUTION); in steam_input_register()
566 input_abs_set_res(input, ABS_HAT2X, STEAM_DECK_TRIGGER_RESOLUTION); in steam_input_register()
568 input_set_abs_params(input, ABS_HAT2Y, 0, 255, 0, 0); in steam_input_register()
569 input_set_abs_params(input, ABS_HAT2X, 0, 255, 0, 0); in steam_input_register()
571 input_set_abs_params(input, ABS_RX, -32767, 32767, in steam_input_register()
573 input_set_abs_params(input, ABS_RY, -32767, 32767, in steam_input_register()
576 input_abs_set_res(input, ABS_X, STEAM_JOYSTICK_RESOLUTION); in steam_input_register()
577 input_abs_set_res(input, ABS_Y, STEAM_JOYSTICK_RESOLUTION); in steam_input_register()
578 input_abs_set_res(input, ABS_RX, STEAM_PAD_RESOLUTION); in steam_input_register()
579 input_abs_set_res(input, ABS_RY, STEAM_PAD_RESOLUTION); in steam_input_register()
580 input_abs_set_res(input, ABS_HAT2Y, STEAM_TRIGGER_RESOLUTION); in steam_input_register()
581 input_abs_set_res(input, ABS_HAT2X, STEAM_TRIGGER_RESOLUTION); in steam_input_register()
583 input_abs_set_res(input, ABS_HAT0X, STEAM_PAD_RESOLUTION); in steam_input_register()
584 input_abs_set_res(input, ABS_HAT0Y, STEAM_PAD_RESOLUTION); in steam_input_register()
587 if (steam->quirks & STEAM_QUIRK_DECK) { in steam_input_register()
588 input_set_capability(input, EV_FF, FF_RUMBLE); in steam_input_register()
589 ret = input_ff_create_memless(input, NULL, steam_play_effect); in steam_input_register()
595 ret = input_register_device(input); in steam_input_register()
599 rcu_assign_pointer(steam->input, input); in steam_input_register()
603 input_free_device(input); in steam_input_register()
609 struct input_dev *input; in steam_input_unregister() local
611 input = rcu_dereference(steam->input); in steam_input_unregister()
613 if (!input) in steam_input_unregister()
615 RCU_INIT_POINTER(steam->input, NULL); in steam_input_unregister()
617 input_unregister_device(input); in steam_input_unregister()
625 battery = rcu_dereference(steam->battery); in steam_battery_unregister()
630 RCU_INIT_POINTER(steam->battery, NULL); in steam_battery_unregister()
646 if (!steam->serial_no[0]) { in steam_register()
651 mutex_lock(&steam->mutex); in steam_register()
653 strscpy(steam->serial_no, "XXXXXXXXXX", in steam_register()
654 sizeof(steam->serial_no)); in steam_register()
655 mutex_unlock(&steam->mutex); in steam_register()
657 hid_info(steam->hdev, "Steam Controller '%s' connected", in steam_register()
658 steam->serial_no); in steam_register()
661 if (steam->quirks & STEAM_QUIRK_WIRELESS) in steam_register()
665 if (list_empty(&steam->list)) in steam_register()
666 list_add(&steam->list, &steam_devices); in steam_register()
670 mutex_lock(&steam->mutex); in steam_register()
671 client_opened = steam->client_opened; in steam_register()
674 mutex_unlock(&steam->mutex); in steam_register()
688 if (steam->serial_no[0]) { in steam_unregister()
689 hid_info(steam->hdev, "Steam Controller '%s' disconnected", in steam_unregister()
690 steam->serial_no); in steam_unregister()
692 list_del_init(&steam->list); in steam_unregister()
694 steam->serial_no[0] = 0; in steam_unregister()
706 spin_lock_irqsave(&steam->lock, flags); in steam_work_connect_cb()
707 connected = steam->connected; in steam_work_connect_cb()
708 spin_unlock_irqrestore(&steam->lock, flags); in steam_work_connect_cb()
713 hid_err(steam->hdev, in steam_work_connect_cb()
733 * 1-4: slots where up to 4 real game pads will be connected to. in steam_is_valve_interface()
737 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; in steam_is_valve_interface()
738 return !list_empty(&rep_enum->report_list); in steam_is_valve_interface()
746 mutex_lock(&steam->mutex); in steam_lizard_mode_heartbeat()
747 if (!steam->client_opened && steam->client_hdev) { in steam_lizard_mode_heartbeat()
752 schedule_delayed_work(&steam->heartbeat, 5 * HZ); in steam_lizard_mode_heartbeat()
754 mutex_unlock(&steam->mutex); in steam_lizard_mode_heartbeat()
759 struct steam_device *steam = hdev->driver_data; in steam_client_ll_parse()
761 return hid_parse_report(hdev, steam->hdev->dev_rdesc, in steam_client_ll_parse()
762 steam->hdev->dev_rsize); in steam_client_ll_parse()
776 struct steam_device *steam = hdev->driver_data; in steam_client_ll_open()
778 mutex_lock(&steam->mutex); in steam_client_ll_open()
779 steam->client_opened = true; in steam_client_ll_open()
780 mutex_unlock(&steam->mutex); in steam_client_ll_open()
789 struct steam_device *steam = hdev->driver_data; in steam_client_ll_close()
794 spin_lock_irqsave(&steam->lock, flags); in steam_client_ll_close()
795 connected = steam->connected; in steam_client_ll_close()
796 spin_unlock_irqrestore(&steam->lock, flags); in steam_client_ll_close()
798 mutex_lock(&steam->mutex); in steam_client_ll_close()
799 steam->client_opened = false; in steam_client_ll_close()
802 mutex_unlock(&steam->mutex); in steam_client_ll_close()
813 struct steam_device *steam = hdev->driver_data; in steam_client_ll_raw_request()
815 return hid_hw_raw_request(steam->hdev, reportnum, buf, count, in steam_client_ll_raw_request()
836 client_hdev->ll_driver = &steam_client_ll_driver; in steam_create_client_hid()
837 client_hdev->dev.parent = hdev->dev.parent; in steam_create_client_hid()
838 client_hdev->bus = hdev->bus; in steam_create_client_hid()
839 client_hdev->vendor = hdev->vendor; in steam_create_client_hid()
840 client_hdev->product = hdev->product; in steam_create_client_hid()
841 client_hdev->version = hdev->version; in steam_create_client_hid()
842 client_hdev->type = hdev->type; in steam_create_client_hid()
843 client_hdev->country = hdev->country; in steam_create_client_hid()
844 strscpy(client_hdev->name, hdev->name, in steam_create_client_hid()
845 sizeof(client_hdev->name)); in steam_create_client_hid()
846 strscpy(client_hdev->phys, hdev->phys, in steam_create_client_hid()
847 sizeof(client_hdev->phys)); in steam_create_client_hid()
853 client_hdev->group = HID_GROUP_STEAM; in steam_create_client_hid()
874 if (hdev->group == HID_GROUP_STEAM) in steam_probe()
877 * The non-valve interfaces (mouse and keyboard emulation) are in steam_probe()
883 steam = devm_kzalloc(&hdev->dev, sizeof(*steam), GFP_KERNEL); in steam_probe()
885 ret = -ENOMEM; in steam_probe()
888 steam->hdev = hdev; in steam_probe()
890 spin_lock_init(&steam->lock); in steam_probe()
891 mutex_init(&steam->mutex); in steam_probe()
892 steam->quirks = id->driver_data; in steam_probe()
893 INIT_WORK(&steam->work_connect, steam_work_connect_cb); in steam_probe()
894 INIT_LIST_HEAD(&steam->list); in steam_probe()
895 INIT_DEFERRABLE_WORK(&steam->heartbeat, steam_lizard_mode_heartbeat); in steam_probe()
896 INIT_WORK(&steam->rumble_work, steam_haptic_rumble_cb); in steam_probe()
898 steam->client_hdev = steam_create_client_hid(hdev); in steam_probe()
899 if (IS_ERR(steam->client_hdev)) { in steam_probe()
900 ret = PTR_ERR(steam->client_hdev); in steam_probe()
903 steam->client_hdev->driver_data = steam; in steam_probe()
913 ret = hid_add_device(steam->client_hdev); in steam_probe()
925 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_probe()
928 steam->connected = false; in steam_probe()
932 steam->connected = true; in steam_probe()
949 hid_destroy_device(steam->client_hdev); in steam_probe()
951 cancel_work_sync(&steam->work_connect); in steam_probe()
952 cancel_delayed_work_sync(&steam->heartbeat); in steam_probe()
953 cancel_work_sync(&steam->rumble_work); in steam_probe()
964 if (!steam || hdev->group == HID_GROUP_STEAM) { in steam_remove()
969 hid_destroy_device(steam->client_hdev); in steam_remove()
970 mutex_lock(&steam->mutex); in steam_remove()
971 steam->client_hdev = NULL; in steam_remove()
972 steam->client_opened = false; in steam_remove()
973 cancel_delayed_work_sync(&steam->heartbeat); in steam_remove()
974 mutex_unlock(&steam->mutex); in steam_remove()
975 cancel_work_sync(&steam->work_connect); in steam_remove()
976 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_remove()
989 spin_lock_irqsave(&steam->lock, flags); in steam_do_connect_event()
990 changed = steam->connected != connected; in steam_do_connect_event()
991 steam->connected = connected; in steam_do_connect_event()
992 spin_unlock_irqrestore(&steam->lock, flags); in steam_do_connect_event()
994 if (changed && schedule_work(&steam->work_connect) == 0) in steam_do_connect_event()
1000 * Some input data in the protocol has the opposite sign.
1001 * Clamp the values to 32767..-32767 so that the range is
1008 return x == -32768 ? -32767 : x; in steam_le16()
1017 * -------+-------+-----------+--------------------------
1018 * 4-7 | u32 | -- | sequence number
1019 * 8-10 | 24bit | see below | buttons
1022 * 13-15 | -- | -- | always 0
1023 * 16-17 | s16 | ABS_X/ABS_HAT0X | X value
1024 * 18-19 | s16 | ABS_Y/ABS_HAT0Y | Y value
1025 * 20-21 | s16 | ABS_RX | right-pad X value
1026 * 22-23 | s16 | ABS_RY | right-pad Y value
1027 * 24-25 | s16 | -- | * left trigger
1028 * 26-27 | s16 | -- | * right trigger
1029 * 28-29 | s16 | -- | * accelerometer X value
1030 * 30-31 | s16 | -- | * accelerometer Y value
1031 * 32-33 | s16 | -- | * accelerometer Z value
1032 * 34-35 | s16 | -- | gyro X value
1033 * 36-36 | s16 | -- | gyro Y value
1034 * 38-39 | s16 | -- | gyro Z value
1035 * 40-41 | s16 | -- | quaternion W value
1036 * 42-43 | s16 | -- | quaternion X value
1037 * 44-45 | s16 | -- | quaternion Y value
1038 * 46-47 | s16 | -- | quaternion Z value
1039 * 48-49 | -- | -- | always 0
1040 * 50-51 | s16 | -- | * left trigger (uncalibrated)
1041 * 52-53 | s16 | -- | * right trigger (uncalibrated)
1042 * 54-55 | s16 | -- | * joystick X value (uncalibrated)
1043 * 56-57 | s16 | -- | * joystick Y value (uncalibrated)
1044 * 58-59 | s16 | -- | * left-pad X value
1045 * 60-61 | s16 | -- | * left-pad Y value
1046 * 62-63 | u16 | -- | * battery voltage
1050 * ------+------------+--------------------------------
1059 * 9.0 | BTN_DPAD_UP | left-pad up
1060 * 9.1 | BTN_DPAD_RIGHT | left-pad right
1061 * 9.2 | BTN_DPAD_LEFT | left-pad left
1062 * 9.3 | BTN_DPAD_DOWN | left-pad down
1068 * 10.1 | -- | left-pad clicked
1069 * 10.2 | BTN_THUMBR | right-pad clicked
1070 * 10.3 | BTN_THUMB | left-pad touched (but see explanation below)
1071 * 10.4 | BTN_THUMB2 | right-pad touched
1072 * 10.5 | -- | unknown
1074 * 10.7 | -- | lpad_and_joy
1078 struct input_dev *input, u8 *data) in steam_do_input_event() argument
1089 input_report_abs(input, ABS_HAT2Y, data[11]); in steam_do_input_event()
1090 input_report_abs(input, ABS_HAT2X, data[12]); in steam_do_input_event()
1103 y = -steam_le16(data + 18); in steam_do_input_event()
1105 input_report_abs(input, lpad_touched ? ABS_HAT0X : ABS_X, x); in steam_do_input_event()
1106 input_report_abs(input, lpad_touched ? ABS_HAT0Y : ABS_Y, y); in steam_do_input_event()
1109 input_report_abs(input, ABS_X, 0); in steam_do_input_event()
1110 input_report_abs(input, ABS_Y, 0); in steam_do_input_event()
1114 input_report_abs(input, ABS_HAT0X, 0); in steam_do_input_event()
1115 input_report_abs(input, ABS_HAT0Y, 0); in steam_do_input_event()
1118 input_report_abs(input, ABS_RX, steam_le16(data + 20)); in steam_do_input_event()
1119 input_report_abs(input, ABS_RY, -steam_le16(data + 22)); in steam_do_input_event()
1121 input_event(input, EV_KEY, BTN_TR2, !!(b8 & BIT(0))); in steam_do_input_event()
1122 input_event(input, EV_KEY, BTN_TL2, !!(b8 & BIT(1))); in steam_do_input_event()
1123 input_event(input, EV_KEY, BTN_TR, !!(b8 & BIT(2))); in steam_do_input_event()
1124 input_event(input, EV_KEY, BTN_TL, !!(b8 & BIT(3))); in steam_do_input_event()
1125 input_event(input, EV_KEY, BTN_Y, !!(b8 & BIT(4))); in steam_do_input_event()
1126 input_event(input, EV_KEY, BTN_B, !!(b8 & BIT(5))); in steam_do_input_event()
1127 input_event(input, EV_KEY, BTN_X, !!(b8 & BIT(6))); in steam_do_input_event()
1128 input_event(input, EV_KEY, BTN_A, !!(b8 & BIT(7))); in steam_do_input_event()
1129 input_event(input, EV_KEY, BTN_SELECT, !!(b9 & BIT(4))); in steam_do_input_event()
1130 input_event(input, EV_KEY, BTN_MODE, !!(b9 & BIT(5))); in steam_do_input_event()
1131 input_event(input, EV_KEY, BTN_START, !!(b9 & BIT(6))); in steam_do_input_event()
1132 input_event(input, EV_KEY, BTN_GEAR_DOWN, !!(b9 & BIT(7))); in steam_do_input_event()
1133 input_event(input, EV_KEY, BTN_GEAR_UP, !!(b10 & BIT(0))); in steam_do_input_event()
1134 input_event(input, EV_KEY, BTN_THUMBR, !!(b10 & BIT(2))); in steam_do_input_event()
1135 input_event(input, EV_KEY, BTN_THUMBL, !!(b10 & BIT(6))); in steam_do_input_event()
1136 input_event(input, EV_KEY, BTN_THUMB, lpad_touched || lpad_and_joy); in steam_do_input_event()
1137 input_event(input, EV_KEY, BTN_THUMB2, !!(b10 & BIT(4))); in steam_do_input_event()
1138 input_event(input, EV_KEY, BTN_DPAD_UP, !!(b9 & BIT(0))); in steam_do_input_event()
1139 input_event(input, EV_KEY, BTN_DPAD_RIGHT, !!(b9 & BIT(1))); in steam_do_input_event()
1140 input_event(input, EV_KEY, BTN_DPAD_LEFT, !!(b9 & BIT(2))); in steam_do_input_event()
1141 input_event(input, EV_KEY, BTN_DPAD_DOWN, !!(b9 & BIT(3))); in steam_do_input_event()
1143 input_sync(input); in steam_do_input_event()
1150 * -------+-------+-----------+--------------------------
1151 * 4-7 | u32 | -- | sequence number
1152 * 8-15 | u64 | see below | buttons
1153 * 16-17 | s16 | ABS_HAT0X | left-pad X value
1154 * 18-19 | s16 | ABS_HAT0Y | left-pad Y value
1155 * 20-21 | s16 | ABS_HAT1X | right-pad X value
1156 * 22-23 | s16 | ABS_HAT1Y | right-pad Y value
1157 * 24-25 | s16 | -- | accelerometer X value
1158 * 26-27 | s16 | -- | accelerometer Y value
1159 * 28-29 | s16 | -- | accelerometer Z value
1160 * 30-31 | s16 | -- | gyro X value
1161 * 32-33 | s16 | -- | gyro Y value
1162 * 34-35 | s16 | -- | gyro Z value
1163 * 36-37 | s16 | -- | quaternion W value
1164 * 38-39 | s16 | -- | quaternion X value
1165 * 40-41 | s16 | -- | quaternion Y value
1166 * 42-43 | s16 | -- | quaternion Z value
1167 * 44-45 | u16 | ABS_HAT2Y | left trigger (uncalibrated)
1168 * 46-47 | u16 | ABS_HAT2X | right trigger (uncalibrated)
1169 * 48-49 | s16 | ABS_X | left joystick X
1170 * 50-51 | s16 | ABS_Y | left joystick Y
1171 * 52-53 | s16 | ABS_RX | right joystick X
1172 * 54-55 | s16 | ABS_RY | right joystick Y
1173 * 56-57 | u16 | -- | left pad pressure
1174 * 58-59 | u16 | -- | right pad pressure
1178 * ------+------------+--------------------------------
1187 * 9.0 | BTN_DPAD_UP | left-pad up
1188 * 9.1 | BTN_DPAD_RIGHT | left-pad right
1189 * 9.2 | BTN_DPAD_LEFT | left-pad left
1190 * 9.3 | BTN_DPAD_DOWN | left-pad down
1198 * 10.3 | -- | left pad touched
1199 * 10.4 | -- | right pad touched
1200 * 10.5 | -- | unknown
1202 * 10.7 | -- | unknown
1203 * 11.0 | -- | unknown
1204 * 11.1 | -- | unknown
1206 * 11.3 | -- | unknown
1207 * 11.4 | -- | unknown
1208 * 11.5 | -- | unknown
1209 * 11.6 | -- | unknown
1210 * 11.7 | -- | unknown
1211 * 12.0 | -- | unknown
1212 * 12.1 | -- | unknown
1213 * 12.2 | -- | unknown
1214 * 12.3 | -- | unknown
1215 * 12.4 | -- | unknown
1216 * 12.5 | -- | unknown
1217 * 12.6 | -- | unknown
1218 * 12.7 | -- | unknown
1219 * 13.0 | -- | unknown
1222 * 13.3 | -- | unknown
1223 * 13.4 | -- | unknown
1224 * 13.5 | -- | unknown
1225 * 13.6 | -- | left joystick touched
1226 * 13.7 | -- | right joystick touched
1227 * 14.0 | -- | unknown
1228 * 14.1 | -- | unknown
1230 * 14.3 | -- | unknown
1231 * 14.4 | -- | unknown
1232 * 14.5 | -- | unknown
1233 * 14.6 | -- | unknown
1234 * 14.7 | -- | unknown
1235 * 15.0 | -- | unknown
1236 * 15.1 | -- | unknown
1237 * 15.2 | -- | unknown
1238 * 15.3 | -- | unknown
1239 * 15.4 | -- | unknown
1240 * 15.5 | -- | unknown
1241 * 15.6 | -- | unknown
1242 * 15.7 | -- | unknown
1245 struct input_dev *input, u8 *data) in steam_do_deck_input_event() argument
1261 input_report_abs(input, ABS_HAT0X, steam_le16(data + 16)); in steam_do_deck_input_event()
1262 input_report_abs(input, ABS_HAT0Y, steam_le16(data + 18)); in steam_do_deck_input_event()
1264 input_report_abs(input, ABS_HAT0X, 0); in steam_do_deck_input_event()
1265 input_report_abs(input, ABS_HAT0Y, 0); in steam_do_deck_input_event()
1269 input_report_abs(input, ABS_HAT1X, steam_le16(data + 20)); in steam_do_deck_input_event()
1270 input_report_abs(input, ABS_HAT1Y, steam_le16(data + 22)); in steam_do_deck_input_event()
1272 input_report_abs(input, ABS_HAT1X, 0); in steam_do_deck_input_event()
1273 input_report_abs(input, ABS_HAT1Y, 0); in steam_do_deck_input_event()
1276 input_report_abs(input, ABS_X, steam_le16(data + 48)); in steam_do_deck_input_event()
1277 input_report_abs(input, ABS_Y, -steam_le16(data + 50)); in steam_do_deck_input_event()
1278 input_report_abs(input, ABS_RX, steam_le16(data + 52)); in steam_do_deck_input_event()
1279 input_report_abs(input, ABS_RY, -steam_le16(data + 54)); in steam_do_deck_input_event()
1281 input_report_abs(input, ABS_HAT2Y, steam_le16(data + 44)); in steam_do_deck_input_event()
1282 input_report_abs(input, ABS_HAT2X, steam_le16(data + 46)); in steam_do_deck_input_event()
1284 input_event(input, EV_KEY, BTN_TR2, !!(b8 & BIT(0))); in steam_do_deck_input_event()
1285 input_event(input, EV_KEY, BTN_TL2, !!(b8 & BIT(1))); in steam_do_deck_input_event()
1286 input_event(input, EV_KEY, BTN_TR, !!(b8 & BIT(2))); in steam_do_deck_input_event()
1287 input_event(input, EV_KEY, BTN_TL, !!(b8 & BIT(3))); in steam_do_deck_input_event()
1288 input_event(input, EV_KEY, BTN_Y, !!(b8 & BIT(4))); in steam_do_deck_input_event()
1289 input_event(input, EV_KEY, BTN_B, !!(b8 & BIT(5))); in steam_do_deck_input_event()
1290 input_event(input, EV_KEY, BTN_X, !!(b8 & BIT(6))); in steam_do_deck_input_event()
1291 input_event(input, EV_KEY, BTN_A, !!(b8 & BIT(7))); in steam_do_deck_input_event()
1292 input_event(input, EV_KEY, BTN_SELECT, !!(b9 & BIT(4))); in steam_do_deck_input_event()
1293 input_event(input, EV_KEY, BTN_MODE, !!(b9 & BIT(5))); in steam_do_deck_input_event()
1294 input_event(input, EV_KEY, BTN_START, !!(b9 & BIT(6))); in steam_do_deck_input_event()
1295 input_event(input, EV_KEY, BTN_TRIGGER_HAPPY3, !!(b9 & BIT(7))); in steam_do_deck_input_event()
1296 input_event(input, EV_KEY, BTN_TRIGGER_HAPPY4, !!(b10 & BIT(0))); in steam_do_deck_input_event()
1297 input_event(input, EV_KEY, BTN_THUMBL, !!(b10 & BIT(6))); in steam_do_deck_input_event()
1298 input_event(input, EV_KEY, BTN_THUMBR, !!(b11 & BIT(2))); in steam_do_deck_input_event()
1299 input_event(input, EV_KEY, BTN_DPAD_UP, !!(b9 & BIT(0))); in steam_do_deck_input_event()
1300 input_event(input, EV_KEY, BTN_DPAD_RIGHT, !!(b9 & BIT(1))); in steam_do_deck_input_event()
1301 input_event(input, EV_KEY, BTN_DPAD_LEFT, !!(b9 & BIT(2))); in steam_do_deck_input_event()
1302 input_event(input, EV_KEY, BTN_DPAD_DOWN, !!(b9 & BIT(3))); in steam_do_deck_input_event()
1303 input_event(input, EV_KEY, BTN_THUMB, !!(b10 & BIT(1))); in steam_do_deck_input_event()
1304 input_event(input, EV_KEY, BTN_THUMB2, !!(b10 & BIT(2))); in steam_do_deck_input_event()
1305 input_event(input, EV_KEY, BTN_TRIGGER_HAPPY1, !!(b13 & BIT(1))); in steam_do_deck_input_event()
1306 input_event(input, EV_KEY, BTN_TRIGGER_HAPPY2, !!(b13 & BIT(2))); in steam_do_deck_input_event()
1307 input_event(input, EV_KEY, BTN_BASE, !!(b14 & BIT(2))); in steam_do_deck_input_event()
1309 input_sync(input); in steam_do_deck_input_event()
1316 * -------+-------+---------------------------
1317 * 4-7 | u32 | sequence number
1318 * 8-11 | -- | always 0
1319 * 12-13 | u16 | voltage (mV)
1332 battery = rcu_dereference(steam->battery); in steam_do_battery_event()
1334 spin_lock_irqsave(&steam->lock, flags); in steam_do_battery_event()
1335 steam->voltage = volts; in steam_do_battery_event()
1336 steam->battery_charge = batt; in steam_do_battery_event()
1337 spin_unlock_irqrestore(&steam->lock, flags); in steam_do_battery_event()
1348 struct input_dev *input; in steam_raw_event() local
1354 if (steam->client_opened) in steam_raw_event()
1355 hid_input_report(steam->client_hdev, HID_FEATURE_REPORT, in steam_raw_event()
1358 * All messages are size=64, all values little-endian. in steam_raw_event()
1361 * -------+-------------------------------------------- in steam_raw_event()
1362 * 0-1 | always 0x01, 0x00, maybe protocol version? in steam_raw_event()
1365 * 4-n | payload data, depends on the type in steam_raw_event()
1368 * 0x01: input data (60 bytes) in steam_raw_event()
1371 * 0x09: Steam Deck input data (56 bytes) in steam_raw_event()
1379 if (steam->client_opened) in steam_raw_event()
1382 input = rcu_dereference(steam->input); in steam_raw_event()
1383 if (likely(input)) in steam_raw_event()
1384 steam_do_input_event(steam, input, data); in steam_raw_event()
1388 if (steam->client_opened) in steam_raw_event()
1391 input = rcu_dereference(steam->input); in steam_raw_event()
1392 if (likely(input)) in steam_raw_event()
1393 steam_do_deck_input_event(steam, input, data); in steam_raw_event()
1412 if (steam->quirks & STEAM_QUIRK_WIRELESS) { in steam_raw_event()
1414 battery = rcu_dereference(steam->battery); in steam_raw_event()
1442 mutex_lock(&steam->mutex); in steam_param_set_lizard_mode()
1443 if (!steam->client_opened) in steam_param_set_lizard_mode()
1445 mutex_unlock(&steam->mutex); in steam_param_set_lizard_mode()
1481 .name = "hid-steam",