From 2aa7b8569fbfc097b6b9c0ee87fb1b7eeae6d098 Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Wed, 14 May 2025 04:17:29 -0500 Subject: [PATCH] feat: Reset optionally reset USB HID in dev-deploy (#440) Adds `--reset-usb-hid` command to delete the configured USB HID device before running. --- dev_deploy.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dev_deploy.sh b/dev_deploy.sh index d0ccaf2..62e2c4f 100755 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -24,6 +24,7 @@ show_help() { REMOTE_USER="root" REMOTE_PATH="/userdata/jetkvm/bin" SKIP_UI_BUILD=false +RESET_USB_HID_DEVICE=false LOG_TRACE_SCOPES="${LOG_TRACE_SCOPES:-jetkvm,cloud,websocket,native,jsonrpc}" # Parse command line arguments @@ -41,6 +42,10 @@ while [[ $# -gt 0 ]]; do SKIP_UI_BUILD=true shift ;; + --reset-usb-hid) + RESET_USB_HID_DEVICE=true + shift + ;; --help) show_help exit 0 @@ -74,6 +79,12 @@ ssh "${REMOTE_USER}@${REMOTE_HOST}" "killall jetkvm_app_debug || true" # Copy the binary to the remote host ssh "${REMOTE_USER}@${REMOTE_HOST}" "cat > ${REMOTE_PATH}/jetkvm_app_debug" < jetkvm_app +if [ "$RESET_USB_HID_DEVICE" = true ]; then + # Remove the old USB gadget configuration + ssh "${REMOTE_USER}@${REMOTE_HOST}" "rm -rf /sys/kernel/config/usb_gadget/jetkvm/configs/c.1/hid.usb*" + ssh "${REMOTE_USER}@${REMOTE_HOST}" "ls /sys/class/udc > /sys/kernel/config/usb_gadget/jetkvm/UDC" +fi + # Deploy and run the application on the remote host ssh "${REMOTE_USER}@${REMOTE_HOST}" ash << EOF set -e