postmarketos-initramfs: check if UDC is configured before clearing (MR 5000)
This fixes the annoying "sh: write error" and "Couldn't write to clear UDC" messages that happen on every single boot. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
75613d9f69
commit
709768214c
1 changed files with 3 additions and 1 deletions
|
@ -626,7 +626,9 @@ setup_usb_configfs_udc() {
|
|||
fi
|
||||
|
||||
# Remove any existing UDC to avoid "write error: Resource busy" when setting UDC again
|
||||
echo "" > /config/usb_gadget/g1/UDC || echo " Couldn't write to clear UDC"
|
||||
if [ "$(wc -w <$CONFIGFS/g1/UDC)" -gt 0 ]; then
|
||||
echo "" > /config/usb_gadget/g1/UDC || echo " Couldn't write to clear UDC"
|
||||
fi
|
||||
# Link the gadget instance to an USB Device Controller. This activates the gadget.
|
||||
# See also: https://gitlab.com/postmarketOS/pmbootstrap/issues/338
|
||||
echo "$_udc_dev" > /config/usb_gadget/g1/UDC || echo " Couldn't write new UDC"
|
||||
|
|
Loading…
Reference in a new issue