add usb adbd support, enable with create /boot/usb.adbd file

This commit is contained in:
Neucrack
2025-04-17 19:58:46 +08:00
parent e4e133f3df
commit a3ccb527b2
3 changed files with 35 additions and 1 deletions

1
.gitignore vendored
View File

@@ -420,3 +420,4 @@ osdrv/extdrv/wireless/.tmp_4261/
middleware/v2/lib
host-tools/
kvm/
.vscode*

View File

@@ -168,7 +168,33 @@ then
ln -s functions/hid.GS2 configs/c.1
fi
ls /sys/class/udc/ | cat > UDC
# adbd
if [ -e /boot/usb.adbd ]
then
echo 0x18d1 > idVendor # google
mkdir -p configs/c.1/strings/0x409
echo "" > configs/c.1/strings/0x409/configuration
echo 0x80 > configs/c.1/bmAttributes
mkdir functions/ffs.adb
ln -s functions/ffs.adb configs/c.1/
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb/
/usr/bin/adbd &
for i in $(seq 1 40); do
if [ -e /dev/usb-ffs/adb/ep2 ]; then
break
fi
sleep 0.1
done
fi
while true; do
ls /sys/class/udc/ | cat > UDC || true
res=$(cat UDC)
if [[ "x$res" != "x" ]]; then
break
fi
sleep 0.4
done
echo device > /proc/cviusb/otg_role
fi
fi

View File

@@ -41,6 +41,13 @@ BR2_PACKAGE_AIC8800_SDIO_FIRMWARE=y
BR2_PACKAGE_CVITEK_RISCV64_MUSL_SYSROOT=y
BR2_PACKAGE_ANDROID_TOOLS=y
BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT_GOOD_KERNEL_HEADERS=y
# BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT is not set
# BR2_PACKAGE_ANDROID_TOOLS_ADB is not set
BR2_PACKAGE_ANDROID_TOOLS_ADBD=y
# BR2_PACKAGE_HOST_ANDROID_TOOLS is not set
BR2_INIT_SYSV=y
BR2_ROOTFS_MERGED_USR=y
BR2_ENABLE_LOCALE_WHITELIST="C en_US en_US.utf8"