Add possibility to add second USB device. Changed syntax how to add USB devices.

This commit is contained in:
Albrecht Lohofener
2024-05-29 16:44:33 +02:00
parent 0eeb83b40f
commit c88fb3ee72
2 changed files with 19 additions and 6 deletions
+3 -3
View File
@@ -24,9 +24,9 @@ services:
# USB passthrough
# Format <vendorID>:<productID> like 'lsusb' is given
# Currently only one USB device is supported
#USB_VID_1: "0e8d" # vendor ID
#USB_PID_1: "7961" # product ID
# Currently only two USB devices are supported
#USB_1: "0bda:8153"
#USB_2: "0e8d:7961"
ports:
# Port 8006 is console tty web VNC
+16 -3
View File
@@ -169,12 +169,25 @@ fi
# Attach USB interface
USB_ARGS=""
if [[ -z "${USB_VID_1}" || -z "${USB_PID_1}" ]]; then
USB_ARGS=""
USB_1_ARGS=""
USB_2_ARGS=""
if [[ -z "${USB_1}" ]]; then
USB_1_ARGS=""
else
USB_ARGS="-device usb-host,vendorid=0x$USB_VID_1,productid=0x$USB_PID_1"
USB_VID_1=$(echo $USB_1 | cut -d':' -f1)
USB_PID_1=$(echo $USB_1 | cut -d':' -f2)
USB_1_ARGS="-device usb-host,vendorid=0x$USB_VID_1,productid=0x$USB_PID_1"
fi
if [[ -z "${USB_2}" ]]; then
USB_2_ARGS=""
else
USB_VID_2=$(echo $USB_2 | cut -d':' -f1)
USB_PID_2=$(echo $USB_2 | cut -d':' -f2)
USB_2_ARGS="-device usb-host,vendorid=0x$USB_VID_2,productid=0x$USB_PID_2"
fi
USB_ARGS="${USB_1_ARGS} ${USB_2_ARGS}"
info "Booting image using $VERS..."