orangepi-xunlong / linux-orangepi

Other
200 stars 174 forks source link

Zero3 OTG虚拟成RNDIS出现异常 #46

Open evaxige opened 1 year ago

evaxige commented 1 year ago

基本情况

烧录固件:Orangepizero3_1.0.0_ubuntu_jammy_server_linux5.4.125.7z

当前使用内核:https://github.com/orangepi-xunlong/linux-orangepi/tree/a187b273f42c0c5169d8ed46d2a0abece97fb0d4

PC电脑:Windows 7 64bit系统;

要实现的功能

使用Zero3的Type-C接口插入到电脑中,并虚拟成RNDIS类型的网卡;

遇到的问题

直接加载g_ether驱动会报错,操作如下:

# modprobe g_ether

[   96.967946] udc 5100000.udc-controller: registering UDC driver [g_ether]
[   96.968349] g_ether 5100000.udc-controller: failed to start g_ether: -2

对比Zero2开发板的驱动加载情况,手动载入usb_f_eem驱动,操作如下:

modprobe usb_f_eem
modprobe g_ether

[  170.854263] udc 5100000.udc-controller: registering UDC driver [g_ether]
[  170.854343] using random self ethernet address
[  170.854351] using random host ethernet address
[  170.855489] usb0: HOST MAC ee:57:e3:20:20:7d
[  170.855617] usb0: MAC b2:be:53:20:54:2e
[  170.855647] using random self ethernet address
[  170.855654] using random host ethernet address

这时PC机上可以看到设备,加载对应驱动(参考:https://supportcommunity.zebra.cn/s/article/000014464)之后,但是会提示网卡无法启动,具体为:“该设备无法启动。 (代码 10)”,同时Zero3的dmesg会出现如下的错误信息:

[  171.127318] ERR: Operation not supported

打开调试信息重新编译驱动,更详细的异常信息如下:

[  170.855688] g_ether gadget: adding config #2 'RNDIS'/00000000339d2b56
[  170.855705] rndis_register: configNr = 0
[  170.855717] g_ether gadget: adding 'rndis'/000000001ee5ea71 to config 'RNDIS'/00000000339d2b56
[  170.855745] rndis_set_param_medium: 0 0
[  170.855754] g_ether gadget: RNDIS: dual speed IN/ep1in-bulk OUT/ep1out-bulk NOTIFY/ep4-int
[  170.855765] g_ether gadget: cfg 2/00000000339d2b56 speeds: high full
[  170.855773] g_ether gadget:   interface 0 = rndis/000000001ee5ea71
[  170.855781] g_ether gadget:   interface 1 = rndis/000000001ee5ea71
[  170.855790] g_ether gadget: adding config #1 'CDC Ethernet (EEM)'/000000005b119b69
[  170.855801] g_ether gadget: adding 'cdc_eem'/000000000e911c10 to config 'CDC Ethernet (EEM)'/000000005b119b69
[  170.855816] g_ether gadget: CDC Ethernet (EEM): dual speed IN/ep1in-bulk OUT/ep1out-bulk
[  170.855825] g_ether gadget: cfg 1/000000005b119b69 speeds: high full
[  170.855833] g_ether gadget:   interface 0 = cdc_eem/000000000e911c10
[  170.855848] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[  170.855855] g_ether gadget: g_ether ready
[  171.010794] sunxi_set_cur_vol_work()395 WARN: get power supply failed
[  171.126232] g_ether gadget: high-speed config #2: RNDIS
[  171.126246] g_ether gadget: reset rndis control 0
[  171.126249] g_ether gadget: init rndis ctrl 0
[  171.126261] g_ether gadget: init rndis
[  171.126264] g_ether gadget: RNDIS RX/TX early activation ... 
[  171.126307] usb0: qlen 10
[  171.126310] g_ether gadget: rndis_close
[  171.126313] rndis_set_param_medium: 0 0
[  171.126321] rndis_set_param_dev:
[  171.126854] g_ether gadget: setup complete --> -71, 0/0
[  171.126860] g_ether gadget: non-core control reqa1.21 v0000 i0000 l7
[  171.126865] g_ether gadget: invalid control reqa1.21 v0000 i0000 l7
[  171.126867] ERR: Operation not supported
[  171.127072] g_ether gadget: non-core control req21.22 v0000 i0000 l0
[  171.127075] g_ether gadget: invalid control req21.22 v0000 i0000 l0
[  171.127077] ERR: Operation not supported
[  171.127087] handle_ep0: ep0 setup end
[  171.127314] g_ether gadget: non-core control req21.20 v0000 i0000 l7
[  171.127317] g_ether gadget: invalid control req21.20 v0000 i0000 l7
[  171.127318] ERR: Operation not supported
[  171.127507] g_ether gadget: non-core control reqa1.21 v0000 i0000 l7
[  171.127511] g_ether gadget: invalid control reqa1.21 v0000 i0000 l7
[  171.127512] ERR: Operation not supported