File tree Expand file tree Collapse file tree 6 files changed +122
-3
lines changed
doc/connectivity/usb/device
samples/subsys/usb/legacy/netusb Expand file tree Collapse file tree 6 files changed +122
-3
lines changed Original file line number Diff line number Diff line change @@ -373,9 +373,7 @@ Ethernet connection between the remote (USB host) and Zephyr network support.
373
373
* CDC EEM class, enabled with :kconfig:option: `CONFIG_USB_DEVICE_NETWORK_EEM `
374
374
* RNDIS support, enabled with :kconfig:option: `CONFIG_USB_DEVICE_NETWORK_RNDIS `
375
375
376
- See :zephyr:code-sample: `zperf ` or :zephyr:code-sample: `socket-dumb-http-server ` for reference.
377
- Typically, users will need to add a configuration file overlay to the build,
378
- such as :zephyr_file: `samples/net/zperf/overlay-netusb.conf `.
376
+ See :zephyr:code-sample: `legacy-netusb ` sample for reference.
379
377
380
378
Applications using RNDIS support should enable :kconfig:option: `CONFIG_USB_DEVICE_OS_DESC `
381
379
for a better user experience on a host running Microsoft Windows OS.
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required (VERSION 3.20.0 )
4
+
5
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
6
+ project (zperf )
7
+
8
+ target_sources (app PRIVATE src/main.c )
Original file line number Diff line number Diff line change
1
+ .. zephyr :code-sample :: legacy-netusb
2
+ :name: Legacy USB device netusb sample
3
+ :relevant-api: net_config _usb_device_core_api
4
+
5
+ Use USB CDC EEM/ECM or RNDIS implementation
6
+
7
+ Overview
8
+ ********
9
+
10
+ Use the USB CDC EEM/ECM or RNDIS implementation to establish a network
11
+ connection to a device running the Zephyr RTOS.
12
+
13
+ .. note ::
14
+ This samples demonstrate deprecated :ref: `usb_device_stack `.
15
+
16
+ This sample can be found under :zephyr_file: `samples/subsys/usb/legacy/netusb ` in the
17
+ Zephyr project tree.
18
+
19
+ Requirements
20
+ ************
21
+
22
+ This project requires an USB device driver, which is available for multiple
23
+ boards supported in Zephyr.
24
+
25
+ Building and Running
26
+ ********************
27
+
28
+ .. zephyr-app-commands ::
29
+ :zephyr-app: samples/subsys/usb/legacy/netusb
30
+ :board: reel_board
31
+ :goals: flash
32
+ :compact:
Original file line number Diff line number Diff line change
1
+ CONFIG_NETWORKING=y
2
+ CONFIG_NET_LOG=y
3
+ CONFIG_NET_IPV6=y
4
+ CONFIG_NET_IPV4=y
5
+ CONFIG_NET_UDP=y
6
+
7
+ CONFIG_NET_PKT_RX_COUNT=40
8
+ CONFIG_NET_PKT_TX_COUNT=40
9
+ CONFIG_NET_BUF_RX_COUNT=160
10
+ CONFIG_NET_BUF_TX_COUNT=160
11
+ CONFIG_NET_BUF_DATA_SIZE=256
12
+ CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4
13
+ CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
14
+ CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
15
+ CONFIG_NET_MAX_CONTEXTS=5
16
+ CONFIG_NET_TC_TX_COUNT=1
17
+ CONFIG_POSIX_API=y
18
+
19
+ CONFIG_INIT_STACKS=y
20
+ CONFIG_TEST_RANDOM_GENERATOR=y
21
+
22
+ CONFIG_NET_L2_ETHERNET=y
23
+
24
+ CONFIG_NET_CONFIG_SETTINGS=y
25
+ CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
26
+ CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
27
+
28
+ CONFIG_LOG=y
29
+ CONFIG_SHELL_CMDS_RESIZE=n
30
+
31
+ CONFIG_USB_DEVICE_STACK=y
32
+ CONFIG_USB_DEVICE_NETWORK_ECM=y
33
+ CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
Original file line number Diff line number Diff line change
1
+ common :
2
+ tags :
3
+ - net
4
+ - usb
5
+ min_ram : 192
6
+ depends_on : usb_device
7
+ build_only : true
8
+ platform_exclude :
9
+ - native_sim
10
+ - native_sim/native/64
11
+ sample :
12
+ description : Samples for legacy CDC ECM, CDC EEM, RNDIS functions
13
+ name : Legacy ECM EEM RNDIS
14
+ tests :
15
+ sample.usb.legacy.cdc_ecm :
16
+ extra_configs :
17
+ - CONFIG_USB_DEVICE_NETWORK_ECM=y
18
+ - CONFIG_USB_DEVICE_NETWORK_EEM=n
19
+ sample.usb.legacy.cdc_eem :
20
+ extra_configs :
21
+ - CONFIG_USB_DEVICE_NETWORK_ECM=n
22
+ - CONFIG_USB_DEVICE_NETWORK_EEM=y
23
+ sample.usb.legacy.rndis :
24
+ extra_configs :
25
+ - CONFIG_USB_DEVICE_NETWORK_ECM=n
26
+ - CONFIG_USB_DEVICE_NETWORK_RNDIS=y
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2020 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <zephyr/usb/usb_device.h>
8
+ #include <zephyr/net/net_config.h>
9
+
10
+ int main (void )
11
+ {
12
+ int ret ;
13
+
14
+ ret = usb_enable (NULL );
15
+ if (ret != 0 ) {
16
+ printk ("usb enable error %d\n" , ret );
17
+ }
18
+
19
+ (void )net_config_init_app (NULL , "Initializing network" );
20
+
21
+ return 0 ;
22
+ }
You can’t perform that action at this time.
0 commit comments