adb functionuses bulk transfer mode, requiring twoEP(in/out), and thepacket size required inusb2.0 mode is 512 bytes.
1. Kernel ConfigurationSelect “function filesystem“, and after compilation, it will generate usb_f_fs.ko and g_ffs.ko
If configured via configfs, please use the configuration below
How to Test
As mentioned earlier, ADB implements the logic for USB Device configuration and data transfer at the application layer, so after setting up the Legacy or Configfs environment, it is necessary to run the adbd application for the Host side to recognize the corresponding ADB device.
Method to execute on the Device side:
mkdir -p /dev/usb-ffs/adb
mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb
./adbd &
sleep 2
Method to execute on the Host side:
adb devices –> adb
adb connect –> adb
adb shell –> adbshell
For obtaining and compiling the source code of adb/adbd, refer to:
The service program on the adbd device, source reference: https://github.com/yoannsculo/adbd
Installation and usage of adb on Linux platform: apt-get install android-tools-adb3. Specific usage: refer to https://github.com/mzlogin/awesome-adb#usb-%E8%BF%9E%E6%8E%A5