【随笔记】Tina 系统的 ADB、声卡、网卡、串口多路共存

全志 Tina 系统的 USB Gadget 配置方法,随笔记录,实测为 R311 平台,其它平台应该通用。 

一、配置内核

二、编译驱动并加载

# UAC
insmod usb_f_uac1.ko
# NCM
insmod u_ether.ko
insmod usb_f_ncm.ko
# ACM
insmod u_serial.ko
insmod usb_f_acm.ko
insmod usb_f_serial.ko

三、USB 串口、USB 声卡、ADB 三者共存配置

rm /sys/kernel/config/usb_gadget/g1/configs/c.1/f*
echo 0x18d1 > /sys/kernel/config/usb_gadget/g1/idVendor
echo 0x2d05 > /sys/kernel/config/usb_gadget/g1/idProduct
mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.adb
mkdir /sys/kernel/config/usb_gadget/g1/functions/uac1.gs0 
mkdir /sys/kernel/config/usb_gadget/g1/functions/acm.usb0
ln -s /sys/kernel/config/usb_gadget/g1/functions/uac1.gs0 /sys/kernel/config/usb_gadget/g1/configs/c.1/f0
ln -s /sys/kernel/config/usb_gadget/g1/functions/acm.usb0/ /sys/kernel/config/usb_gadget/g1/configs/c.1/f1
ln -s /sys/kernel/config/usb_gadget/g1/functions/ffs.adb /sys/kernel/config/usb_gadget/g1/configs/c.1/f2
ls /sys/class/udc/ | xargs echo > /sys/kernel/config/usb_gadget/g1/UDC

 

四、USB 网卡、USB 声卡、ADB 三者共存配置

rm /sys/kernel/config/usb_gadget/g1/configs/c.1/f*
echo 0x18d1 > /sys/kernel/config/usb_gadget/g1/idVendor
echo 0x2d05 > /sys/kernel/config/usb_gadget/g1/idProduct
mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.adb
mkdir /sys/kernel/config/usb_gadget/g1/functions/uac1.gs0 
mkdir /sys/kernel/config/usb_gadget/g1/functions/ncm.usb0
ln -s /sys/kernel/config/usb_gadget/g1/functions/uac1.gs0 /sys/kernel/config/usb_gadget/g1/configs/c.1/f0
ln -s /sys/kernel/config/usb_gadget/g1/functions/ncm.usb0/ /sys/kernel/config/usb_gadget/g1/configs/c.1/f1
ln -s /sys/kernel/config/usb_gadget/g1/functions/ffs.adb /sys/kernel/config/usb_gadget/g1/configs/c.1/f2
ls /sys/class/udc/ | xargs echo > /sys/kernel/config/usb_gadget/g1/UDC

设备端需要设置好网卡的 IP 地址,才能双向通信:

ifconfig usb0 192.168.3.2 up

posted @ 2022-05-24 20:06  Love_梦想  阅读(210)  评论(0编辑  收藏  举报