Skip to content

Commit

Permalink
sys/shell/gnrc_netif: Show interface up/down state
Browse files Browse the repository at this point in the history
  • Loading branch information
yarrick committed Oct 11, 2023
1 parent 8e996c0 commit 0fc7898
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions sys/shell/cmds/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,17 @@ static void _netif_list(netif_t *iface)
}
}
#endif /* MODULE_NETDEV_IEEE802154 */
netopt_enable_t link;
res = netif_get_opt(iface, NETOPT_LINK, 0, &link, sizeof(netopt_enable_t));
netopt_enable_t enabled;
res = netif_get_opt(iface, NETOPT_LINK, 0, &enabled, sizeof(enabled));
if (res >= 0) {
printf(" Link: %s ", (link == NETOPT_ENABLE) ? "up" : "down" );
printf(" Link: %s ", (enabled == NETOPT_ENABLE) ? "up" : "down" );
}
#if IS_USED(MODULE_LWIP_NETIF) /* only supported on lwIP for now */
res = netif_get_opt(iface, NETOPT_ACTIVE, 0, &enabled, sizeof(enabled));
if (res >= 0) {
printf(" State: %s ", (enabled == NETOPT_ENABLE) ? "up" : "down" );
}
#endif /* MODULE_LWIP_NETIF */
line_thresh = _newline(0U, line_thresh);
res = netif_get_opt(iface, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr));
if (res >= 0) {
Expand All @@ -806,9 +812,9 @@ static void _netif_list(netif_t *iface)
}
res = netif_get_opt(iface, NETOPT_CSMA_RETRIES, 0, &u8, sizeof(u8));
if (res >= 0) {
netopt_enable_t enable = NETOPT_DISABLE;
res = netif_get_opt(iface, NETOPT_CSMA, 0, &enable, sizeof(enable));
if ((res >= 0) && (enable == NETOPT_ENABLE)) {
enabled = NETOPT_DISABLE;
res = netif_get_opt(iface, NETOPT_CSMA, 0, &enabled, sizeof(enabled));
if ((res >= 0) && (enabled == NETOPT_ENABLE)) {
printf(" CSMA Retries: %u ", (unsigned)u8);
}
line_thresh++;
Expand Down

0 comments on commit 0fc7898

Please sign in to comment.