From 355742bd9bee59228fbbce1a56551a562f6539f9 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Thu, 22 Aug 2024 20:33:21 +0800 Subject: [PATCH] Documentation/sim: add cdcmbim examples We can send and receive data through device files nuttx: /dev/cdc-wdm2 linux: /dev/cdc-wdm1 The number suffix depends on the actual situation. And send and receive messages through network cards. Signed-off-by: zhanghongyu --- .../platforms/sim/sim/boards/sim/index.rst | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Documentation/platforms/sim/sim/boards/sim/index.rst b/Documentation/platforms/sim/sim/boards/sim/index.rst index 0c67290f4bcf7..f3e3abb717e6e 100644 --- a/Documentation/platforms/sim/sim/boards/sim/index.rst +++ b/Documentation/platforms/sim/sim/boards/sim/index.rst @@ -1669,6 +1669,7 @@ This is a configuration with sim usbdev support. conn0: adb & rndis conn1: cdcacm & cdcecm conn2: cdcncm + conn3: cdcmbim You can use the sim:usbdev configuration:: @@ -1801,6 +1802,46 @@ This is a configuration with sim usbdev support. Then you can test the network connection using the ping command or telnet. + 6> Run CDCMBIM: + + NuttX enter command:: + + $ conn 3 + $ ifconfig + eth0 Link encap:Ethernet HWaddr 42:67:c6:69:73:51 at RUNNING mtu 1500 + inet addr:10.0.1.2 DRaddr:10.0.1.1 Mask:255.255.255.0 + wwan0 Link encap:UNSPEC at RUNNING mtu 1200 + inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0 + $ ifconfig wwan0 10.0.0.1 netmask 255.255.255.0 + $ ifconfig + eth0 Link encap:Ethernet HWaddr 42:67:c6:69:73:51 at RUNNING mtu 1500 + inet addr:10.0.1.2 DRaddr:10.0.1.1 Mask:255.255.255.0 + wwan0 Link encap:UNSPEC at RUNNING mtu 1200 + inet addr:10.0.0.1 DRaddr:10.0.0.1 Mask:255.255.255.0 + + $ echo -n "hello from nuttx" > /dev/cdc-wdm2 + $ cat /dev/cdc-wdm2 + hello from linux + + Host PC, you can see the network device named wwx020000112233:: + + $ sudo ifconfig wwx020000112233 + $ sudo ifconfig wwx020000112233 10.0.0.2 netmask 255.255.255.0 + $ ifconfig + wwx020000112233: flags=4226 mtu 1500 + inet 10.0.0.2 netmask 255.255.255.0 broadcast 10.0.0.255 + ether 02:00:00:11:22:33 txqueuelen 1000 (以太网) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 58 bytes 9143 (9.1 KB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + + $ sudo cat /dev/cdc-wdm1 + hello from nuttx + $ sudo bash -c "echo -n hello from linux > /dev/cdc-wdm1" + + Then you can test the network connection using the ping command or telnet. + usbhost -------