diff options
author | Adam Jackson <ajax@redhat.com> | 2011-10-11 18:25:26 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2011-10-11 18:25:26 -0400 |
commit | eaaddc794bade33e0d7b0c94406102c9814c2c05 (patch) | |
tree | 56ac47c2f618cfc789216797ebbc71a5dbc4dbec | |
parent | 1708580217ed403f0abd086f15baddf98cb0fb5a (diff) |
bios_reader: Allow forcing the device ID with DEVICE=0xNNNN
As a pleasant side effect you can now feed it an opregion dump and it'll
decode without crashing.
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | tools/intel_bios_reader.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c index 92fd13df..fc60a0bb 100644 --- a/tools/intel_bios_reader.c +++ b/tools/intel_bios_reader.c @@ -38,7 +38,7 @@ #include "intel_bios.h" #include "intel_gpu_tools.h" -static uint32_t devid; +static uint32_t devid = -1; /* no bother to include "edid.h" */ #define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4)) @@ -833,12 +833,16 @@ int main(int argc, char **argv) struct stat finfo; struct bdb_block *block; char signature[17]; + char *devid_string; if (argc != 2) { printf("usage: %s <rom file>\n", argv[0]); return 1; } + if ((devid_string = getenv("DEVICE"))) + devid = strtoul(devid_string, NULL, 0); + filename = argv[1]; fd = open(filename, O_RDONLY); @@ -911,7 +915,8 @@ int main(int argc, char **argv) } printf("\n"); - devid = get_device_id(VBIOS); + if (devid == -1) + devid = get_device_id(VBIOS); if (devid == -1) printf("Warning: could not find PCI device ID!\n"); |