main/postmarketos-mkinitfs: make android_usb attrs customizable (!734)

ConfigFS USB attrs are customizable based on the `deviceinfo_usb_*` variables,
however some downstream kernels (e.g: msm-3.18) doesn't use configfs, instead
uses the traditional Android USB Gadget.

Based on `deviceinfo_usb_{idVendor/idProduct}` variables, we can change the USB
vendor and product.

So that on these devices, we can make it appear on USB bus as the correct USB
vendor/product ID, not "Google Inc. Nexus 4 (fastboot)"

Signed-off-by: Danct12 <danct12@disroot.org>
This commit is contained in:
Danct12 2019-11-11 00:20:28 +07:00
parent 95324f1b5f
commit dd028490c4
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-mkinitfs
pkgver=0.7.21
pkgrel=0
pkgrel=1
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
# multipath-tools: kpartx
@ -24,5 +24,5 @@ package() {
mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/"
}
sha512sums="8be7f29394f8cd4e1c4b93f018f6314350f7e37e20d242c97284c1b112a106f882318a101bc0c70b391590b969023901580c677ee9f869850e90e69171a44e80 init.sh.in
3c20fdfd4b06a975a0ebcf8f335a56028e0f58109078f0312f7b62eec4e0874e53aef7e538d6e6770f7bae6441166770795c32ee833569eda856239aeb44022b init_functions.sh
8b8c304c6962cfd1284e5631e32102d49da835bebf6d9d599c20e50849e16783aa1ade9f8d721160877e9bc1ae8d10da5e4588338d487eca5c4bfef62b7833fc init_functions.sh
3f918f8b5967b73e507c2ddf36dccc24fee98298f05ca23e22605400de95137f8877e09769616e7db388557c645fb45c03e1e6b5bab815ec9f853c318f0431f1 mkinitfs.sh"

View file

@ -229,12 +229,15 @@ setup_usb_network_android() {
echo " Setting up an USB gadget through android_usb"
usb_idVendor="$(echo "${deviceinfo_usb_idVendor:-0x18D1}" | sed "s/0x//g")" # default: Google Inc.
usb_idProduct="$(echo "${deviceinfo_usb_idProduct:-0xD001}" | sed "s/0x//g")" # default: Nexus 4 (fastboot)
# Do the setup
printf "%s" "0" >"$SYS/enable"
printf "%s" "18D1" >"$SYS/idVendor"
printf "%s" "D001" >"$SYS/idProduct"
printf "%s" "rndis" >"$SYS/functions"
printf "%s" "1" >"$SYS/enable"
echo "0" >"$SYS/enable"
echo "$usb_idVendor" >"$SYS/idVendor"
echo "$usb_idProduct" >"$SYS/idProduct"
echo "rndis" >"$SYS/functions"
echo "1" >"$SYS/enable"
}
setup_usb_network_configfs() {