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