diff options
author | Holger Schurig <holgerschurig@gmail.com> | 2014-05-30 11:07:29 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-06-02 09:07:11 +0200 |
commit | 287c03267ebf5c5c4fea5b3d1e2bf53a838bfb19 (patch) | |
tree | 1c61d302bd589d287b67396ec4d3b42b31bd5e3f /commands | |
parent | c19c0da71caaeb2dc6f53e7d53d9ebad24e46c09 (diff) | |
download | barebox-287c03267ebf5c5c4fea5b3d1e2bf53a838bfb19.tar.gz barebox-287c03267ebf5c5c4fea5b3d1e2bf53a838bfb19.tar.xz |
devinfo: make the output of "devinfo DEVICE" nicer
* some output sections started with "foo: bar", some with "foo = bar". Unify this.
* there was a fixed size to the "foo =" parameters, which wasn't fitting, this
was especially visible at "devinfo global"
* don't output "resources:", "driver:" and "bus:" lines if there are none
resources, drivers or busses involved.
* remove some empty lines
* harmonize differentiation between headlines (e.g. "resources:") and values
by indenting values slightly
* uppercase some texts
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/devinfo.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/commands/devinfo.c b/commands/devinfo.c index 71c9bd4b97..ba1671b6e2 100644 --- a/commands/devinfo.c +++ b/commands/devinfo.c @@ -51,16 +51,16 @@ static int do_devinfo_subtree(struct device_d *dev, int depth) return 0; } + static int do_devinfo(int argc, char *argv[]) { struct device_d *dev; struct param_d *param; int i; + int first; struct resource *res; if (argc == 1) { - printf("devices:\n"); - for_each_device(dev) { if (!dev->parent) do_devinfo_subtree(dev, 0); @@ -73,38 +73,42 @@ static int do_devinfo(int argc, char *argv[]) return -1; } - printf("resources:\n"); + if (dev->num_resources) + printf("Resources:\n"); for (i = 0; i < dev->num_resources; i++) { res = &dev->resource[i]; - printf("num : %d\n", i); + printf(" num: %d\n", i); if (res->name) - printf("name : %s\n", res->name); - printf("start : " PRINTF_CONVERSION_RESOURCE "\nsize : " - PRINTF_CONVERSION_RESOURCE "\n", + printf(" name: %s\n", res->name); + printf(" start: " PRINTF_CONVERSION_RESOURCE "\n" + " size: " PRINTF_CONVERSION_RESOURCE "\n", res->start, resource_size(res)); } - printf("driver: %s\n", dev->driver ? - dev->driver->name : "none"); + if (dev->driver) + printf("Driver: %s\n", dev->driver->name); - printf("bus: %s\n\n", dev->bus ? - dev->bus->name : "none"); + if (dev->bus) + printf("Bus: %s\n", dev->bus->name); if (dev->info) dev->info(dev); - printf("%s\n", list_empty(&dev->parameters) ? - "no parameters available" : "Parameters:"); - + first = true; list_for_each_entry(param, &dev->parameters, list) { - printf("%16s = %s", param->name, dev_get_param(dev, param->name)); - if (param->info) + if (first) { + printf("Parameters:\n"); + first = false; + } + printf(" %s: %s", param->name, dev_get_param(dev, param->name)); + if (param->info) { param->info(param); + } printf("\n"); } #ifdef CONFIG_OFDEVICE if (dev->device_node) { - printf("\ndevice node: %s\n", dev->device_node->full_name); + printf("Device node: %s\n", dev->device_node->full_name); of_print_nodes(dev->device_node, 0); } #endif |