summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-02-24 14:33:20 -0800
committerRandall Spangler <rspangler@chromium.org>2011-02-24 14:33:20 -0800
commit0ca76fcc0cb17104579b4b4de678952590eed953 (patch)
tree0d04073f95389ec1354f2a65ca9b32b10c24cdfc
parent2b59a07c543e3a759f66d37090bd2f1906704ef7 (diff)
downloadvboot-0ca76fcc0cb17104579b4b4de678952590eed953.tar.gz
Print addresses as hex
Change-Id: I37b42088f94ee838e0d82f155ab0674323d859fc BUG=none TEST=manual (run crossystem and see that it prints hex values for savedmem_base and fmap_base) Review URL: http://codereview.chromium.org/6582004
-rw-r--r--utility/crossystem_main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/utility/crossystem_main.c b/utility/crossystem_main.c
index acf39e28..07c14e45 100644
--- a/utility/crossystem_main.c
+++ b/utility/crossystem_main.c
@@ -16,6 +16,7 @@ typedef struct Param {
int is_string; /* 0 if integer, 1 if string */
int can_write; /* 0 if read-only, 1 if writable */
const char* desc; /* Human-readable description */
+ const char* format; /* Format string, if non-NULL and 0==is_string*/
} Param;
/* List of parameters, terminated with a param with NULL name */
@@ -29,9 +30,9 @@ const Param sys_param_list[] = {
{"wpsw_cur", 0, 0, "Firmware write protect switch current position"},
{"wpsw_boot", 0, 0, "Firmware write protect switch position at boot"},
{"recovery_reason", 0, 0, "Recovery mode reason for current boot"},
- {"savedmem_base", 0, 0, "RAM debug data area physical address"},
+ {"savedmem_base", 0, 0, "RAM debug data area physical address", "0x%08x"},
{"savedmem_size", 0, 0, "RAM debug data area size in bytes"},
- {"fmap_base", 0, 0, "Main firmware flashmap physical address"},
+ {"fmap_base", 0, 0, "Main firmware flashmap physical address", "0x%08x"},
/* Read-only strings */
{"hwid", 1, 0, "Hardware ID"},
{"fwid", 1, 0, "Active firmware ID"},
@@ -117,7 +118,7 @@ int PrintParam(const Param* p) {
int v = VbGetSystemPropertyInt(p->name);
if (v == -1)
return 1;
- printf("%d", v);
+ printf(p->format ? p->format : "%d", v);
}
return 0;
}
@@ -140,7 +141,7 @@ int PrintAllParams(void) {
if (v == -1)
value = NULL;
else {
- snprintf(buf, sizeof(buf), "%d", v);
+ snprintf(buf, sizeof(buf), p->format ? p->format : "%d", v);
value = buf;
}
}