From dbddad6f77bcd2c95a7fbe9f07422b94bc93c04b Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Wed, 5 Jan 2022 19:25:28 +0100 Subject: [PATCH] trigger adbd by /mnt/adb file detection --- .../funkey/rootfs-overlay/usr/local/sbin/usb_gadget | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/usb_gadget b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/usb_gadget index e16be2a..0cbd337 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/usb_gadget +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/usb_gadget @@ -13,6 +13,10 @@ GADGET=/sys/kernel/config/usb_gadget/FunKey [ ! -f /mnt/usbnet ] USBNET=${?} +# Check if Android Debug Bridge is requested +[ ! -f /mnt/adb ] +ADB=${?} + # USB VID for Linux Foundation ID_VENDOR="0x1d6b" @@ -37,6 +41,12 @@ init_usb_gadget() { return 0 fi + # ADB has precedence over USB Mass Storage / Ethernet over USB + if [ ${ADB} -eq 1 ]; then + adb start + return 0 + fi + # Get the legacy drivers out of the way modprobe -r g_ether modprobe -r g_mass_storage