页次: 1
参照 https://whycan.com/t_1626.html ,修改驱动
1.make ARCH=arm menuconfig,进入Device Drivers/USB support/USB Gadget Support,选中USB Gadget Drivers (Ethernet Gadget (with CDC Ethernet support))以及RNDIS support
2.修改sys_config.fex中的usb_port_type = 0,使usb处于device模式
3.修改sunxi_udc.c
4.修改usbc.c
同上以上步骤即可实现USB虚拟成网卡
OTG切换到device模式了吗?
sys_config.fex中的USB我是这么配置的
;----------------------------------------------------------------------------------
;usb configuration
;usb_used: usb controller enable, 0-disable, 1-enable
;usb_port_type: usb mode: 0-device, 1-host, 2-otg
;usb_detect_type: usb hotplug detect mode, 0-none, 1-vbus/id detect, 2-id/dpdm detect
;usb_id_gpio: usb id detect IO
;usb_det_vbus_gpio: usb vbus detect IO, "axp_ctrl" for axp
;usb_drv_vbus_gpio: usb dirve vbus IO
;usb_restrict_gpio: usb current restrict IO
;usb_restric_flag: usb current restrict flag
;----------------------------------------------------------------------------------
[usbc0]
usb_used = 1
usb_port_type = 0
usb_detect_type = 1
usb_id_gpio = port:PF6<0><1><default><default>
usb_det_vbus_gpio = port:PF6<0><1><default><default>
usb_drv_vbus_gpio = port:PG3<1><0><default><0>
usb_restrict_gpio =
usb_host_init_state = 0
usb_restric_flag = 0
usb_restric_voltage = 3550000
usb_restric_capacity= 5
usb_regulator_io = "nocare"
usb_regulator_vol = 0
usb_not_suspend = 0
配置如下:
insmod g_ether.ko信息如下:
[ 459.502260] g_ether gadget: using random self ethernet address
[ 459.508903] g_ether gadget: using random host ethernet address
[ 459.529760] usb0: MAC 22:01:32:dc:e1:b4
[ 459.534219] usb0: HOST MAC 56:6c:b8:9d:b9:36
[ 459.552964] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 459.561290] g_ether gadget: g_ether ready
但是没有显示RNDIS,PC机也没有识别出USB
页次: 1