Skip to content

Commit

Permalink
samples: cellular: modem_shell: Fix gettopt for Wi-Fi builds
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sachinthegreen authored and rlubos committed Aug 24, 2023
1 parent cd4f879 commit acc4efc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions samples/cellular/modem_shell/overlay-esp-wifi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions samples/cellular/modem_shell/src/location/location_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <string.h>

#include <zephyr/shell/shell.h>
#ifdef CONFIG_GETOPT
#include <zephyr/posix/unistd.h>
#endif
#include <getopt.h>
#include <net/nrf_cloud.h>
#if defined(CONFIG_NRF_CLOUD_REST)
Expand Down
3 changes: 3 additions & 0 deletions samples/cellular/modem_shell/src/ping/icmp_ping_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <zephyr/kernel.h>

#include <zephyr/shell/shell.h>
#ifdef CONFIG_GETOPT
#include <zephyr/posix/unistd.h>
#endif
#include <getopt.h>

#include "link_api.h"
Expand Down
3 changes: 3 additions & 0 deletions samples/cellular/modem_shell/src/rest/rest_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <assert.h>

#include <zephyr/shell/shell.h>
#ifdef CONFIG_GETOPT
#include <zephyr/posix/unistd.h>
#endif
#include <getopt.h>

#include <zephyr/net/http/parser.h>
Expand Down
3 changes: 3 additions & 0 deletions samples/cellular/modem_shell/src/sms/sms_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
#ifdef CONFIG_GETOPT
#include <zephyr/posix/unistd.h>
#endif
#include <getopt.h>
#include <modem/sms.h>

Expand Down

0 comments on commit acc4efc

Please sign in to comment.