File tree Expand file tree Collapse file tree 9 files changed +57
-43
lines changed
samples/net/sockets/http_server Expand file tree Collapse file tree 9 files changed +57
-43
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ target_sources(app PRIVATE src/main.c)
41
41
set (gen_dir ${ZEPHYR_BINARY_DIR} /include/generated/ )
42
42
43
43
target_sources_ifdef (CONFIG_NET_SAMPLE_WEBSOCKET_SERVICE app PRIVATE src/ws.c )
44
- target_sources_ifdef (CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c )
44
+
45
+ if (CONFIG_USB_DEVICE_STACK_NEXT )
46
+ include (${ZEPHYR_BASE} /samples/subsys/usb/common/common.cmake )
47
+ endif ()
45
48
46
49
target_link_libraries (app PRIVATE zephyr_interface zephyr )
47
50
Original file line number Diff line number Diff line change @@ -69,4 +69,11 @@ config NET_SAMPLE_WEBSOCKET_STATS_INTERVAL
69
69
This interval controls how often the net stats data shown on the web page
70
70
will be updated.
71
71
72
+ if USB_DEVICE_STACK_NEXT
73
+ # Source common USB sample options used to initialize new experimental USB
74
+ # device stack. The scope of these options is limited to USB samples in project
75
+ # tree, you cannot use them in your own application.
76
+ source "samples/subsys/usb/common/Kconfig.sample_usbd"
77
+ endif
78
+
72
79
source "Kconfig.zephyr"
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ There are configuration files for various setups in the
31
31
* - :zephyr_file: `ieee802154-overlay.conf <samples/net/sockets/http_server/ieee802154-overlay.conf> `
32
32
- This overlay config can be added for IEEE 802.15.4 support.
33
33
34
- * - :zephyr_file: `overlay-netusb .conf <samples/net/sockets/http_server/overlay-netusb .conf> `
34
+ * - :zephyr_file: `overlay-usbd .conf <samples/net/sockets/http_server/overlay-usbd .conf> `
35
35
- This overlay config can be added for connecting via network USB.
36
36
37
37
* - :zephyr_file: `overlay-tls.conf <samples/net/sockets/http_server/overlay-tls.conf> `
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ CONFIG_USB_DEVICE_STACK_NEXT=y
2
+
3
+ CONFIG_LOG=y
4
+ CONFIG_USBD_LOG_LEVEL_WRN=y
5
+ CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
6
+
7
+ CONFIG_NET_L2_ETHERNET=y
Original file line number Diff line number Diff line change 16
16
sample.net.sockets.http.server : {}
17
17
sample.net.sockets.https.server :
18
18
extra_args : EXTRA_CONF_FILE="overlay-tls.conf"
19
+ sample.net.sockets.http.server.usbd_cdc_ncm :
20
+ depends_on : usbd
21
+ extra_args : EXTRA_CONF_FILE="overlay-usbd.conf"
22
+ EXTRA_DTC_OVERLAY_FILE="usbd_cdc_ncm.overlay"
23
+ tags :
24
+ - usb
Original file line number Diff line number Diff line change 19
19
#include <zephyr/drivers/led.h>
20
20
#include <zephyr/data/json.h>
21
21
#include <zephyr/sys/util_macro.h>
22
+ #include <sample_usbd.h>
23
+ #include <zephyr/net/net_config.h>
22
24
23
25
#include "ws.h"
24
26
@@ -347,14 +349,27 @@ static void setup_tls(void)
347
349
#endif /* defined(CONFIG_NET_SAMPLE_HTTPS_SERVICE) */
348
350
}
349
351
350
- #if defined(CONFIG_USB_DEVICE_STACK )
351
- int init_usb (void );
352
- #else
353
- static inline int init_usb (void )
352
+ static int init_usb (void )
354
353
{
354
+ #if defined(CONFIG_USB_DEVICE_STACK_NEXT )
355
+ struct usbd_context * sample_usbd ;
356
+ int err ;
357
+
358
+ sample_usbd = sample_usbd_init_device (NULL );
359
+ if (sample_usbd == NULL ) {
360
+ return - ENODEV ;
361
+ }
362
+
363
+ err = usbd_enable (sample_usbd );
364
+ if (err ) {
365
+ return err ;
366
+ }
367
+
368
+ (void )net_config_init_app (NULL , "Initializing network" );
369
+ #endif /* CONFIG_USB_DEVICE_STACK_NEXT */
370
+
355
371
return 0 ;
356
372
}
357
- #endif /* CONFIG_USB_DEVICE_STACK */
358
373
359
374
int main (void )
360
375
{
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2024 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ / {
8
+ cdc_ncm_eth0: cdc_ncm_eth0 {
9
+ compatible = "zephyr,cdc-ncm-ethernet";
10
+ remote-mac-address = "00005E005301";
11
+ };
12
+ };
You can’t perform that action at this time.
0 commit comments