diff --git a/sys/shell/commands/sc_netif.c b/sys/shell/commands/sc_netif.c index e0de4a431b..f158d40212 100644 --- a/sys/shell/commands/sc_netif.c +++ b/sys/shell/commands/sc_netif.c @@ -88,6 +88,7 @@ static void _set_usage(char *cmd_name) " * \"pan\" - alias for \"nid\"\n" " * \"pan_id\" - alias for \"nid\"\n" " * \"power\" - TX power in dBm\n" + " * \"retrans\" - max. number of retransmissions\n" " * \"src_len\" - sets the source address length in byte\n" " * \"state\" - set the device state\n"); } @@ -150,6 +151,10 @@ static void _print_netopt(netopt_t opt) printf("TX power [in dBm]"); break; + case NETOPT_RETRANS: + printf("max. retransmissions"); + break; + case NETOPT_CSMA_RETRIES: printf("CSMA retries"); break; @@ -235,29 +240,7 @@ static void _netif_list(kernel_pid_t dev) res = gnrc_netapi_get(dev, NETOPT_NID, 0, &u16, sizeof(u16)); if (res >= 0) { - printf(" NID: 0x%" PRIx16 " ", u16); - } - - res = gnrc_netapi_get(dev, NETOPT_TX_POWER, 0, &i16, sizeof(i16)); - - if (res >= 0) { - printf(" TX-Power: %" PRIi16 "dBm ", i16); - } - - res = gnrc_netapi_get(dev, NETOPT_STATE, 0, &state, sizeof(state)); - - if (res >= 0) { - printf(" State: "); - _print_netopt_state(state); - } - - res = gnrc_netapi_get(dev, NETOPT_CSMA_RETRIES, 0, &u8, sizeof(u8)); - - if (res >= 0) { - res = gnrc_netapi_get(dev, NETOPT_CSMA, 0, &enable, sizeof(enable)); - if ((res >= 0) && (enable == NETOPT_ENABLE)) { - printf(" CSMA Retries: %u ", (unsigned)u8); - } + printf(" NID: 0x%" PRIx16, u16); } printf("\n "); @@ -273,9 +256,40 @@ static void _netif_list(kernel_pid_t dev) } if (linebreak) { - printf("\n "); + printf("\n "); } + res = gnrc_netapi_get(dev, NETOPT_TX_POWER, 0, &i16, sizeof(i16)); + + if (res >= 0) { + printf(" TX-Power: %" PRIi16 "dBm ", i16); + } + + res = gnrc_netapi_get(dev, NETOPT_STATE, 0, &state, sizeof(state)); + + if (res >= 0) { + printf(" State: "); + _print_netopt_state(state); + printf(" "); + } + + res = gnrc_netapi_get(dev, NETOPT_RETRANS, 0, &u8, sizeof(u8)); + + if (res >= 0) { + printf(" max. Retrans.: %u ", (unsigned)u8); + } + + res = gnrc_netapi_get(dev, NETOPT_CSMA_RETRIES, 0, &u8, sizeof(u8)); + + if (res >= 0) { + res = gnrc_netapi_get(dev, NETOPT_CSMA, 0, &enable, sizeof(enable)); + if ((res >= 0) && (enable == NETOPT_ENABLE)) { + printf(" CSMA Retries: %u ", (unsigned)u8); + } + } + + printf("\n "); + res = gnrc_netapi_get(dev, NETOPT_PROMISCUOUSMODE, 0, &enable, sizeof(enable)); if ((res >= 0) && (enable == NETOPT_ENABLE)) { @@ -587,6 +601,9 @@ static int _netif_set(char *cmd_name, kernel_pid_t dev, char *key, char *value) else if (strcmp("state", key) == 0) { return _netif_set_state(dev, value); } + else if (strcmp("retrans", key) == 0) { + return _netif_set_u8(dev, NETOPT_RETRANS, value); + } else if (strcmp("csma_retries", key) == 0) { return _netif_set_u8(dev, NETOPT_CSMA_RETRIES, value); }