stachal


usb gadget composite:
        echo 0 > /sys/class/android_usb/android0/enable
        echo mass_storage > /sys/class/android_usb/android0/functions  也可以 echo "mass_storage,rndis_qc,ffs" > /sys/class/android_usb/android0/functions
        echo 1 > /sys/class/android_usb/android0/enable
        echo /dev/mmcblk0p2 > /sys/class/android_usb/f_mass_storage/lun/file

因为不能共享存储,所以需要动态切换

        echo "/sbin/hotplug" > /proc/sys/kernel/hotplug

#!/bin/sh
if [ "${SUBSYSTEM}" = "android_usb" ]; then
    if [ "${USB_STATE}" = "CONNECTED" ]; then
        umount /my/mount/point/
        echo /dev/mmcblk0p2 >
        /sys/class/android_usb/f_mass_storage/lun/file
    fi
    if [ "${USB_STATE}" = "DISCONNECTED" ]; then
        mount /my/mount/point/
    fi
fi
exit 1


分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-12-14
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-04-09
  • 2021-10-24
相关资源
相似解决方案