From c9e92c91930ecfe3e475e17cff5d50cf4fc62b08 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sun, 24 Jan 2021 06:20:32 +0100 Subject: [PATCH] setup_usb_configfs: Make it possible to choose the used UDC Some devices may have more than one UDC available. --- initramfs/init_functions.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/initramfs/init_functions.sh b/initramfs/init_functions.sh index cd194d6..1e697a3 100755 --- a/initramfs/init_functions.sh +++ b/initramfs/init_functions.sh @@ -73,8 +73,12 @@ setup_usb_configfs() { fatal_error "No USB Device Controller available" fi + if [ -z "$UDC" ]; then + UDC="$(ls /sys/class/udc)" + fi + # shellcheck disable=SC2005 - echo "$(ls /sys/class/udc)" > $CONFIGFS/g1/UDC || ( fatal_error "Couldn't write to UDC" ) + echo "$UDC" > $CONFIGFS/g1/UDC || ( fatal_error "Couldn't write to UDC" ) } setup_telnetd() {