From d799d4dd750b788df2818dacac3939a9d3c0c080 Mon Sep 17 00:00:00 2001 From: Sachin D Kulkarni Date: Mon, 21 Aug 2023 20:25:37 +0530 Subject: [PATCH] samples: cellular: modem_shell: Fix gettopt for Wi-Fi builds Wi-Fi shell now uses getopt from Zephyr which needs an additional header to be included as modem shell uses FreeBSD's port of getopt (downstream only). For Wi-Fi switch to using Zephyr's getopt and include the necessary header file. Signed-off-by: Sachin D Kulkarni --- samples/cellular/modem_shell/overlay-esp-wifi.conf | 2 ++ .../cellular/modem_shell/overlay-nrf7002ek-wifi-scan-only.conf | 2 ++ samples/cellular/modem_shell/src/location/location_shell.c | 3 +++ samples/cellular/modem_shell/src/ping/icmp_ping_shell.c | 3 +++ samples/cellular/modem_shell/src/rest/rest_shell.c | 3 +++ samples/cellular/modem_shell/src/sms/sms_shell.c | 3 +++ 6 files changed, 16 insertions(+) diff --git a/samples/cellular/modem_shell/overlay-esp-wifi.conf b/samples/cellular/modem_shell/overlay-esp-wifi.conf index 06b351f2f95e..67bda4b0c70f 100644 --- a/samples/cellular/modem_shell/overlay-esp-wifi.conf +++ b/samples/cellular/modem_shell/overlay-esp-wifi.conf @@ -15,6 +15,8 @@ CONFIG_NET_IPV6=y CONFIG_NET_NATIVE=y CONFIG_NET_SHELL=y +# Wi-Fi subsystem uses Zephyr's getopt. +CONFIG_GETOPT_LIB=n CONFIG_NET_L2_WIFI_SHELL=y # Should be set when CONFIG_NET_L2_WIFI_SHELL is enabled. # Printing 'wifi scan' command results puts pressure on queues in new locking design in net_mgmt. diff --git a/samples/cellular/modem_shell/overlay-nrf7002ek-wifi-scan-only.conf b/samples/cellular/modem_shell/overlay-nrf7002ek-wifi-scan-only.conf index 73cf09e5ddc0..e8b67b207d3a 100644 --- a/samples/cellular/modem_shell/overlay-nrf7002ek-wifi-scan-only.conf +++ b/samples/cellular/modem_shell/overlay-nrf7002ek-wifi-scan-only.conf @@ -30,6 +30,8 @@ CONFIG_WIFI_NRF700X=y # Also see comments for CONFIG_HEAP_MEM_POOL_SIZE. CONFIG_WIFI_MGMT_SCAN_MAX_BSS_CNT=50 +# Wi-Fi subsystem uses Zephyr's getopt. +CONFIG_GETOPT_LIB=n CONFIG_NET_L2_WIFI_SHELL=y # Should be set when CONFIG_NET_L2_WIFI_SHELL is enabled. # Printing 'wifi scan' command results puts pressure on queues in new locking design in net_mgmt. diff --git a/samples/cellular/modem_shell/src/location/location_shell.c b/samples/cellular/modem_shell/src/location/location_shell.c index 93013bea591e..e55eb2d0e547 100644 --- a/samples/cellular/modem_shell/src/location/location_shell.c +++ b/samples/cellular/modem_shell/src/location/location_shell.c @@ -9,6 +9,9 @@ #include #include +#ifdef CONFIG_GETOPT +#include +#endif #include #include #if defined(CONFIG_NRF_CLOUD_REST) diff --git a/samples/cellular/modem_shell/src/ping/icmp_ping_shell.c b/samples/cellular/modem_shell/src/ping/icmp_ping_shell.c index 9198fd888cfc..ca1ce9bdd7d3 100644 --- a/samples/cellular/modem_shell/src/ping/icmp_ping_shell.c +++ b/samples/cellular/modem_shell/src/ping/icmp_ping_shell.c @@ -8,6 +8,9 @@ #include #include +#ifdef CONFIG_GETOPT +#include +#endif #include #include "link_api.h" diff --git a/samples/cellular/modem_shell/src/rest/rest_shell.c b/samples/cellular/modem_shell/src/rest/rest_shell.c index def040e1523e..6b3fd4846d98 100644 --- a/samples/cellular/modem_shell/src/rest/rest_shell.c +++ b/samples/cellular/modem_shell/src/rest/rest_shell.c @@ -9,6 +9,9 @@ #include #include +#ifdef CONFIG_GETOPT +#include +#endif #include #include diff --git a/samples/cellular/modem_shell/src/sms/sms_shell.c b/samples/cellular/modem_shell/src/sms/sms_shell.c index 194b76ad23c1..ab459a094b6d 100644 --- a/samples/cellular/modem_shell/src/sms/sms_shell.c +++ b/samples/cellular/modem_shell/src/sms/sms_shell.c @@ -8,6 +8,9 @@ #include #include #include +#ifdef CONFIG_GETOPT +#include +#endif #include #include "sms.h"