From 68d057f20d7c3a93b441d2892c4749392bc83b45 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 21 Jan 2012 10:14:47 -0800 Subject: Add fdtget utility to read property values from a device tree This simply utility makes it easy for scripts to read values from the device tree. It is written in C and uses the same libfdt as the rest of the dtc package. What is it for: - Reading fdt values from scripts - Extracting fdt information within build systems - Looking at particular values without having to dump the entire tree To use it, specify the fdt binary file on command line followed by a list of node, property pairs. The utility then looks up each node, finds the property and displays the value. Each value is printed on a new line. fdtget tries to guess the type of each property based on its contents. This is not always reliable, so you can use the -t option to force fdtget to decode the value as a string, or byte, etc. To read from stdin, use - as the file. Usage: fdtget
[ ]... Options: -t Type of data -h Print this help s=string, i=int, u=unsigned, x=hex Optional modifier prefix: hh or b=byte, h=2 byte, l=4 byte (default) Signed-off-by: Simon Glass --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 730918e..c8eb45d 100644 --- a/util.h +++ b/util.h @@ -140,4 +140,14 @@ int utilfdt_write_err(const char *filename, const void *blob); */ int utilfdt_decode_type(const char *fmt, int *type, int *size); +/* + * This is a usage message fragment for the -t option. It is the format + * supported by utilfdt_decode_type. + */ + +#define USAGE_TYPE_MSG \ + "\ts=string, i=int, u=unsigned, x=hex\n" \ + "\tOptional modifier prefix:\n" \ + "\t\thh or b=byte, h=2 byte, l=4 byte (default)\n"; + #endif /* _UTIL_H */ -- cgit v1.1