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)
4141set (gen_dir ${ZEPHYR_BINARY_DIR} /include /generated /)
4242
4343target_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 ()
4548
4649target_link_libraries (app PRIVATE zephyr_interface zephyr)
4750
Original file line number Diff line number Diff line change @@ -69,4 +69,11 @@ config NET_SAMPLE_WEBSOCKET_STATS_INTERVAL
6969 This interval controls how often the net stats data shown on the web page
7070 will be updated.
7171
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+
7279source "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
3131 * - :zephyr_file: `ieee802154-overlay.conf <samples/net/sockets/http_server/ieee802154-overlay.conf> `
3232 - This overlay config can be added for IEEE 802.15.4 support.
3333
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> `
3535 - This overlay config can be added for connecting via network USB.
3636
3737 * - :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 1616 sample.net.sockets.http.server : {}
1717 sample.net.sockets.https.server :
1818 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 1919#include <zephyr/drivers/led.h>
2020#include <zephyr/data/json.h>
2121#include <zephyr/sys/util_macro.h>
22+ #include <sample_usbd.h>
23+ #include <zephyr/net/net_config.h>
2224
2325#include "ws.h"
2426
@@ -347,14 +349,27 @@ static void setup_tls(void)
347349#endif /* defined(CONFIG_NET_SAMPLE_HTTPS_SERVICE) */
348350}
349351
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 )
354353{
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+
355371 return 0 ;
356372}
357- #endif /* CONFIG_USB_DEVICE_STACK */
358373
359374int main (void )
360375{
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