diff --git a/scripts/usb-gadget/init-usb-gadget b/scripts/usb-gadget/init-usb-gadget index 475d6acc6..5504a99fe 100755 --- a/scripts/usb-gadget/init-usb-gadget +++ b/scripts/usb-gadget/init-usb-gadget @@ -37,40 +37,37 @@ echo 1 > "${KEYBOARD_FUNCTIONS_DIR}/protocol" # Keyboard echo 1 > "${KEYBOARD_FUNCTIONS_DIR}/subclass" # Boot interface subclass echo 8 > "${KEYBOARD_FUNCTIONS_DIR}/report_length" # Write the report descriptor -# Source: https://www.kernel.org/doc/html/latest/usb/gadget_hid.html D=$(mktemp) -echo -ne \\x05\\x01 >> "$D" # USAGE_PAGE (Generic Desktop) -echo -ne \\x09\\x06 >> "$D" # USAGE (Keyboard) -echo -ne \\xa1\\x01 >> "$D" # COLLECTION (Application) -echo -ne \\x05\\x07 >> "$D" # USAGE_PAGE (Keyboard) -echo -ne \\x19\\xe0 >> "$D" # USAGE_MINIMUM (Keyboard LeftControl) -echo -ne \\x29\\xe7 >> "$D" # USAGE_MAXIMUM (Keyboard Right GUI) -echo -ne \\x15\\x00 >> "$D" # LOGICAL_MINIMUM (0) -echo -ne \\x25\\x01 >> "$D" # LOGICAL_MAXIMUM (1) -echo -ne \\x75\\x01 >> "$D" # REPORT_SIZE (1) -echo -ne \\x95\\x08 >> "$D" # REPORT_COUNT (8) -echo -ne \\x81\\x02 >> "$D" # INPUT (Data,Var,Abs) -echo -ne \\x95\\x01 >> "$D" # REPORT_COUNT (1) -echo -ne \\x75\\x08 >> "$D" # REPORT_SIZE (8) -echo -ne \\x81\\x03 >> "$D" # INPUT (Cnst,Var,Abs) -echo -ne \\x95\\x05 >> "$D" # REPORT_COUNT (5) -echo -ne \\x75\\x01 >> "$D" # REPORT_SIZE (1) -echo -ne \\x05\\x08 >> "$D" # USAGE_PAGE (LEDs) -echo -ne \\x19\\x01 >> "$D" # USAGE_MINIMUM (Num Lock) -echo -ne \\x29\\x05 >> "$D" # USAGE_MAXIMUM (Kana) -echo -ne \\x91\\x02 >> "$D" # OUTPUT (Data,Var,Abs) -echo -ne \\x95\\x01 >> "$D" # REPORT_COUNT (1) -echo -ne \\x75\\x03 >> "$D" # REPORT_SIZE (3) -echo -ne \\x91\\x03 >> "$D" # OUTPUT (Cnst,Var,Abs) -echo -ne \\x95\\x06 >> "$D" # REPORT_COUNT (6) -echo -ne \\x75\\x08 >> "$D" # REPORT_SIZE (8) -echo -ne \\x15\\x00 >> "$D" # LOGICAL_MINIMUM (0) -echo -ne \\x25\\x65 >> "$D" # LOGICAL_MAXIMUM (101) -echo -ne \\x05\\x07 >> "$D" # USAGE_PAGE (Keyboard) -echo -ne \\x19\\x00 >> "$D" # USAGE_MINIMUM (Reserved) -echo -ne \\x29\\x65 >> "$D" # USAGE_MAXIMUM (Keyboard Application) -echo -ne \\x81\\x00 >> "$D" # INPUT (Data,Ary,Abs) -echo -ne \\xc0 >> "$D" # END_COLLECTION +echo -ne \\x05\\x01 >> "$D" # Usage Page (Generic Desktop Ctrls) +echo -ne \\x09\\x06 >> "$D" # Usage (Keyboard) +echo -ne \\xA1\\x01 >> "$D" # Collection (Application) +echo -ne \\x05\\x08 >> "$D" # Usage Page (LEDs) +echo -ne \\x19\\x01 >> "$D" # Usage Minimum (Num Lock) +echo -ne \\x29\\x03 >> "$D" # Usage Maximum (Scroll Lock) +echo -ne \\x15\\x00 >> "$D" # Logical Minimum (0) +echo -ne \\x25\\x01 >> "$D" # Logical Maximum (1) +echo -ne \\x75\\x01 >> "$D" # Report Size (1) +echo -ne \\x95\\x03 >> "$D" # Report Count (3) +echo -ne \\x91\\x02 >> "$D" # Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +echo -ne \\x09\\x4B >> "$D" # Usage (Generic Indicator) +echo -ne \\x95\\x01 >> "$D" # Report Count (1) +echo -ne \\x91\\x02 >> "$D" # Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +echo -ne \\x95\\x04 >> "$D" # Report Count (4) +echo -ne \\x91\\x01 >> "$D" # Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +echo -ne \\x05\\x07 >> "$D" # Usage Page (Kbrd/Keypad) +echo -ne \\x19\\xE0 >> "$D" # Usage Minimum (0xE0) +echo -ne \\x29\\xE7 >> "$D" # Usage Maximum (0xE7) +echo -ne \\x95\\x08 >> "$D" # Report Count (8) +echo -ne \\x81\\x02 >> "$D" # Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +echo -ne \\x75\\x08 >> "$D" # Report Size (8) +echo -ne \\x95\\x01 >> "$D" # Report Count (1) +echo -ne \\x81\\x01 >> "$D" # Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +echo -ne \\x19\\x00 >> "$D" # Usage Minimum (0x00) +echo -ne \\x29\\x91 >> "$D" # Usage Maximum (0x91) +echo -ne \\x26\\xFF\\x00 >> "$D" # Logical Maximum (255) +echo -ne \\x95\\x06 >> "$D" # Report Count (6) +echo -ne \\x81\\x00 >> "$D" # Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +echo -ne \\xC0 >> "$D" # End Collection cp "$D" "${KEYBOARD_FUNCTIONS_DIR}/report_desc" # Mouse