Commit efabd2de authored by Tristan Gingold's avatar Tristan Gingold

wrtd-config, wrtd-logging: improve output.

parent 5c68b2c4
......@@ -117,7 +117,12 @@ static void disp_rule_conf(const struct wrtd_rule *rule, unsigned nbr_rules)
" dest: ");
disp_id(cfg->dest_id);
printf("\n"
" dest_cpu: %u\n", cfg->dest_cpu);
" dest_cpu: %u", cfg->dest_cpu);
if (cfg->dest_cpu == WRTD_DEST_CPU_LOCAL)
printf(" (local)");
else if (cfg->dest_cpu == WRTD_DEST_CH_NET)
printf(" (net)");
printf("\n");
printf(" dest_ch: %u\n", cfg->dest_ch);
printf(" enabled: %d\n", cfg->enabled);
printf(" hash: %u, hash_chain: %d\n",
......@@ -879,7 +884,7 @@ int main(int argc, char *argv[])
char c;
int i;
while ((c = getopt (argc, argv, "hD:c:")) != -1) {
while ((c = getopt (argc, argv, "+hD:c:")) != -1) {
switch (c) {
case 'h':
case '?':
......@@ -910,7 +915,9 @@ int main(int argc, char *argv[])
/* Open. */
status = wrtd_init(dev_name, 0, NULL, &wrtd);
if (status != WRTD_SUCCESS) {
fprintf(stderr, "Cannot open WRTD, status=0x%08x\n", status);
fprintf(stderr,
"Cannot open WRTD %s, status=0x%08x (errno=%s)\n",
dev_name, status, strerror(errno));
return 1;
}
......
......@@ -59,7 +59,24 @@ static void print_logging (struct wrtd_dev *wrtd, int n_read)
switch(log.type) {
case WRTD_LOG_MSG_EV_GENERATED:
printf("generated %-4u ", log.reason);
printf("generated ");
switch(log.reason) {
case WRTD_LOG_GENERATED_ALARM:
printf("alrm ");
break;
case WRTD_LOG_GENERATED_DEVICE_0:
case WRTD_LOG_GENERATED_DEVICE_1:
case WRTD_LOG_GENERATED_DEVICE_2:
case WRTD_LOG_GENERATED_DEVICE_3:
printf("dev%u ",
(log.reason
- WRTD_LOG_GENERATED_DEVICE_0));
break;
default:
printf("%-4u ", log.reason);
break;
}
break;
case WRTD_LOG_MSG_EV_CONSUMED:
printf("consumed ");
......@@ -76,7 +93,21 @@ static void print_logging (struct wrtd_dev *wrtd, int n_read)
}
break;
case WRTD_LOG_MSG_EV_DISCARDED:
printf("discarded %-4u ", log.reason);
printf("discarded ");
switch(log.reason) {
case WRTD_LOG_DISCARD_NO_SYNC:
printf("nosy ");
break;
case WRTD_LOG_DISCARD_TIMEOUT:
printf("tout ");
break;
case WRTD_LOG_DISCARD_OVERFLOW:
printf("ovf ");
break;
default:
printf("%-4u ", log.reason);
break;
}
break;
case WRTD_LOG_MSG_EV_NETWORK:
switch(log.reason) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment