feat: validate native Linux virtual USB and add recovery services

This commit is contained in:
tongtong committed 2026-11-13 03:28:52 +08:00
1 parent 6490665af8
commit ac8eb72319
8 files changed
+105 -4

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Root-only monitor for an existing loopback ads-usb export. No public USB/IP listener.
set -euo pipefail
port=${1:-3241}
[[ "$port" =~ ^[0-9]{1,5}$ ]] && ((port>=1024 && port<=65535)) || { echo 'Invalid USB/IP port' >&2; exit 2; }
((EUID==0)) || { echo 'usbip attach requires root' >&2; exit 1; }
modprobe vhci_hcd
uri="usbip://127.0.0.1:$port/1-1"
while true; do
if ! usbip port | grep -F -- "$uri" >/dev/null; then
usbip --tcp-port "$port" attach --remote 127.0.0.1 --busid 1-1 || true
fi
sleep 3
done