因此禁止g_ffs.c对应的配置CONFIG_USB_FUNCTIONFS,再次使用USB gadget功能,没有错误“Device or resource busy”。 其它 CONFIG_USB_F_FS(USB_F_FS)的定义在文件drivers/usb/gadget/Kconfig: config USB_F_FS tristate CONFIG_USB_FUNCTIONFS (USB_FUNCTIONFS)的定义在文件drivers/usb/gadget/Kconfig: config USB_FUNCTIONFS tristate "Function Filesystem " select USB_LIBCOMPOSITE select USB_F_FS select USB_FUNCTIONFS_GENERIC if ! (USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) help The Function Filesystem (FunctionFS) lets one create
https://plus.google.com/111524780435806926688/posts/AaEccFjKNHE 在 Linux-3.10 上使能 USB ADB 编译内核时使能 USB FunctionFS When building your kernel, make sure to configure in FunctionFS: Device Drivers -> USB Support driver as a module at load time: insmod g_ffs.ko idVendor=0x18d1 idProduct=0x4e26 启动 Android 并挂载 functionFS Boot your target device with your new kernel (and insmod the g_ffs driver if necessary), and setup the functionfs directory: # mkdir /dev/usb-ffs # mkdir /dev/usb-ffs/adb # mount -o uid=2000,gid=2000 -t functionfs
relatime,noauto_da_alloc,resgid=1065,errors=panic,stripe=4096,data=ordered) adb on /dev/usb-ffs/adb type functionfs (rw,relatime) mtp on /dev/usb-ffs/mtp type functionfs (rw,relatime) ptp on /dev/usb-ffs/ptp type functionfs
relatime,noauto_da_alloc,resgid=1065,errors=panic,stripe=4096,data=ordered) adb on /dev/usb-ffs/adb type functionfs (rw,relatime) mtp on /dev/usb-ffs/mtp type functionfs (rw,relatime) ptp on /dev/usb-ffs/ptp type functionfs
nfs nodev nfs4 nodev overlay nodev ubifs fuseblk nodev fuse nodev fusectl nodev functionfs
FunctionFS FunctionFS 最初是对 GadgetFS 的重写,用于支持实现用户态的 gadget function,并组合到现有设备中。 这里说的 FunctionFS 实际上是新版基于 ConfigFS 的 GadgetFS 拓展。 如果要使用当前内核中没有的 function 实现自定义的功能,那么内核还提供了一个驱动可以方便在用户态创建接口,该驱动就是 ffs 即 FunctionFS。 functions/ffs.usb0 configs/c.1 创建一个类型为 ffs,名称为 usb0 的function,然后挂载到任意目录: cd /mnt mount usb0 ffs -t functionfs 如果嫌 C 代码写起来复杂,还可以使用 Python 编写 ffs 实现,比如 python-functionfs。
on fs mkdir /dev/usb-ffs 0770 shell shell mkdir /dev/usb-ffs/adb 0770 shell shell mount functionfs
./.config # CONFIG_USB_FUNCTIONFS is not set CONFIG_KERNFS=y CONFIG_NFS_FS=y CONFIG_NFS_V2=y CONFIG_NFS_V3
/usb_gadget/g1/configs/b.1/ffs.adb mkdir -p /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs
usb_gadget/g1/ configs/c.1/ffs.adb mkdir /dev/usb-ffs mkdir /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs usb_gadget/g1/ configs/c.1/ffs.adb mkdir /dev/usb-ffs mkdir /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs usb_gadget/g1/configs/c.1/ffs.adb mkdir /dev/usb-ffs mkdir /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs