main/postmarketos-initramfs: Separate code into setup_usb_configfs_udc (MR 4450)
This method is called from setup_usb_network_configfs and debug shell's setup_usb_storage.sh
This commit is contained in:
parent
9d9fc6fa49
commit
5626781fca
2 changed files with 20 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
||||
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||
pkgname=postmarketos-initramfs
|
||||
pkgver=2.1.1
|
||||
pkgver=2.2.0
|
||||
pkgrel=0
|
||||
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
|
||||
url="https://postmarketos.org"
|
||||
|
@ -80,7 +80,7 @@ bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f27
|
|||
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
|
||||
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
|
||||
f2dc71d88964a8c2e8cd2f84965184ef7eb9e28899df2c2621a590463a37216ca8550a5109d96d067c0a40c766f96fc76eea38f386b0948c2e93817dd2ef39b6 init.sh
|
||||
a1033084cb53d862f1952273ccdb9c3865c1b8eaa8c04a44ec176966df931fab5765a36ef13d794d9fadfb8fab61e27b2628693ae7f51b1f13d55983a683e590 init_functions.sh
|
||||
b4de411bb1e3f610b2d75f8c1e0f753e4550e615bee344b3531d357be77faef6e54ad22b507debec2c7db9930eaa4f9ea3d5f3a131d222480d360933c93ae723 init_functions.sh
|
||||
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
|
||||
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
|
||||
"
|
||||
|
|
|
@ -561,6 +561,23 @@ setup_usb_network_android() {
|
|||
echo "1" >"$SYS/enable"
|
||||
}
|
||||
|
||||
|
||||
setup_usb_configfs_udc() {
|
||||
# Check if there's an USB Device Controller
|
||||
local _udc_dev
|
||||
_udc_dev=$(ls /sys/class/udc)
|
||||
if [ -z "$_udc_dev" ]; then
|
||||
echo " No USB Device Controller available"
|
||||
return
|
||||
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"
|
||||
# Link the gadget instance to an USB Device Controller. This activates the gadget.
|
||||
# See also: https://github.com/postmarketOS/pmbootstrap/issues/338
|
||||
echo "$_udc_dev" > /config/usb_gadget/g1/UDC || echo " Couldn't write new UDC"
|
||||
}
|
||||
|
||||
setup_usb_network_configfs() {
|
||||
# See: https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
|
||||
CONFIGFS=/config/usb_gadget
|
||||
|
@ -607,16 +624,7 @@ setup_usb_network_configfs() {
|
|||
ln -s $CONFIGFS/g1/functions/"$usb_network_function" $CONFIGFS/g1/configs/c.1 \
|
||||
|| echo " Couldn't symlink $usb_network_function"
|
||||
|
||||
# Check if there's an USB Device Controller
|
||||
if [ -z "$(ls /sys/class/udc)" ]; then
|
||||
echo " No USB Device Controller available"
|
||||
return
|
||||
fi
|
||||
|
||||
# Link the gadget instance to an USB Device Controller. This activates the gadget.
|
||||
# See also: https://github.com/postmarketOS/pmbootstrap/issues/338
|
||||
# shellcheck disable=SC2005
|
||||
echo "$(ls /sys/class/udc)" > $CONFIGFS/g1/UDC || echo " Couldn't write UDC"
|
||||
setup_usb_configfs_udc
|
||||
}
|
||||
|
||||
setup_usb_network() {
|
||||
|
|
Loading…
Reference in a new issue