根据资料的说明,我将tiny200上的/etc/init.d/S98uMTPrd的内容改成了:
start() {
printf "Starting RNDIS: "
mount -t configfs none /sys/kernel/config
mkdir /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
echo 0x1D6B > idVendor
echo 0x0200 > idProduct
mkdir strings/0x409
echo "Widora" > strings/0x409/manufacturer
echo "MangoPi R3" > strings/0x409/product
echo "1234567890" > strings/0x409/serialnumber
mkdir functions/rndis.usb0
mkdir configs/c.1
echo 120 > configs/c.1/MaxPower
ln -s functions/rndis.usb0 configs/c.1
mkdir configs/c.1/strings/0x409
echo "Conf 1" > configs/c.1/strings/0x409/configuration
ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/g1/UDC
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
printf "Stopping RNDIS: "
echo > /sys/kernel/config/usb_gadget/g1/UDC
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
sleep 1
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
然后连接电脑,,在Deepin下可以正常使用这个网卡
但在Windows下不识别,,根据这个资料说需要添加一些设置,,
具体是在“ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/g1/UDC”之前加入如下内容:
echo 1 > os_desc/use
echo 0xcd > os_desc/b_vendor_code
echo MSFT100 > os_desc/qw_sign
ln -s configs/c.1 os_desc
cd functions/rndis.usb0/os_desc/interface.rndis/
echo RNDIS > compatible_id
mkdir Icons
echo 2 > Icons/type
echo "%SystemRoot%/System32\shell32.dll,-233" > Icons/data
mkdir Label
echo 1 > Label/type
echo "XYZ Device" > Label/data
加入后,,连接电脑,,在注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags下看到这个设备的osvc变成了0x01cd,,说明设备返回了MSFT100
但是注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB下该设备的CompatibleIDs不包含WINUSB
该设备不能被识别成WINUSB,,无法安装驱动,,不知道是哪里的问题,,那位大侠知道原因,,请指点下,,谢谢。。
最近编辑记录 XIVN1987 (2020-10-08 21:52:56)
离线
functionfs daemon程序需要写入winusb相关的描述符字段,参考代码
https://github.com/NXPmicro/imx-uuc/blob/master/ufb.c
最近编辑记录 qdk0901 (2021-07-19 15:42:02)
离线