diff mbox

[i-g-t,13/17] tools/intel_bios_reader: add --hexdump option to dump hex, disable by default

Message ID c6d8fbad05beab0f33cec6dd08ee4a3dddbdc28d.1462285023.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula May 3, 2016, 2:19 p.m. UTC
The hex dump is useful, just not by default.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios_reader.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
index 94b0d6055eb1..0b334871224d 100644
--- a/tools/intel_bios_reader.c
+++ b/tools/intel_bios_reader.c
@@ -67,6 +67,7 @@  struct context {
 
 	uint32_t devid;
 	int panel_type;
+	bool hexdump;
 };
 
 /* Get BDB block size given a pointer to Block ID. */
@@ -1386,7 +1387,8 @@  static void dump_section(struct context *context, int section_id)
 	else
 		printf("BDB block %d:\n", block->id);
 
-	hex_dump(block);
+	if (context->hexdump)
+		hex_dump(block);
 	if (dumper && dumper->dump)
 		dumper->dump(context, block);
 	printf("\n");
@@ -1398,6 +1400,7 @@  enum opt {
 	OPT_FILE,
 	OPT_DEVID,
 	OPT_PANEL_TYPE,
+	OPT_HEXDUMP,
 };
 
 int main(int argc, char **argv)
@@ -1423,6 +1426,7 @@  int main(int argc, char **argv)
 		{ "file",	required_argument,	NULL,	OPT_FILE },
 		{ "devid",	required_argument,	NULL,	OPT_DEVID },
 		{ "panel-type",	required_argument,	NULL,	OPT_PANEL_TYPE },
+		{ "hexdump",	no_argument,		NULL,	OPT_HEXDUMP },
 		{ 0 }
 	};
 
@@ -1448,6 +1452,9 @@  int main(int argc, char **argv)
 				return EXIT_FAILURE;
 			}
 			break;
+		case OPT_HEXDUMP:
+			context.hexdump = true;
+			break;
 		case OPT_END:
 			break;
 		case OPT_UNKNOWN: