shell: device: show PM state in device list
Show current power management state in the list of devices, which is helpful during PM debugging. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
parent
21409494d1
commit
4f1626851b
1 changed files with 12 additions and 1 deletions
|
@ -86,8 +86,19 @@ static int cmd_device_list(const struct shell *shell,
|
|||
shell_fprintf(shell, SHELL_NORMAL, "devices:\n");
|
||||
for (info = __device_init_start; info != __device_init_end; info++) {
|
||||
if (info->driver_api != NULL) {
|
||||
shell_fprintf(shell, SHELL_NORMAL, "- %s\n",
|
||||
shell_fprintf(shell, SHELL_NORMAL, "- %s",
|
||||
info->config->name);
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
u32_t state = DEVICE_PM_ACTIVE_STATE;
|
||||
int err;
|
||||
|
||||
err = device_get_power_state(info, &state);
|
||||
if (!err) {
|
||||
shell_fprintf(shell, SHELL_NORMAL, " (%s)",
|
||||
device_pm_state_str(state));
|
||||
}
|
||||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
||||
shell_fprintf(shell, SHELL_NORMAL, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue