shell: device_service: show the usage conter when pm runtime is enabled
Add an extra "usage=%d" to the device status to show the current usage counter when PM runtime is enabled. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
df819a8609
commit
4257fb6a3d
|
@ -64,6 +64,7 @@ static int cmd_device_list(const struct shell *sh,
|
||||||
char buf[20];
|
char buf[20];
|
||||||
const char *name = get_device_name(dev, buf, sizeof(buf));
|
const char *name = get_device_name(dev, buf, sizeof(buf));
|
||||||
const char *state = "READY";
|
const char *state = "READY";
|
||||||
|
int usage;
|
||||||
|
|
||||||
shell_fprintf(sh, SHELL_NORMAL, "- %s", name);
|
shell_fprintf(sh, SHELL_NORMAL, "- %s", name);
|
||||||
if (!device_is_ready(dev)) {
|
if (!device_is_ready(dev)) {
|
||||||
|
@ -79,7 +80,13 @@ static int cmd_device_list(const struct shell *sh,
|
||||||
#endif /* CONFIG_PM_DEVICE */
|
#endif /* CONFIG_PM_DEVICE */
|
||||||
}
|
}
|
||||||
|
|
||||||
shell_fprintf(sh, SHELL_NORMAL, " (%s)\n", state);
|
usage = pm_device_runtime_usage(dev);
|
||||||
|
if (usage >= 0) {
|
||||||
|
shell_fprintf(sh, SHELL_NORMAL, " (%s, usage=%d)\n", state, usage);
|
||||||
|
} else {
|
||||||
|
shell_fprintf(sh, SHELL_NORMAL, " (%s)\n", state);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEVICE_DEPS
|
#ifdef CONFIG_DEVICE_DEPS
|
||||||
if (!k_is_user_context()) {
|
if (!k_is_user_context()) {
|
||||||
struct cmd_device_list_visitor_context ctx = {
|
struct cmd_device_list_visitor_context ctx = {
|
||||||
|
|
Loading…
Reference in a new issue