Revert "shell: device_service: add dependency information"
This reverts commit a3af137c26
.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
9c70fb1e18
commit
6a6cf2183e
1 changed files with 15 additions and 44 deletions
|
@ -8,9 +8,9 @@
|
|||
#include <shell/shell.h>
|
||||
#include <init.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <device.h>
|
||||
|
||||
extern const struct device __device_start[];
|
||||
extern const struct device __device_PRE_KERNEL_1_start[];
|
||||
extern const struct device __device_PRE_KERNEL_2_start[];
|
||||
extern const struct device __device_POST_KERNEL_start[];
|
||||
|
@ -82,62 +82,33 @@ static int cmd_device_levels(const struct shell *shell,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char *get_device_name(const struct device *dev,
|
||||
char *buf,
|
||||
size_t len)
|
||||
{
|
||||
const char *name = dev->name;
|
||||
|
||||
if ((name == NULL) || (name[0] == 0)) {
|
||||
snprintf(buf, len, "[%p]", dev);
|
||||
name = buf;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static int cmd_device_list(const struct shell *shell,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
const struct device *devlist;
|
||||
size_t devcnt = z_device_get_all_static(&devlist);
|
||||
const struct device *devlist_end = devlist + devcnt;
|
||||
const struct device *dev;
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
||||
shell_fprintf(shell, SHELL_NORMAL, "devices:\n");
|
||||
|
||||
for (dev = devlist; dev < devlist_end; dev++) {
|
||||
char buf[20];
|
||||
const char *name = get_device_name(dev, buf, sizeof(buf));
|
||||
const char *state = "READY";
|
||||
size_t nhdls = 0;
|
||||
const device_handle_t *hdls =
|
||||
device_get_requires_handles(dev, &nhdls);
|
||||
|
||||
shell_fprintf(shell, SHELL_NORMAL, "- %s", name);
|
||||
for (dev = __device_start; dev != __device_end; dev++) {
|
||||
if (!device_is_ready(dev)) {
|
||||
state = "DISABLED";
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
shell_fprintf(shell, SHELL_NORMAL, "- %s", dev->name);
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
uint32_t st = DEVICE_PM_ACTIVE_STATE;
|
||||
int err = device_get_power_state(dev, &st);
|
||||
uint32_t state = DEVICE_PM_ACTIVE_STATE;
|
||||
int err;
|
||||
|
||||
if (!err) {
|
||||
state = device_pm_state_str(st);
|
||||
}
|
||||
err = device_get_power_state(dev, &state);
|
||||
if (!err) {
|
||||
shell_fprintf(shell, SHELL_NORMAL, " (%s)",
|
||||
device_pm_state_str(state));
|
||||
}
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
}
|
||||
|
||||
shell_fprintf(shell, SHELL_NORMAL, " (%s)\n", state);
|
||||
for (size_t di = 0; di < nhdls; ++di) {
|
||||
device_handle_t dh = hdls[di];
|
||||
const struct device *rdp = device_from_handle(dh);
|
||||
|
||||
shell_fprintf(shell, SHELL_NORMAL, " requires: %s\n",
|
||||
get_device_name(rdp, buf, sizeof(buf)));
|
||||
}
|
||||
shell_fprintf(shell, SHELL_NORMAL, "\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue