No internet connection
  1. Home
  2. Technical Support

Can see screen but cannot move mouse or use keyboard.

By @karmapolice
    2023-10-28 22:59:18.370Zassigned to
    • @david

    I am using a TinyPilot Voyager 2a to remote into my windows laptop. I have a perfectly good tinypilot setup working already, but am now having issues with a second setup that I finished yesterday. I put everything together and all was working well. Then, this morning I tried connected via tailscale and was only able to see the screen. I could not move the mouse or keyboard. I know this is not an issue with any of the cords, ports, or laptops because I switched each variable out and the setup worked. It is something with the specific tinypilot.

    There are a few changes I made to the tinypilot which I will list below.

    ran sudo nano /opt/tinypilot-privileged/init-usb-gadget

    Under # Adapted from https://github.com/girst/hardpass-sendHID/blob/master/README.md
    - changed the info after idVendor to "xxxx" and idProduct to "xxxx"
    - changed echo "6b65796d696d6570690" to echo "xxxx"
    - changed echo "tinypilot" to echo "xxxx"
    - changed echo "Multifunction USB Device" to echo "xxxx"
    

    followed the FAQ guide to change the EDID

    I also changed some to tinypilot's display information on the Laptop

    Here are the logs : https://logs.tinypilotkvm.com/1fAnvwzW

    Solved in post #4, click to view
    • 7 replies
    1. David @david2023-10-30 12:54:40.815Z

      Hi @karmapolice, I'm sorry you're running into this keyboard and mouse issue.

      Thanks for sharing those details and logs. The logs suggest that there's a permission error with TinyPilot's USB devices. It sounds like the changes you made to /opt/tinypilot-priviledged/init-usb-gadget may play a part in this.

      Our FAQ about identifiers outlines TinyPilot's USB identifiers and their values. It looks like you've successfully changed those. However, you also mentioned that you changed the values of idVendor and idProduct. Can you share more details of those changes?

      1. K@karmapolice
          2023-10-30 16:33:37.445Z2023-10-30 18:44:43.948Z

          Thanks for your response @david. Here is what I changed. Maybe you can give me the default values and I will try to change these back to normal?

          1. David @david2023-10-30 18:58:12.247Z2023-10-30 19:26:02.226Z

            Thanks for the screenshot!

            It looks like you only changed the comments on those lines (which won't affect anything), so they're ok. The original lines are:

            echo 0x1d6b > idVendor  # Linux Foundation
            echo 0x0104 > idProduct # Multifunction Composite Gadget
            

            I'm wondering whether any other changes introduced a syntax error into the init-usb-gadget file. I purposely introduced a syntax error in my own init-usb-gadget file to test the idea and I received the same error as you:

            PermissionError: [Errno 13] Permission denied: '/dev/hidg1'
            

            Which definitely suggests a syntax error is causing this issue.

            Could you replace the contents of your file with the original's and test the keyboard and mouse functionality? You can see the original file on Github. Here's a command you can run to replace the content (just copy and paste the whole snippet):

            cat << 'FILE' | sudo tee /opt/tinypilot-privileged/init-usb-gadget
            #!/bin/bash
            
            # Configures USB gadgets, see: docs/usb-gadget-driver.md
            
            # Exit on first error.
            set -e
            
            # Echo commands before executing them, by default to stderr.
            set -x
            
            # Treat undefined environment variables as errors.
            set -u
            
            SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
            readonly SCRIPT_DIR
            # shellcheck source=lib/usb-gadget.sh
            source "${SCRIPT_DIR}/lib/usb-gadget.sh"
            
            print_help() {
              cat << EOF
            Usage: ${0##*/} [-h]
            Init USB gadget.
              -h Display this help and exit.
            EOF
            }
            
            # Parse command-line arguments.
            while getopts "h" opt; do
              case "${opt}" in
                h)
                  print_help
                  exit
                  ;;
                *)
                  print_help >&2
                  exit 1
              esac
            done
            
            modprobe libcomposite
            
            # Adapted from https://github.com/girst/hardpass-sendHID/blob/master/README.md
            
            cd "${USB_GADGET_PATH}"
            mkdir -p "${USB_DEVICE_DIR}"
            cd "${USB_DEVICE_DIR}"
            
            echo 0x1d6b > idVendor  # Linux Foundation
            echo 0x0104 > idProduct # Multifunction Composite Gadget
            echo 0x0100 > bcdDevice # v1.0.0
            echo 0x0200 > bcdUSB    # USB2
            
            mkdir -p "$USB_STRINGS_DIR"
            echo "6b65796d696d6570690" > "${USB_STRINGS_DIR}/serialnumber"
            echo "tinypilot" > "${USB_STRINGS_DIR}/manufacturer"
            echo "Multifunction USB Device" > "${USB_STRINGS_DIR}/product"
            
            # Keyboard
            mkdir -p "$USB_KEYBOARD_FUNCTIONS_DIR"
            echo 1 > "${USB_KEYBOARD_FUNCTIONS_DIR}/protocol" # Keyboard
            echo 1 > "${USB_KEYBOARD_FUNCTIONS_DIR}/subclass" # Boot interface subclass
            echo 8 > "${USB_KEYBOARD_FUNCTIONS_DIR}/report_length"
            # Write the report descriptor
            D=$(mktemp)
            
            {
              echo -ne \\x05\\x01       # Usage Page (Generic Desktop Ctrls)
              echo -ne \\x09\\x06       # Usage (Keyboard)
              echo -ne \\xA1\\x01       # Collection (Application)
              echo -ne \\x05\\x08       #   Usage Page (LEDs)
              echo -ne \\x19\\x01       #   Usage Minimum (Num Lock)
              echo -ne \\x29\\x03       #   Usage Maximum (Scroll Lock)
              echo -ne \\x15\\x00       #   Logical Minimum (0)
              echo -ne \\x25\\x01       #   Logical Maximum (1)
              echo -ne \\x75\\x01       #   Report Size (1)
              echo -ne \\x95\\x03       #   Report Count (3)
              echo -ne \\x91\\x02       #   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
              echo -ne \\x09\\x4B       #   Usage (Generic Indicator)
              echo -ne \\x95\\x01       #   Report Count (1)
              echo -ne \\x91\\x02       #   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
              echo -ne \\x95\\x04       #   Report Count (4)
              echo -ne \\x91\\x01       #   Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
              echo -ne \\x05\\x07       #   Usage Page (Kbrd/Keypad)
              echo -ne \\x19\\xE0       #   Usage Minimum (0xE0)
              echo -ne \\x29\\xE7       #   Usage Maximum (0xE7)
              echo -ne \\x95\\x08       #   Report Count (8)
              echo -ne \\x81\\x02       #   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
              echo -ne \\x75\\x08       #   Report Size (8)
              echo -ne \\x95\\x01       #   Report Count (1)
              echo -ne \\x81\\x01       #   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
              echo -ne \\x19\\x00       #   Usage Minimum (0x00)
              echo -ne \\x29\\x91       #   Usage Maximum (0x91)
              echo -ne \\x26\\xFF\\x00  #   Logical Maximum (255)
              echo -ne \\x95\\x06       #   Report Count (6)
              echo -ne \\x81\\x00       #   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
              echo -ne \\xC0            # End Collection
            } >> "$D"
            cp "$D" "${USB_KEYBOARD_FUNCTIONS_DIR}/report_desc"
            # Enable pre-boot events (if the gadget driver supports it).
            if [[ -f "${USB_KEYBOARD_FUNCTIONS_DIR}/no_out_endpoint" ]]; then
              echo 1 > "${USB_KEYBOARD_FUNCTIONS_DIR}/no_out_endpoint"
            fi
            
            # Mouse
            mkdir -p "$USB_MOUSE_FUNCTIONS_DIR"
            echo 0 > "${USB_MOUSE_FUNCTIONS_DIR}/protocol"
            echo 0 > "${USB_MOUSE_FUNCTIONS_DIR}/subclass"
            echo 7 > "${USB_MOUSE_FUNCTIONS_DIR}/report_length"
            # Write the report descriptor
            D=$(mktemp)
            {
            echo -ne \\x05\\x01      # USAGE_PAGE (Generic Desktop)
            echo -ne \\x09\\x02      # USAGE (Mouse)
            echo -ne \\xA1\\x01      # COLLECTION (Application)
                                     #   8-buttons
            echo -ne \\x05\\x09      #   USAGE_PAGE (Button)
            echo -ne \\x19\\x01      #   USAGE_MINIMUM (Button 1)
            echo -ne \\x29\\x08      #   USAGE_MAXIMUM (Button 8)
            echo -ne \\x15\\x00      #   LOGICAL_MINIMUM (0)
            echo -ne \\x25\\x01      #   LOGICAL_MAXIMUM (1)
            echo -ne \\x95\\x08      #   REPORT_COUNT (8)
            echo -ne \\x75\\x01      #   REPORT_SIZE (1)
            echo -ne \\x81\\x02      #   INPUT (Data,Var,Abs)
                                     #   x,y absolute coordinates
            echo -ne \\x05\\x01      #   USAGE_PAGE (Generic Desktop)
            echo -ne \\x09\\x30      #   USAGE (X)
            echo -ne \\x09\\x31      #   USAGE (Y)
            echo -ne \\x16\\x00\\x00 #   LOGICAL_MINIMUM (0)
            echo -ne \\x26\\xFF\\x7F #   LOGICAL_MAXIMUM (32767)
            echo -ne \\x75\\x10      #   REPORT_SIZE (16)
            echo -ne \\x95\\x02      #   REPORT_COUNT (2)
            echo -ne \\x81\\x02      #   INPUT (Data,Var,Abs)
                                     #   vertical wheel
            echo -ne \\x09\\x38      #   USAGE (wheel)
            echo -ne \\x15\\x81      #   LOGICAL_MINIMUM (-127)
            echo -ne \\x25\\x7F      #   LOGICAL_MAXIMUM (127)
            echo -ne \\x75\\x08      #   REPORT_SIZE (8)
            echo -ne \\x95\\x01      #   REPORT_COUNT (1)
            echo -ne \\x81\\x06      #   INPUT (Data,Var,Rel)
                                     #   horizontal wheel
            echo -ne \\x05\\x0C      #   USAGE_PAGE (Consumer Devices)
            echo -ne \\x0A\\x38\\x02 #   USAGE (AC Pan)
            echo -ne \\x15\\x81      #   LOGICAL_MINIMUM (-127)
            echo -ne \\x25\\x7F      #   LOGICAL_MAXIMUM (127)
            echo -ne \\x75\\x08      #   REPORT_SIZE (8)
            echo -ne \\x95\\x01      #   REPORT_COUNT (1)
            echo -ne \\x81\\x06      #   INPUT (Data,Var,Rel)
            echo -ne \\xC0           # END_COLLECTION
            } >> "$D"
            cp "$D" "${USB_MOUSE_FUNCTIONS_DIR}/report_desc"
            
            mkdir -p "${USB_CONFIG_DIR}"
            echo 250 > "${USB_CONFIG_DIR}/MaxPower"
            
            CONFIGS_STRINGS_DIR="${USB_CONFIG_DIR}/${USB_STRINGS_DIR}"
            mkdir -p "${CONFIGS_STRINGS_DIR}"
            echo "Config ${USB_CONFIG_INDEX}: ECM network" > "${CONFIGS_STRINGS_DIR}/configuration"
            
            ln -s "${USB_KEYBOARD_FUNCTIONS_DIR}" "${USB_CONFIG_DIR}/"
            ln -s "${USB_MOUSE_FUNCTIONS_DIR}" "${USB_CONFIG_DIR}/"
            
            usb_gadget_activate
            FILE
            

            Once you've reverted the file, can you reboot your TinyPilot and test the keyboard & mouse functionality?

            If returning to the original file works, we can take a look at the changes you want to make to the identifiers.

            ReplySolution
            1. K@karmapolice
                2023-10-30 19:21:35.498Z

                I changed everything back to normal, restarted the tinypilot, but was still unable to use the mouse/keyboard.
                I'm glad we now know it's a syntax error. Could I have made a typo/mouse slip somewhere when editing the file and now that is causing this?

                1. David @david2023-10-30 19:32:47.637Z

                  Sorry @karmapolice, I made a mistake with the original command. Can you try running the fixed command and let me know if that works?

                  1. K@karmapolice
                      2023-10-30 20:01:57.878Z

                      It worked! I'll try to go in and change things again and hopefully I don't run into this issue again. Thank you so much for your help! I will come back to this ticket if I need more help with this.

                      1. David @david2023-10-31 11:55:20.046Z

                        You're welcome! Feel free to reach out if you have any other questions.