summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2020-11-27 09:28:34 +0100
committerPetri Latvala <petri.latvala@intel.com>2020-11-30 12:27:10 +0200
commitd1688b297ccd5600cb465dd84685591d63a18026 (patch)
tree29b45b01cc560abd4024264c307dce00d8fa7242
parent254eb00975064b9765b1d2e237a15fc6b690ad1a (diff)
tools/lsgpu: Add -n switch to list devices using vendor:device hex id
Default device list prefers vendor and device names. Add -n switch to display vendor/device as hex strings. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--tools/lsgpu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/lsgpu.c b/tools/lsgpu.c
index 169ab0c2..25358bbe 100644
--- a/tools/lsgpu.c
+++ b/tools/lsgpu.c
@@ -72,6 +72,7 @@
enum {
OPT_PRINT_SIMPLE = 's',
OPT_PRINT_DETAIL = 'p',
+ OPT_NUMERIC = 'n',
OPT_LIST_VENDORS = 'v',
OPT_LIST_FILTERS = 'l',
OPT_DEVICE = 'd',
@@ -86,6 +87,7 @@ static char *igt_device;
static const char *usage_str =
"usage: lsgpu [options]\n\n"
"Options:\n"
+ " -n, --numeric Print vendor/device as hex\n"
" -s, --print-simple Print simple (legacy) device details\n"
" -p, --print-details Print devices with details\n"
" -v, --list-vendors List recognized vendors\n"
@@ -160,6 +162,7 @@ int main(int argc, char *argv[])
{"drm", no_argument, NULL, 0},
{"sysfs", no_argument, NULL, 1},
{"pci", no_argument, NULL, 2},
+ {"numeric", no_argument, NULL, OPT_NUMERIC},
{"print-simple", no_argument, NULL, OPT_PRINT_SIMPLE},
{"print-detail", no_argument, NULL, OPT_PRINT_DETAIL},
{"list-vendors", no_argument, NULL, OPT_LIST_VENDORS},
@@ -174,10 +177,13 @@ int main(int argc, char *argv[])
.type = IGT_PRINT_USER,
};
- while ((c = getopt_long(argc, argv, "spvld:h",
+ while ((c = getopt_long(argc, argv, "nspvld:h",
long_options, &index)) != -1) {
switch(c) {
+ case OPT_NUMERIC:
+ fmt.numeric = true;
+ break;
case OPT_PRINT_SIMPLE:
fmt.type = IGT_PRINT_SIMPLE;
break;