Skip to content

Commit 2aa7b85

Browse files
authored
feat: Reset optionally reset USB HID in dev-deploy (#440)
Adds `--reset-usb-hid` command to delete the configured USB HID device before running.
1 parent 19bd161 commit 2aa7b85

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dev_deploy.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ show_help() {
2424
REMOTE_USER="root"
2525
REMOTE_PATH="/userdata/jetkvm/bin"
2626
SKIP_UI_BUILD=false
27+
RESET_USB_HID_DEVICE=false
2728
LOG_TRACE_SCOPES="${LOG_TRACE_SCOPES:-jetkvm,cloud,websocket,native,jsonrpc}"
2829

2930
# Parse command line arguments
@@ -41,6 +42,10 @@ while [[ $# -gt 0 ]]; do
4142
SKIP_UI_BUILD=true
4243
shift
4344
;;
45+
--reset-usb-hid)
46+
RESET_USB_HID_DEVICE=true
47+
shift
48+
;;
4449
--help)
4550
show_help
4651
exit 0
@@ -74,6 +79,12 @@ ssh "${REMOTE_USER}@${REMOTE_HOST}" "killall jetkvm_app_debug || true"
7479
# Copy the binary to the remote host
7580
ssh "${REMOTE_USER}@${REMOTE_HOST}" "cat > ${REMOTE_PATH}/jetkvm_app_debug" < jetkvm_app
7681

82+
if [ "$RESET_USB_HID_DEVICE" = true ]; then
83+
# Remove the old USB gadget configuration
84+
ssh "${REMOTE_USER}@${REMOTE_HOST}" "rm -rf /sys/kernel/config/usb_gadget/jetkvm/configs/c.1/hid.usb*"
85+
ssh "${REMOTE_USER}@${REMOTE_HOST}" "ls /sys/class/udc > /sys/kernel/config/usb_gadget/jetkvm/UDC"
86+
fi
87+
7788
# Deploy and run the application on the remote host
7889
ssh "${REMOTE_USER}@${REMOTE_HOST}" ash << EOF
7990
set -e

0 commit comments

Comments
 (0)