[igt-dev] [PATCH i-g-t v6 3/3] tools/lsgpu: Add -n switch to list devices using vendor:device hex id
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Nov 19 10:50:32 UTC 2020
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 at intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
tools/lsgpu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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;
--
2.26.0
More information about the igt-dev
mailing list