Browse Source

trigger adbd by /mnt/adb file detection

Michel-FK 2 years ago
parent
commit
dbddad6f77
1 changed files with 10 additions and 0 deletions
  1. 10 0
      FunKey/board/funkey/rootfs-overlay/usr/local/sbin/usb_gadget

+ 10 - 0
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