From dd028490c462bf12e93dd4ef51036e6e4f41b663 Mon Sep 17 00:00:00 2001 From: Danct12 Date: Mon, 11 Nov 2019 00:20:28 +0700 Subject: [PATCH] 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 --- main/postmarketos-mkinitfs/APKBUILD | 4 ++-- main/postmarketos-mkinitfs/init_functions.sh | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 5f14954cd..574205701 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -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" diff --git a/main/postmarketos-mkinitfs/init_functions.sh b/main/postmarketos-mkinitfs/init_functions.sh index 28e282658..09dd9b3fe 100644 --- a/main/postmarketos-mkinitfs/init_functions.sh +++ b/main/postmarketos-mkinitfs/init_functions.sh @@ -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() {