我有 nanopi-neo,它是基于 Allwinner H3 的 linux 板。它支持 USB OTG 模式,所以我想尝试使用 GadgetFS 将其转换为从机。
据我了解,我应该使用此选项重建他们提供的 linux 内核
<*> USB Gadget Drivers
<*> Gadget Filesystem
对于 rootfs 使用这个
Package Selection for the target --->
Hardware handling --->
[*] gadgetfs-test
然后我开始构建和启动电路板。
我遵循本指南并使用了这些命令
root:/dev> mkdir /dev/gadget
root:/dev> mount -t gadgetfs gadgetfs /dev/gadget
[ 219.808688] WRN:L2558(drivers/usb/sunxi_usb/udc/sunxi_udc.c):ERR: Error in bind() : -120
[ 219.827939] nop sunxi_usb_udc: failed to start (null): -120
root:/dev> ls /dev/gadget/ -l
total 0
-rw------- 1 root root 0 Jan 1 00:03 sunxi_usb_udc
我无法找到有关此错误的任何信息。人们面临的大多数问题都是关于 insmod,但我已经在内核中内置了模块。所以我肯定没有这个问题。
然后我为 sunxi ie allwinner sdk 找到了这篇文章,要求我向 otg_role 回显一些值,我做到了,我得到了这个
echo 1 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role
[ 192.310934] sunxi-ehci sunxi-ehci.1: remove, state 4
[ 192.326666] usb usb1: USB disconnect, device number 1
[ 192.343775] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[ 192.370300] sunxi-ohci sunxi-ohci.1: remove, state 4
[ 192.385941] usb usb5: USB disconnect, device number 1
[ 192.402761] sunxi-ohci sunxi-ohci.1: USB bus 5 deregistered
[ 192.444442] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[ 192.458113] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1
[ 192.471720] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000
[ 192.500050] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00
[ 192.511581] hub 1-0:1.0: USB hub found
[ 192.519996] hub 1-0:1.0: 1 port detected
[ 192.548993] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver
[ 192.561898] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 5
[ 192.574365] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400
[ 192.644522] hub 5-0:1.0: USB hub found
[ 192.652612] hub 5-0:1.0: 1 port detected
root@kyloren:/$ # echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role
[ 195.940888] sunxi-ehci sunxi-ehci.1: remove, state 4
[ 195.956330] usb usb1: USB disconnect, device number 1
[ 195.976521] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[ 195.997477] sunxi-ohci sunxi-ohci.1: remove, state 4
[ 196.007624] usb usb5: USB disconnect, device number 1
[ 196.018520] sunxi-ohci sunxi-ohci.1: USB bus 5 deregistered
我尝试再次安装,但我得到了同样的错误。
有人可以指导我吗?