shell: device_service: print DT metadata
Example output on qemu_cortex_m3: devices: - uart@4000e000 (READY) DT node labels: uart2 - uart@4000d000 (READY) DT node labels: uart1 - uart@4000c000 (READY) DT node labels: uart0 - gpio@40026000 (READY) DT node labels: gpio6 - gpio@40025000 (READY) DT node labels: gpio5 - gpio@40024000 (READY) DT node labels: gpio4 - gpio@40007000 (READY) DT node labels: gpio3 - gpio@40006000 (READY) DT node labels: gpio2 - gpio@40005000 (READY) DT node labels: gpio1 - gpio@40004000 (READY) DT node labels: gpio0 Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
This commit is contained in:
parent
48a14dc17e
commit
b93fe6ad2d
1 changed files with 14 additions and 0 deletions
|
@ -98,6 +98,20 @@ static int cmd_device_list(const struct shell *sh,
|
||||||
(void)device_required_foreach(dev, cmd_device_list_visitor, &ctx);
|
(void)device_required_foreach(dev, cmd_device_list_visitor, &ctx);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_DEVICE_DEPS */
|
#endif /* CONFIG_DEVICE_DEPS */
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEVICE_DT_METADATA
|
||||||
|
const struct device_dt_nodelabels *nl = device_get_dt_nodelabels(dev);
|
||||||
|
|
||||||
|
if (nl->num_nodelabels > 0) {
|
||||||
|
shell_fprintf(sh, SHELL_NORMAL, " DT node labels:");
|
||||||
|
for (size_t j = 0; j < nl->num_nodelabels; j++) {
|
||||||
|
const char *nodelabel = nl->nodelabels[j];
|
||||||
|
|
||||||
|
shell_fprintf(sh, SHELL_NORMAL, " %s", nodelabel);
|
||||||
|
}
|
||||||
|
shell_fprintf(sh, SHELL_NORMAL, "\n");
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_DEVICE_DT_METADATAa */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue