WhyCan Forum

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132 (挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2019-09-15 22:01:35

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

LicheePi Nano Usb复合设备RNDIS功能问题

在做USB复合设备的时候,参考了晕哥之前的文章
   https://www.lotlab.org/2018/07/29/record-of-using-licheepi-part-2-using-linux-gadget
   目前,usb的串口功能可以正常与板子进行交互,但是RNDIS的功能却没有成功
   开机启动的时候,在加载脚本的时候出现 /usr/bin/myusbgadget: line 41: udevadm: not found
   如图片所示
   失败图片

   我查了系统,确实没有udevadm这个程序。
   请问一下,要如何解决这个错误,让系统支持RNDIS功能
   请大家赐教,谢谢

   另外附上myusbgadget脚本的内容
   

#!/bin/sh -e
mount -t configfs none /sys/kernel/config

#modprobe libcomposite

cd /sys/kernel/config/usb_gadget/
mkdir g && cd g

echo 0x1d6b > idVendor  # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB    # USB 2.0

echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol

mkdir -p strings/0x409
echo "deadbeef00115599" > strings/0x409/serialnumber
echo "irq5 labs"        > strings/0x409/manufacturer
echo "Pi Zero Gadget"   > strings/0x409/product

mkdir -p functions/acm.usb0    # serial
mkdir -p functions/rndis.usb0  # network

mkdir -p configs/c.1
echo 250 > configs/c.1/MaxPower
ln -s functions/rndis.usb0 configs/c.1/
ln -s functions/acm.usb0   configs/c.1/

# OS descriptors
echo 1       > os_desc/use
echo 0xcd    > os_desc/b_vendor_code
echo MSFT100 > os_desc/qw_sign

echo RNDIS   > functions/rndis.usb0/os_desc/interface.rndis/compatible_id
echo 5162001 > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id

ln -s configs/c.1 os_desc

udevadm settle -t 5 || :
ls /sys/class/udc/ > UDC

离线

#2 2019-09-15 22:06:49

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

udevadm 这个命令没有找到,这个是干嘛用的?

离线

#3 2019-09-15 22:10:56

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

我去看下 buildroot有没有

离线

#4 2019-09-15 22:20:24

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

https://github.com/gentoo/eudev/blob/master/src/udev/udevadm.c
https://github.com/systemd/systemd/blob/master/src/udev/udevadm.c

找到了这两个, 在 buildroot里面开启 eudev 或 systemd, 应该都可以生成 udevadm 命令,重新打包文件系统即可.

离线

#5 2019-09-17 23:27:10

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

https://github.com/gentoo/eudev/blob/master/src/udev/udevadm.c
https://github.com/systemd/systemd/blob/master/src/udev/udevadm.c

找到了这两个, 在 buildroot里面开启 eudev 或 systemd, 应该都可以生成 udevadm 命令,重新打包文件系统即可.


按照你的方法,在buildroot开启了eudev方式,可以支持udevadm了
但是在 /etc/inittab 文件中添加

ttyGS0::respawn:/bin/getty -L ttyGS0 57600 vt100

重新开机后,此时一直提示

can't open /dev/ttyGS0: No such file or directory

具体的log打印如下

U-Boot SPL 2018.01-05679-g013ca45-dirty (Sep 14 2019 - 09:15:39)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01-05679-g013ca45-dirty (Sep 14 2019 - 09:15:39 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e5f000, end 80e63f3e ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@8f872d65ac02) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #3 Tue Sep 17 20:54:11 CST 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22672K/32768K available (6144K kernel code, 238K rwdata, 1420K rodata, 1024K init, 246K bss, 10096K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 239 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000053] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000121] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000742] Console: colour dummy device 80x30
[    0.000834] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070248] pid_max: default: 32768 minimum: 301
[    0.070579] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070626] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072196] CPU: Testing write buffer coherency: ok
[    0.074092] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076801] devtmpfs: initialized
[    0.083611] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.083689] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083984] pinctrl core: initialized pinctrl subsystem
[    0.086296] NET: Registered protocol family 16
[    0.088275] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.090427] cpuidle: using governor menu
[    0.117755] SCSI subsystem initialized
[    0.118119] usbcore: registered new interface driver usbfs
[    0.118313] usbcore: registered new interface driver hub
[    0.118544] usbcore: registered new device driver usb
[    0.119030] pps_core: LinuxPPS API ver. 1 registered
[    0.119058] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.119133] PTP clock support registered
[    0.119653] Advanced Linux Sound Architecture Driver Initialized.
[    0.121472] clocksource: Switched to clocksource timer
[    0.150908] NET: Registered protocol family 2
[    0.152644] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.152734] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.152796] TCP: Hash tables configured (established 1024 bind 1024)
[    0.153161] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.153235] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.153763] NET: Registered protocol family 1
[    0.155101] RPC: Registered named UNIX socket transport module.
[    0.155145] RPC: Registered udp transport module.
[    0.155162] RPC: Registered tcp transport module.
[    0.155178] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.157376] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.159434] Initialise system trusted keyrings
[    0.160056] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.178458] NFS: Registering the id_resolver key type
[    0.178547] Key type id_resolver registered
[    0.178569] Key type id_legacy registered
[    0.178694] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.194515] Key type asymmetric registered
[    0.194562] Asymmetric key parser 'x509' registered
[    0.194795] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.194832] io scheduler noop registered
[    0.194851] io scheduler deadline registered
[    0.195723] io scheduler cfq registered (default)
[    0.195755] io scheduler mq-deadline registered
[    0.195774] io scheduler kyber registered
[    0.196951] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.207245] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.395674] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.403119] console [ttyS0] disabled
[    0.423394] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.898437] console [ttyS0] enabled
[    0.909281] panel-simple panel: panel supply power not found, using dummy regulator
[    0.918927] SCSI Media Changer driver v0.25
[    0.926990] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.931906] 4 ofpart partitions found on MTD device spi0.0
[    0.937398] Creating 4 MTD partitions on "spi0.0":
[    0.942283] 0x000000000000-0x000000100000 : "u-boot"
[    0.950163] 0x000000100000-0x000000110000 : "dtb"
[    0.957745] 0x000000110000-0x000000510000 : "kernel"
[    0.965585] 0x000000510000-0x000001000000 : "rootfs"
[    0.974053] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.980594] ehci-platform: EHCI generic platform driver
[    0.986258] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.992584] ohci-platform: OHCI generic platform driver
[    0.998237] usbcore: registered new interface driver usb-storage
[    1.005630] i2c /dev entries driver
[    1.071589] sunxi-mmc 1c0f000.mmc: base:0xe00f6a2d irq:19
[    1.079275] usbcore: registered new interface driver usbhid
[    1.084983] usbhid: USB HID core driver
[    1.107926] NET: Registered protocol family 17
[    1.112799] Key type dns_resolver registered
[    1.119638] Loading compiled-in X.509 certificates
[    1.136194] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739e58)
[    1.145137] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073913c)
[    1.152941] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.159548] [drm] No driver support for vblank timestamp query.
[    1.213724] Console: switching to colour frame buffer device 60x34
[    1.236954] sun4i-drm display-engine: fb0:  frame buffer device
[    1.244152] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.253326] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.265194] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.271028] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.281190] hub 1-0:1.0: USB hub found
[    1.285240] hub 1-0:1.0: 1 port detected
[    1.291656] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.309222] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.316077] vcc3v3: disabling
[    1.319063] ALSA device list:
[    1.322107]   #0: Loopback 1
[    1.325907] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.334624] cfg80211: failed to load regulatory.db
[    1.445369] random: crng init done
[    3.602614] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    3.622793] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    3.631267] devtmpfs: mounted
[    3.639025] Freeing unused kernel memory: 1024K
Starting syslogd: OK
Starting klogd: OK
Populating /dev using udev: [    9.556114] udevd[77]: starting version 3.2.7
[    9.790446] udevd[77]: specified group 'kvm' unknown
[    9.993605] udevd[78]: starting eudev-3.2.7
done
Initializing random number generator... done.
Starting network: OK
can't open /dev/ttyGS0: No such file or directory

Welcome to Buildroot
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory
can't open /dev/ttyGS0: No such file or directory

尝试参考链接
https://whycan.cn/t_2401.html
想使用命令

modprobe g_serial

加载起来,但发现返回错误

modprobe: can't open 'modules.dep': No such file or directory

感觉是驱动没有加载,请问要如何解决这个问题?
目前是usb的串口跟RNDIS都无法工作

最近编辑记录 lanjackg2003 (2019-09-17 23:28:59)

离线

#6 2019-09-18 10:05:39

xm1994
会员
注册时间: 2019-07-03
累计积分: 27

Re: LicheePi Nano Usb复合设备RNDIS功能问题

你装的是g_cdc驱动,但是脚本用的configfs。 内核选项里关掉legacy usb gadget, 启用configfs usb gadget再试试。

离线

#7 2019-09-18 10:09:41

xm1994
会员
注册时间: 2019-07-03
累计积分: 27

Re: LicheePi Nano Usb复合设备RNDIS功能问题

Device Drivers  ---> USB support  --->    USB Gadget Support  --->
enable  USB Gadget functions configurable through configfs 
disable  USB Gadget precomposed configurations

离线

#8 2019-09-18 11:21:57

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

xm1994 说:

Device Drivers  ---> USB support  --->    USB Gadget Support  --->
enable  USB Gadget functions configurable through configfs 
disable  USB Gadget precomposed configurations

是的,目前这个log的打印信息,就是已在linux的内核里面配置了
enable  USB Gadget functions configurable through configfs 
disable  USB Gadget precomposed configurations

离线

#9 2019-09-18 20:12:04

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

xm1994 说:

Device Drivers  ---> USB support  --->    USB Gadget Support  --->
enable  USB Gadget functions configurable through configfs 
disable  USB Gadget precomposed configurations

https://whycan.cn/files/members/1741/2019-09-18_20-09-37.png

查看 .config 文件,如图片所示,相关的配置也是对的

离线

#10 2019-09-18 20:29:02

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

can't open /dev/ttyGS0: No such file or directory

modprobe: can't open 'modules.dep': No such file or directory

是这个问题吗?

这个问题是因为你的modules没有安装正确:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/opt/buildroot-2019.08-hf/output/target/  make modules_install

离线

#11 2019-09-18 20:44:10

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

can't open /dev/ttyGS0: No such file or directory

modprobe: can't open 'modules.dep': No such file or directory

是这个问题吗?

这个问题是因为你的modules没有安装正确:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/opt/buildroot-2019.08-hf/output/target/  make modules_install

是的,我按照这样子弄
在 /lib/modules/4.15.0-rc8-licheepi-nano+/ 会产生这个些文件
https://whycan.cn/files/members/1741/2019-09-18_20-42-56.png

但是没有问题还是那样子

离线

#12 2019-09-18 20:56:49

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

/lib/modules/4.15.0-rc8-licheepi-nano+/ 这下面有问题吗?

du -sh /lib/modules/4.15.0-rc8-licheepi-nano+/

find /lib/modules/4.15.0-rc8-licheepi-nano+/ |grep \\.ko$

离线

#13 2019-09-18 20:57:45

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

图片是我看到的信息
https://whycan.cn/files/members/1741/2019-09-18_20-55-25.png

离线

#14 2019-09-18 21:01:52

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

/lib/modules/4.15.0-rc8-licheepi-nano+/ 这下面有问题吗?

du -sh /lib/modules/4.15.0-rc8-licheepi-nano+/

find /lib/modules/4.15.0-rc8-licheepi-nano+/ |grep \\.ko$


https://whycan.cn/files/members/1741/2019-09-18_21-01-01_20190918-2102.png

这个是执行之后的打印信息

最近编辑记录 lanjackg2003 (2019-09-18 21:02:51)

离线

#15 2019-09-18 21:04:33

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

不完整, 缺 modules.dep.bin, modules.dep


删除 lib/modules/4.15.0-rc8-licheepi-nano+/ 目录:

rm lib/modules/4.15.0-rc8-licheepi-nano+/ -rf

重新执行前面的 modules_install

离线

#16 2019-09-18 21:13:45

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

不完整, 缺 modules.dep.bin, modules.dep


删除 lib/modules/4.15.0-rc8-licheepi-nano+/ 目录:

rm lib/modules/4.15.0-rc8-licheepi-nano+/ -rf

重新执行前面的 modules_install

https://whycan.cn/files/members/1741/2019-09-18_21-12-44.png
重新安装也仍然没有生成 modules.dep.bin, modules.dep 这两个文件

离线

#17 2019-09-18 21:38:45

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

这就尴尬了

只能死马做活马医了:
https://www.linuxquestions.org/questions/linux-newbie-8/can%27t-open-modules-dep-file-110072/
http://www.armbbs.net/forum.php?mod=viewthread&tid=15753


busybox 里面开启 depmod

然后命令行执行 depmod 相关命令试一试.

离线

#18 2019-09-18 22:39:27

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

lanjackg2003 说:
晕哥 说:

不完整, 缺 modules.dep.bin, modules.dep


删除 lib/modules/4.15.0-rc8-licheepi-nano+/ 目录:

rm lib/modules/4.15.0-rc8-licheepi-nano+/ -rf

重新执行前面的 modules_install

https://whycan.cn/files/members/1741/2019-09-18_21-12-44.png
重新安装也仍然没有生成 modules.dep.bin, modules.dep 这两个文件

参考链接
http://blog.chinaunix.net/uid-10386087-id-2959091.html
https://whycan.cn/files/members/1741/QQ20190918222909.png

如文章说的那样情况,查看了我的编译环境,发现确实没有 depmod 这个命令
通过如下命令安装

sudo apt-get install module-init-tools

然后再重新执行

ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/opt/lichee/buildroot/output/target/  make modules_install

可以看到现在能够正常生成 modules.dep.bin, modules.dep 文件了
https://whycan.cn/files/members/1741/2019-09-18_22-33-24.png

离线

#19 2019-09-18 22:52:58

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

不完整, 缺 modules.dep.bin, modules.dep


删除 lib/modules/4.15.0-rc8-licheepi-nano+/ 目录:

rm lib/modules/4.15.0-rc8-licheepi-nano+/ -rf

重新执行前面的 modules_install

现在modules.dep.bin, modules.dep 可以正常生成了,但是没有办法加载起来

# modprobe u_serial
modprobe: module u_serial not found in modules.dep
# modprobe g_serial
modprobe: module g_serial not found in modules.dep
# ttyGS0::respawn:/bin/getty -L ttyGS0 57600 vt100
-sh: ttyGS0::respawn:/bin/getty: not found
#

离线

#20 2019-09-18 22:55:50

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

勾选 usb gadget 相关选项,确认生成了 g_serial.ko

离线

#21 2019-09-18 22:59:45

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

QQ20190918225835.png

离线

#22 2019-09-18 23:41:41

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

串口已经正常工作了
现在RNDIS还是有问题,加载不起来

离线

#23 2019-09-19 00:04:15

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

通过以下命令加载驱动

# modprobe g_ether
# /usr/bin/myusbgadget
[   37.326944] using random self ethernet address
[   37.331582] using random host ethernet address
# ifconfig usb0 192.168.1.66
ifconfig: SIOCSIFADDR: No such device
#

Win10的设备管理器,没有看到任何新的设备。

RDNIS驱动应该加载那个驱动呢?

g_acm_ms.ko        g_ether.ko         g_midi.ko          g_serial.ko
g_audio.ko         g_ffs.ko           g_multi.ko         g_zero.ko
g_cdc.ko           g_hid.ko           g_ncm.ko           gadgetfs.ko
g_dbgp.ko          g_mass_storage.ko  g_printer.ko
#

或者应该如何才能够支持RDNIS?


另附上我的内核启动日志

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@3f250398f810) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #7 Wed Sep 18 23:37:49 CST 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22668K/32768K available (6144K kernel code, 244K rwdata, 1432K rodata, 1024K init, 246K bss, 10100K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 245 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000049] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000122] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000762] Console: colour dummy device 80x30
[    0.000848] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070249] pid_max: default: 32768 minimum: 301
[    0.070585] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070635] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072228] CPU: Testing write buffer coherency: ok
[    0.074130] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076714] devtmpfs: initialized
[    0.083494] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.083571] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083858] pinctrl core: initialized pinctrl subsystem
[    0.086162] NET: Registered protocol family 16
[    0.088141] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.089910] cpuidle: using governor menu
[    0.116670] SCSI subsystem initialized
[    0.117044] usbcore: registered new interface driver usbfs
[    0.117231] usbcore: registered new interface driver hub
[    0.117462] usbcore: registered new device driver usb
[    0.117934] pps_core: LinuxPPS API ver. 1 registered
[    0.117964] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.118033] PTP clock support registered
[    0.118577] Advanced Linux Sound Architecture Driver Initialized.
[    0.120059] clocksource: Switched to clocksource timer
[    0.148723] NET: Registered protocol family 2
[    0.150304] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.150394] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.150445] TCP: Hash tables configured (established 1024 bind 1024)
[    0.150826] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.150890] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.151429] NET: Registered protocol family 1
[    0.152779] RPC: Registered named UNIX socket transport module.
[    0.152827] RPC: Registered udp transport module.
[    0.152844] RPC: Registered tcp transport module.
[    0.152860] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.155173] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.157153] Initialise system trusted keyrings
[    0.157769] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.176052] NFS: Registering the id_resolver key type
[    0.176151] Key type id_resolver registered
[    0.176174] Key type id_legacy registered
[    0.176296] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.191672] Key type asymmetric registered
[    0.191720] Asymmetric key parser 'x509' registered
[    0.191952] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.191991] io scheduler noop registered
[    0.192009] io scheduler deadline registered
[    0.192832] io scheduler cfq registered (default)
[    0.192865] io scheduler mq-deadline registered
[    0.192885] io scheduler kyber registered
[    0.193953] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.204266] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.387506] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.394930] console [ttyS0] disabled
[    0.415188] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.890160] console [ttyS0] enabled
[    0.901038] panel-simple panel: panel supply power not found, using dummy regulator
[    0.910627] SCSI Media Changer driver v0.25
[    0.918446] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.923360] 4 ofpart partitions found on MTD device spi0.0
[    0.928849] Creating 4 MTD partitions on "spi0.0":
[    0.933732] 0x000000000000-0x000000100000 : "u-boot"
[    0.941739] 0x000000100000-0x000000110000 : "dtb"
[    0.949107] 0x000000110000-0x000000510000 : "kernel"
[    0.956905] 0x000000510000-0x000001000000 : "rootfs"
[    0.965336] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.972016] ehci-platform: EHCI generic platform driver
[    0.977556] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.983875] ohci-platform: OHCI generic platform driver
[    0.989512] usbcore: registered new interface driver usb-storage
[    0.996928] i2c /dev entries driver
[    1.060205] sunxi-mmc 1c0f000.mmc: base:0xca4ab8fe irq:19
[    1.067828] usbcore: registered new interface driver usbhid
[    1.073548] usbhid: USB HID core driver
[    1.096230] NET: Registered protocol family 17
[    1.101110] Key type dns_resolver registered
[    1.107921] Loading compiled-in X.509 certificates
[    1.124698] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739e58)
[    1.133622] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073913c)
[    1.141426] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.148037] [drm] No driver support for vblank timestamp query.
[    1.202230] Console: switching to colour frame buffer device 60x34
[    1.225453] sun4i-drm display-engine: fb0:  frame buffer device
[    1.232628] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.241788] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.253697] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.259530] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.269679] hub 1-0:1.0: USB hub found
[    1.273735] hub 1-0:1.0: 1 port detected
[    1.279982] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.297594] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.304451] vcc3v3: disabling
[    1.307435] ALSA device list:
[    1.310481]   #0: Loopback 1
[    1.314281] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.322996] cfg80211: failed to load regulatory.db
[    1.433533] random: crng init done
[    3.624540] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    3.644878] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    3.653603] devtmpfs: mounted
[    3.661349] Freeing unused kernel memory: 1024K
Starting syslogd: OK
Starting klogd: OK
Populating /dev using udev: [    9.768901] udevd[77]: starting version 3.2.7
[   10.058329] udevd[77]: specified group 'kvm' unknown
[   10.263945] udevd[78]: starting eudev-3.2.7
done
[   15.916618] g_serial gadget: Gadget Serial v2.4
[   15.921310] g_serial gadget: g_serial ready
[   16.003844] udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers
Initializing random number generator... done.
[   16.324182] g_serial gadget: high-speed config #2: CDC ACM config
[   16.330369] gs_console_connect: port num [0] is not support console
Starting network: OK

Welcome to Buildroot

最近编辑记录 lanjackg2003 (2019-09-19 00:05:26)

离线

#24 2019-09-19 08:16:17

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

测试 usb IP网络: https://whycan.cn/t_2401.html#p18389

你先卸载 g_serial: modprobe -r g_serial

然后才可以用 g_ether

离线

#25 2019-09-19 08:21:04

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

另外有一个 serial + ethernet 的 usb gadget 复合驱动

离线

#26 2019-09-19 10:33:52

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

另外有一个 serial + ethernet 的 usb gadget 复合驱动


晕哥,请问这个serial + ethernet 的 usb gadget 复合驱动是哪个

离线

#27 2019-09-19 10:43:53

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

make menuconfig 上面有提示。

离线

#28 2019-09-19 23:38:16

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

另外有一个 serial + ethernet 的 usb gadget 复合驱动

我尝试加载g_multi.ko 但是报了如下无效参数的错误

#
# modprobe g_multi.ko
[  110.008847] using random self ethernet address
[  110.013464] using random host ethernet address
[  110.023788] Mass Storage Function, version: 2009/09/11
[  110.028952] LUN: removable file: (no medium)
[  110.033420] no file given for LUN0
[  110.045133] console [ttyGS-1] disabled
[  110.049026] g_multi musb-hdrc.1.auto: failed to start g_multi: -22
[  110.066121] using random self ethernet address
[  110.070736] using random host ethernet address
[  110.079196] Mass Storage Function, version: 2009/09/11
[  110.084502] LUN: removable file: (no medium)
[  110.088833] no file given for LUN0
[  110.100390] console [ttyGS-1] disabled
[  110.104295] g_multi musb-hdrc.1.auto: failed to start g_multi: -22
modprobe: can't load module g_multi.ko (kernel/drivers/usb/gadget/legacy/g_multi.ko): Invalid argument

请问 modprobe g_multi.ko 后面还要带什么参数吗

另外附上设备上的驱动内容

  INSTALL crypto/echainiv.ko
  INSTALL drivers/input/touchscreen/goodix.ko
  INSTALL drivers/net/mii.ko
  INSTALL drivers/net/usb/rtl8150.ko
  INSTALL drivers/staging/rtl8723bs/r8723bs.ko
  INSTALL drivers/usb/gadget/function/usb_f_mass_storage.ko
  INSTALL drivers/usb/gadget/legacy/g_cdc.ko
  INSTALL drivers/usb/gadget/legacy/g_ether.ko
  INSTALL drivers/usb/gadget/legacy/g_multi.ko
  INSTALL drivers/usb/gadget/legacy/g_ncm.ko
  INSTALL drivers/usb/gadget/legacy/g_serial.ko
  INSTALL drivers/usb/mon/usbmon.ko
  INSTALL drivers/video/backlight/lcd.ko
  DEPMOD  4.15.0-rc8-licheepi-nano+

离线

#29 2019-09-20 10:11:32

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

昨天将单独的USB转串口以及USB的RNDIS的开启方法,整理出来写成文章,放到我的CSDN博客,有需要的可以过去看看
https://blog.csdn.net/lan120576664/article/details/101037170
https://blog.csdn.net/lan120576664/article/details/101039293

下一步待Serial + RNDIS 研究成功后,也重新总结一下方法

离线

#30 2019-09-20 10:27:34

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

不错, 感谢分享!

modprobe g_multi  的问题搞定了吗?

离线

#31 2019-09-20 10:32:51

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

不错, 感谢分享!

modprobe g_multi  的问题搞定了吗?

没有呢
还需要晕哥再指导一下

离线

#32 2019-09-20 10:57:58

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

https://blog.csdn.net/sinat_19447667/article/details/78562568

  *     removable               Default false, boolean for removable media
  *     luns=N                  Default N = number of filenames, number of
  *                                     LUNs to support
+ *     stall                   Default determined according to the type ofdevice controller (usually true),
+ *                                     boolean to permit the driver to halt
+ *                                     bulk endpoints
  *     transport=XXX           Default BBB, transport name (CB, CBI, or BBB)
  *     protocol=YYY            Default SCSI, protocol name (RBC, 8020 or
  *                                     ATAPI, QIC, UFI, 8070, or SCSI;
@@ -91,14 +95,10 @@
  *     buflen=N                Default N=16384, buffer size used (will be
  *                                     rounded down to a multiple of
  *                                     PAGE_CACHE_SIZE)
- *     stall                   Default determined according to the type of
- *                                     USB device controller (usually true),
- *                                     boolean to permit the driver to halt
- *                                     bulk endpoints

通用命令: modprobe g_multi file=/dev/mmcblk1p1,/mnt/p1/static.img,/dev/mmcblk0p1 luns=3 ro=0,1,1 stall=0,0,0 removable=1,1,1 iSerialNumber=3000111 iProduct=zhdgnss iManufactuy=zhd_survey

这里表示的是将linux设备的3个块设备进行PC映射显示,具体的属性设置可看上面的说明;


g_multi 完成的功能应该是一次可以挂几个文件。

离线

#33 2019-09-20 11:01:52

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 7,826

Re: LicheePi Nano Usb复合设备RNDIS功能问题

甚至还可以挂载 ISO 文件: https://www.cnblogs.com/sjqlwy/p/pocketbeagle_review.html

modprobe g_multi file=${boot_drive} cdrom=0 ro=0 stall=0 removable=1 nofua=1 ${g_network} || true



https://talpachen.github.io/2016/11/13/eLinux/Beagleboneblack/

	if [ ! "x${test_usb_image_file}" = "x" ] ; then
		modprobe g_multi file=${usb_image_file} cdrom=1 ro=1 stall=0 removable=1 nofua=1 ${g_network} || true
	else
		modprobe g_multi file=${usb_image_file} cdrom=0 ro=1 stall=0 removable=1 nofua=1 ${g_network} || true
	fi

离线

#34 2019-09-20 22:37:04

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

晕哥 说:

https://blog.csdn.net/sinat_19447667/article/details/78562568

  *     removable               Default false, boolean for removable media
  *     luns=N                  Default N = number of filenames, number of
  *                                     LUNs to support
+ *     stall                   Default determined according to the type ofdevice controller (usually true),
+ *                                     boolean to permit the driver to halt
+ *                                     bulk endpoints
  *     transport=XXX           Default BBB, transport name (CB, CBI, or BBB)
  *     protocol=YYY            Default SCSI, protocol name (RBC, 8020 or
  *                                     ATAPI, QIC, UFI, 8070, or SCSI;
@@ -91,14 +95,10 @@
  *     buflen=N                Default N=16384, buffer size used (will be
  *                                     rounded down to a multiple of
  *                                     PAGE_CACHE_SIZE)
- *     stall                   Default determined according to the type of
- *                                     USB device controller (usually true),
- *                                     boolean to permit the driver to halt
- *                                     bulk endpoints

通用命令: modprobe g_multi file=/dev/mmcblk1p1,/mnt/p1/static.img,/dev/mmcblk0p1 luns=3 ro=0,1,1 stall=0,0,0 removable=1,1,1 iSerialNumber=3000111 iProduct=zhdgnss iManufactuy=zhd_survey

这里表示的是将linux设备的3个块设备进行PC映射显示,具体的属性设置可看上面的说明;


g_multi 完成的功能应该是一次可以挂几个文件。

谢谢,晕哥。按照你的指导方法,已经成功使用上了serial + RNDIS
博客文章已经总结完毕,待审核通过后,补上链接

离线

#35 2019-09-21 09:14:06

Jmhh247
会员
注册时间: 2018-12-21
累计积分: 139

Re: LicheePi Nano Usb复合设备RNDIS功能问题

多谢楼主分享,之前按照< 测试测试 g_serial / g_ether USB Gadget (RNDIS)>帖子没成功,

以后试试楼主的。

离线

#36 2019-09-22 09:34:01

lanjackg2003
会员
注册时间: 2019-06-12
累计积分: 28

Re: LicheePi Nano Usb复合设备RNDIS功能问题

lanjackg2003 说:
晕哥 说:

https://blog.csdn.net/sinat_19447667/article/details/78562568

  *     removable               Default false, boolean for removable media
  *     luns=N                  Default N = number of filenames, number of
  *                                     LUNs to support
+ *     stall                   Default determined according to the type ofdevice controller (usually true),
+ *                                     boolean to permit the driver to halt
+ *                                     bulk endpoints
  *     transport=XXX           Default BBB, transport name (CB, CBI, or BBB)
  *     protocol=YYY            Default SCSI, protocol name (RBC, 8020 or
  *                                     ATAPI, QIC, UFI, 8070, or SCSI;
@@ -91,14 +95,10 @@
  *     buflen=N                Default N=16384, buffer size used (will be
  *                                     rounded down to a multiple of
  *                                     PAGE_CACHE_SIZE)
- *     stall                   Default determined according to the type of
- *                                     USB device controller (usually true),
- *                                     boolean to permit the driver to halt
- *                                     bulk endpoints

通用命令: modprobe g_multi file=/dev/mmcblk1p1,/mnt/p1/static.img,/dev/mmcblk0p1 luns=3 ro=0,1,1 stall=0,0,0 removable=1,1,1 iSerialNumber=3000111 iProduct=zhdgnss iManufactuy=zhd_survey

这里表示的是将linux设备的3个块设备进行PC映射显示,具体的属性设置可看上面的说明;


g_multi 完成的功能应该是一次可以挂几个文件。

谢谢,晕哥。按照你的指导方法,已经成功使用上了serial + RNDIS
博客文章已经总结完毕,待审核通过后,补上链接

https://blog.csdn.net/lan120576664/article/details/101081608
补 Serial + RNDIS的实现 博文

离线

页脚