Skip to content
Snippets Groups Projects
Unverified Commit c30fea46 authored by Martine Lenders's avatar Martine Lenders
Browse files

shell_commands: fix sc_gnrc_netif2 for MSP430

parent b3ebdab8
No related branches found
No related tags found
No related merge requests found
...@@ -258,7 +258,7 @@ static void _print_netopt(netopt_t opt) ...@@ -258,7 +258,7 @@ static void _print_netopt(netopt_t opt)
} }
} }
const char *_netopt_state_str[] = { static const char *_netopt_state_str[] = {
[NETOPT_STATE_OFF] = "OFF", [NETOPT_STATE_OFF] = "OFF",
[NETOPT_STATE_SLEEP] = "SLEEP", [NETOPT_STATE_SLEEP] = "SLEEP",
[NETOPT_STATE_IDLE] = "IDLE", [NETOPT_STATE_IDLE] = "IDLE",
...@@ -270,12 +270,13 @@ const char *_netopt_state_str[] = { ...@@ -270,12 +270,13 @@ const char *_netopt_state_str[] = {
/* for some lines threshold might just be 0, so we can't use _LINE_THRESHOLD /* for some lines threshold might just be 0, so we can't use _LINE_THRESHOLD
* here */ * here */
static void _newline(unsigned threshold, unsigned *line_thresh) static unsigned _newline(unsigned threshold, unsigned line_thresh)
{ {
if (*line_thresh > threshold) { if (line_thresh > threshold) {
printf("\n "); printf("\n ");
*line_thresh = 0U; line_thresh = 0U;
} }
return line_thresh;
} }
...@@ -288,8 +289,7 @@ static unsigned _netif_list_flag(kernel_pid_t iface, netopt_t opt, char *str, ...@@ -288,8 +289,7 @@ static unsigned _netif_list_flag(kernel_pid_t iface, netopt_t opt, char *str,
if ((res >= 0) && (enable == NETOPT_ENABLE)) { if ((res >= 0) && (enable == NETOPT_ENABLE)) {
printf("%s", str); printf("%s", str);
line_thresh++; line_thresh = _newline(_LINE_THRESHOLD, ++line_thresh);
_newline(_LINE_THRESHOLD, &line_thresh);
} }
return line_thresh; return line_thresh;
} }
...@@ -323,7 +323,7 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags) ...@@ -323,7 +323,7 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags)
printf(" VAL"); printf(" VAL");
break; break;
} }
_newline(0U, &line_thresh); line_thresh = _newline(0U, line_thresh);
} }
#endif #endif
...@@ -359,7 +359,7 @@ static void _netif_list(kernel_pid_t iface) ...@@ -359,7 +359,7 @@ static void _netif_list(kernel_pid_t iface)
if (res >= 0) { if (res >= 0) {
printf(" NID: 0x%" PRIx16, u16); printf(" NID: 0x%" PRIx16, u16);
} }
_newline(0U, &line_thresh); line_thresh = _newline(0U, line_thresh);
res = gnrc_netapi_get(iface, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr)); res = gnrc_netapi_get(iface, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr));
if (res >= 0) { if (res >= 0) {
char hwaddr_str[res * 3]; char hwaddr_str[res * 3];
...@@ -367,7 +367,7 @@ static void _netif_list(kernel_pid_t iface) ...@@ -367,7 +367,7 @@ static void _netif_list(kernel_pid_t iface)
printf("%s ", gnrc_netif2_addr_to_str(hwaddr, res, hwaddr_str)); printf("%s ", gnrc_netif2_addr_to_str(hwaddr, res, hwaddr_str));
line_thresh++; line_thresh++;
} }
_newline(0U, &line_thresh); line_thresh = _newline(0U, line_thresh);
res = gnrc_netapi_get(iface, NETOPT_TX_POWER, 0, &i16, sizeof(i16)); res = gnrc_netapi_get(iface, NETOPT_TX_POWER, 0, &i16, sizeof(i16));
if (res >= 0) { if (res >= 0) {
printf(" TX-Power: %" PRIi16 "dBm ", i16); printf(" TX-Power: %" PRIi16 "dBm ", i16);
...@@ -391,7 +391,7 @@ static void _netif_list(kernel_pid_t iface) ...@@ -391,7 +391,7 @@ static void _netif_list(kernel_pid_t iface)
} }
line_thresh++; line_thresh++;
} }
_newline(0U, &line_thresh); line_thresh = _newline(0U, line_thresh);
line_thresh = _netif_list_flag(iface, NETOPT_PROMISCUOUSMODE, "PROMISC ", line_thresh = _netif_list_flag(iface, NETOPT_PROMISCUOUSMODE, "PROMISC ",
line_thresh); line_thresh);
line_thresh = _netif_list_flag(iface, NETOPT_AUTOACK, "AUTOACK ", line_thresh = _netif_list_flag(iface, NETOPT_AUTOACK, "AUTOACK ",
...@@ -438,13 +438,12 @@ static void _netif_list(kernel_pid_t iface) ...@@ -438,13 +438,12 @@ static void _netif_list(kernel_pid_t iface)
printf("Source address length: %" PRIu16 , u16); printf("Source address length: %" PRIu16 , u16);
line_thresh++; line_thresh++;
} }
_newline(0U, &line_thresh); line_thresh = _newline(0U, line_thresh);
#ifdef MODULE_GNRC_IPV6 #ifdef MODULE_GNRC_IPV6
printf("Link type: %s", printf("Link type: %s",
(gnrc_netapi_get(iface, NETOPT_IS_WIRED, 0, &u16, sizeof(u16)) > 0) ? (gnrc_netapi_get(iface, NETOPT_IS_WIRED, 0, &u16, sizeof(u16)) > 0) ?
"wired" : "wireless"); "wired" : "wireless");
line_thresh++; line_thresh = _newline(0U, ++line_thresh);
_newline(0U, &line_thresh);
res = gnrc_netapi_get(iface, NETOPT_IPV6_ADDR, 0, ipv6_addrs, res = gnrc_netapi_get(iface, NETOPT_IPV6_ADDR, 0, ipv6_addrs,
sizeof(ipv6_addrs)); sizeof(ipv6_addrs));
if (res >= 0) { if (res >= 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment