Skip to content

input-monitor: Show more information

Simon McVittie requested to merge wip/show-more-input-data into main

The high-level goal of this branch is to make it unnecessary to run evemu-describe and od -t x1 .../report_descriptor separately, as I had to ask @jpwhiting to do on steamrt/tasks#287.

Sample output:

{
  "added" : {
    "interface_flags" : [
      "event",
      "readable",
      "read-write"
    ],
    "type_flags" : [
      "joystick"
    ],
    "dev_node" : "/dev/input/event19",
    "subsystem" : "input",
    "sys_path" : "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256/0005:054C:0268.0009/input/input32/event19",
    "bus_type" : "0x0005",
    "vendor_id" : "0x054c",
    "product_id" : "0x0268",
    "version" : "0x8000",
    "evdev" : {
      "types" : [
        "SYN",
        "KEY",
        "ABS",
        "MSC",
        "FF"
      ],
      "raw_types" : "0x1b, 0x00, 0x20, 0x00,",
      "absolute_axes" : [
        "X",
        "Y",
        "Z",
        "RX",
        "RY",
        "RZ"
      ],
      "raw_abs" : "0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
      "relative_axes" : [],
      "raw_rel" : "0x00, 0x00, 0x00, 0x00,",
      "keys" : [
        "BTN_A",
        "BTN_B",
        "BTN_X",
        "BTN_Y",
        "BTN_TL",
        "BTN_TR",
        "BTN_TL2",
        "BTN_TR2",
        "BTN_SELECT",
        "BTN_START",
        "BTN_MODE",
        "BTN_THUMBL",
        "BTN_THUMBR",
        "BTN_DPAD_UP",
        "BTN_DPAD_DOWN",
        "BTN_DPAD_LEFT",
        "BTN_DPAD_RIGHT"
      ],
      "raw_keys" : [
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x7f,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
        "0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,"
      ],
      "input_properties" : [],
      "raw_input_properties" : "0x00, 0x00, 0x00, 0x00,"
    },
    "hid_ancestor" : {
      "sys_path" : "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256/0005:054C:0268.0009",
      "name" : "PLAYSTATION(R)3 Controller",
      "bus_type" : "0x0005",
      "vendor_id" : "0x054c",
      "product_id" : "0x0268",
      "uniq" : [REDACTED],
      "report_descriptor_length" : 149,
      "report_descriptor" : [
        "05 01 09 04 a1 01 a1 02",
        "85 01 75 08 95 01 15 00",
        "26 ff 00 81 03 75 01 95",
        "13 15 00 25 01 35 00 45",
        "01 05 09 19 01 29 13 81",
        "02 75 01 95 0d 06 00 ff",
        "81 03 15 00 26 ff 00 05",
        "01 09 01 a1 00 75 08 95",
        "04 35 00 46 ff 00 09 30",
        "09 31 09 32 09 35 81 02",
        "c0 05 01 75 08 95 27 09",
        "01 81 02 75 08 95 30 09",
        "01 91 02 75 08 95 30 09",
        "01 b1 02 c0 a1 02 85 02",
        "75 08 95 30 09 01 b1 02",
        "c0 a1 02 85 ee 75 08 95",
        "30 09 01 b1 02 c0 a1 02",
        "85 ef 75 08 95 30 09 01",
        "b1 02 c0 c0 00"
      ]
    },
    "input_ancestor" : {
      "sys_path" : "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256/0005:054C:0268.0009/input/input32",
      "name" : "PLAYSTATION(R)3 Controller",
      "bus_type" : "0x0005",
      "vendor_id" : "0x054c",
      "product_id" : "0x0268",
      "version" : "0x8000"
    }
  }
}

  • input-monitor: Always format evdev data in groups of 8 bytes

    Previously, we used 4-byte groups on i386, but this was inconsistent and (in my opinion) harder to read.

  • input-monitor: Don't add trailing spaces to the raw evdev bytes

  • glib-backports: Define autoptr free-function for GByteArray if needed

  • json-report: Allow evdev capabilities to be an array of lines

    This will let us output them in a more readable format.

  • input-monitor: Print raw_keys as multiple lines

    Reporting the keyboard capabilities like this:

        "raw_keys" : [
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 07 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00",
          "00 00 00 00 00 00 00 00"
        ],

    is a lot more readable than one long string.

  • json-report: Allow commas and 0x prefixes in hex-dumps

    This will allow input-monitor to print hex-dumps in a format that can be pasted into SDL and steam-runtime-tools test data without significant editing.

  • input-monitor: Print hex-dumps in a format suitable for our evdev tests

  • input-monitor: Hex-dump raw evdev capabilities by default

    Now that we're using a more readable output format for these, we don't need to limit them to verbose mode. This gives us essentially the same information as evemu-describe(1), but without requiring Steam users to install additional tools.

    Because the pretty-printed version only shows known joystick/gamepad buttons and a few of the most common non-joystick keys, it can be misleading. For example, we wouldn't show the unassigned button code used by the 8BitDo SNES30 v0100 via Bluetooth as described in https://github.com/libsdl-org/SDL/pull/7791, or the multimedia control keyboard keys found on the Google Stadia Controller rev.A on the same pull request.

  • input-device, input-monitor: Add the raw HID report descriptor

    This is useful information for any heuristic for identifying different types of input device, because it is less ambiguous than the evdev interface. For example, the evdev interface cannot reliably tell the difference between a 3-axis accelerometer and a set of 3 driving-simulation pedals, because both are often reported as a device with the same three axes (X, Y, Z) and no buttons.

Merge request reports

Loading