feat: validate native Linux virtual USB and add recovery services
This commit is contained in:
1 parent
6490665af8
commit
ac8eb72319
8 files changed
+105
-4
No files matched your search
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=ADS Linux virtual USB reattachment
|
||||
Requires=ads-usb-export.service
|
||||
After=ads-usb-export.service
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/libexec/ads-linux-usb-monitor 3241
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
NoNewPrivileges=true
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,13 @@
|
||||
# Example matching the validated Ubuntu host; adjust user and executable paths.
|
||||
[Unit]
|
||||
Description=ADS loopback virtual ADB USB export
|
||||
Requires=ads-usb-upstream.service
|
||||
After=ads-usb-upstream.service
|
||||
[Service]
|
||||
User=tt
|
||||
ExecStart=/home/tt/ads-linux-usb/ads-usb --listen 127.0.0.1:3241 --upstream 127.0.0.1:15557 --serial ADS-home-phone
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
NoNewPrivileges=true
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,11 @@
|
||||
# LAN validation upstream. Replace with ads-client for public cluster access.
|
||||
[Unit]
|
||||
Description=ADS LAN phone loopback upstream
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
User=tt
|
||||
ExecStart=/usr/bin/socat TCP-LISTEN:15557,bind=127.0.0.1,reuseaddr,fork TCP:192.168.100.141:5555
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
NoNewPrivileges=true
|
||||
@@ -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
|
||||
Reference in new issue
Block a user