USB network robustness fixes
main/postmarketos-initramfs: support reading USB network UDC name from deviceinfo
Before this change the script assumed that the device has only one UDC.
However it is possible for a device to have multiple UDCs, in which case
the deviceinfo is the appropriate place to specify which one should be used.
This change adds an optional deviceinfo variable deviceinfo_usb_network_udc
to specify the UDC that should be used.
Also, before this change the script assumed the USB network interface name is
"usb0". But other gadget drivers like g_cdc
can claim USB interfaces
before the initramfs script gets around to creating one for USB networking,
so the interface might be "usb1" or something else. The configfs gadget itself
can provide the actual interface name, so this change makes the script
use that.
main/postmarketos-base-ui: read USB network interface name from configfs gadget
The configfs gadget can provide the actual interface name, which may not be
the default "usb0" since another gadget driver might have claimed "usb0".
This code is based on the start_unudhcpd
function in init_functions.sh
These are extracted from !4691 (closed) . Specifically the situation there is that using upstream's defconfig for the PinePhone kernel results in a) two UDCs being present in /sys/class/udc
, and b) the g_cdc
gadget driver claiming usb0
for itself such that the gadget created by initramfs is usb1
.
So while no device in master (not even the PinePhone) needs this MR's features right now, @craftyguy and I figured it's better to have this be reviewed and merged into master first.