Skip to content

Commit

Permalink
Merge #19490
Browse files Browse the repository at this point in the history
19490: sys/shell/gnrc_netif: don't always build lora options with ifconfig r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
  • Loading branch information
bors[bot] and aabadie authored May 9, 2023
2 parents b93328d + ba92b3f commit cf7ef55
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ PSEUDOMODULES += shell_cmd_gnrc_ipv6_frag_stats
PSEUDOMODULES += shell_cmd_gnrc_ipv6_nib
PSEUDOMODULES += shell_cmd_gnrc_ipv6_whitelist
PSEUDOMODULES += shell_cmd_gnrc_netif
PSEUDOMODULES += shell_cmd_gnrc_netif_lora
PSEUDOMODULES += shell_cmd_gnrc_netif_lorawan
PSEUDOMODULES += shell_cmd_gnrc_pktbuf
PSEUDOMODULES += shell_cmd_gnrc_rpl
Expand Down
4 changes: 4 additions & 0 deletions sys/shell/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ ifneq (,$(filter shell_cmds_default,$(USEMODULE)))
endif
ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE += shell_cmd_gnrc_netif
ifneq (,$(filter lora,$(USEMODULE)))
USEMODULE += shell_cmd_gnrc_netif_lora
endif
endif
ifneq (,$(filter gnrc_netif_lorawan,$(USEMODULE)))
USEMODULE += shell_cmd_gnrc_netif_lorawan
Expand Down Expand Up @@ -179,6 +182,7 @@ ifneq (,$(filter shell_cmd_gnrc_netif,$(USEMODULE)))
endif
ifneq (,$(filter shell_cmd_gnrc_netif_lorawan,$(USEMODULE)))
USEMODULE += gnrc_netif_lorawan
USEMODULE += shell_cmd_gnrc_netif_lora
USEMODULE += shell_cmd_gnrc_netif
endif
ifneq (,$(filter shell_cmd_gnrc_pktbuf,$(USEMODULE)))
Expand Down
11 changes: 10 additions & 1 deletion sys/shell/cmds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,22 @@ config MODULE_SHELL_CMD_GNRC_NETIF
depends on MODULE_SHELL_CMDS
depends on MODULE_GNRC_NETIF

config MODULE_SHELL_CMD_GNRC_NETIF_LORA
bool "LoRa phy integration to the GNRC network interface command (ifconfig)"
default y if MODULE_SHELL_CMD_GNRC_NETIF && MODULE_LORA
depends on MODULE_GNRC_NETIF
depends on MODULE_LORA
depends on MODULE_SHELL_CMDS
depends on MODULE_SHELL_CMD_GNRC_NETIF

config MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN
bool "LoRa integration to the GNRC network interface command (ifconfig)"
bool "LoRaWAN integration to the GNRC network interface command (ifconfig)"
default y if MODULE_SHELL_CMD_GNRC_NETIF && MODULE_GNRC_NETIF_LORAWAN
depends on MODULE_GNRC_NETIF
depends on MODULE_GNRC_NETIF_LORAWAN
depends on MODULE_SHELL_CMDS
depends on MODULE_SHELL_CMD_GNRC_NETIF
depends on MODULE_SHELL_CMD_GNRC_NETIF_LORA

config MODULE_SHELL_CMD_GNRC_PKTBUF
bool "Command to print stats of the GNRC packet buffer"
Expand Down
24 changes: 12 additions & 12 deletions sys/shell/cmds/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ static void _set_usage(char *cmd_name)
" * \"pan\" - alias for \"nid\"\n"
" * \"pan_id\" - alias for \"nid\"\n"
" * \"phy_busy\" - set busy mode on-off\n"
#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
" * \"bw\" - alias for channel bandwidth\n"
" * \"sf\" - alias for spreading factor\n"
" * \"cr\" - alias for coding rate\n"
#endif
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN)
" * \"appkey\" - sets Application key\n"
" * \"appskey\" - sets Application session key\n"
Expand Down Expand Up @@ -393,7 +393,7 @@ static void _print_netopt(netopt_t opt)
printf("encryption key");
break;

#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
case NETOPT_BANDWIDTH:
printf("bandwidth");
break;
Expand All @@ -405,7 +405,7 @@ static void _print_netopt(netopt_t opt)
case NETOPT_CODING_RATE:
printf("coding rate");
break;
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN */
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */
#ifdef MODULE_NETDEV_IEEE802154_MULTIMODE

case NETOPT_IEEE802154_PHY:
Expand Down Expand Up @@ -506,7 +506,7 @@ static const char *_netopt_state_str[] = {
[NETOPT_STATE_STANDBY] = "STANDBY"
};

#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
static const char *_netopt_bandwidth_str[] = {
[LORA_BW_125_KHZ] = "125",
[LORA_BW_250_KHZ] = "250",
Expand All @@ -519,7 +519,7 @@ static const char *_netopt_coding_rate_str[] = {
[LORA_CR_4_7] = "4/7",
[LORA_CR_4_8] = "4/8"
};
#endif
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */

#ifdef MODULE_NETDEV_IEEE802154
static const char *_netopt_ieee802154_phy_str[] = {
Expand Down Expand Up @@ -678,7 +678,7 @@ static void _netif_list(netif_t *iface)
if (res >= 0) {
printf(" RSSI: %d ", i16);
}
#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
res = netif_get_opt(iface, NETOPT_BANDWIDTH, 0, &u8, sizeof(u8));
if (res >= 0) {
printf(" BW: %skHz ", _netopt_bandwidth_str[u8]);
Expand All @@ -691,7 +691,7 @@ static void _netif_list(netif_t *iface)
if (res >= 0) {
printf(" CR: %s ", _netopt_coding_rate_str[u8]);
}
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN */
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */
#ifdef MODULE_NETDEV_IEEE802154
res = netif_get_opt(iface, NETOPT_IEEE802154_PHY, 0, &u8, sizeof(u8));
if (res >= 0) {
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static int _netif_set_u32(netif_t *iface, netopt_t opt, uint32_t context,
return 0;
}

#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
static int _netif_set_bandwidth(netif_t *iface, char *value)
{
uint8_t bw;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ static int _netif_set_coding_rate(netif_t *iface, char *value)

return 0;
}
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN */
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */

#ifdef MODULE_NETDEV_IEEE802154_MR_FSK
static int _netif_set_fsk_fec(netif_t *iface, char *value)
Expand Down Expand Up @@ -1506,7 +1506,7 @@ static int _netif_set(char *cmd_name, netif_t *iface, char *key, char *value)
else if ((strcmp("frequency", key) == 0) || (strcmp("freq", key) == 0)) {
return _netif_set_u32(iface, NETOPT_CHANNEL_FREQUENCY, 0, value);
}
#if IS_USED(MODULE_LORA)
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORA)
else if ((strcmp("bandwidth", key) == 0) || (strcmp("bw", key) == 0)) {
return _netif_set_bandwidth(iface, value);
}
Expand All @@ -1516,7 +1516,7 @@ static int _netif_set(char *cmd_name, netif_t *iface, char *key, char *value)
else if ((strcmp("coding_rate", key) == 0) || (strcmp("cr", key) == 0)) {
return _netif_set_coding_rate(iface, value);
}
#endif
#endif /* MODULE_SHELL_CMD_GNRC_NETIF_LORA */
#if IS_USED(MODULE_SHELL_CMD_GNRC_NETIF_LORAWAN)
#if IS_USED(MODULE_GNRC_LORAWAN_1_1)
else if (strcmp("joineui", key) == 0) {
Expand Down

0 comments on commit cf7ef55

Please sign in to comment.