Skip to content

Commit

Permalink
shell: device: show PM state in device list
Browse files Browse the repository at this point in the history
Show current power management state in the list of devices, which is
helpful during PM debugging.

Signed-off-by: Marcin Niestroj <[email protected]>
  • Loading branch information
mniestroj authored and nashif committed Feb 2, 2020
1 parent 2140949 commit 4f16268
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion subsys/shell/modules/device_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down

0 comments on commit 4f16268

Please sign in to comment.