[igt-dev] [PATCH i-g-t v5 3/5] tools/lsgpu: Add codename switch (-c)
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Jul 19 05:11:42 UTC 2022
Add -c switch which will change default (pretty) platform name to
codename only. It may be useful for writing device selection filter.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
tools/lsgpu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/lsgpu.c b/tools/lsgpu.c
index 27e76f2616..da84e20505 100644
--- a/tools/lsgpu.c
+++ b/tools/lsgpu.c
@@ -73,6 +73,7 @@ enum {
OPT_PRINT_SIMPLE = 's',
OPT_PRINT_DETAIL = 'p',
OPT_NUMERIC = 'n',
+ OPT_CODENAME = 'c',
OPT_LIST_VENDORS = 'v',
OPT_LIST_FILTERS = 'l',
OPT_DEVICE = 'd',
@@ -88,6 +89,7 @@ static const char *usage_str =
"usage: lsgpu [options]\n\n"
"Options:\n"
" -n, --numeric Print vendor/device as hex\n"
+ " -c, --codename Print codename instead pretty device name\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"
@@ -163,6 +165,7 @@ int main(int argc, char *argv[])
{"sysfs", no_argument, NULL, 1},
{"pci", no_argument, NULL, 2},
{"numeric", no_argument, NULL, OPT_NUMERIC},
+ {"codename", no_argument, NULL, OPT_CODENAME},
{"print-simple", no_argument, NULL, OPT_PRINT_SIMPLE},
{"print-detail", no_argument, NULL, OPT_PRINT_DETAIL},
{"list-vendors", no_argument, NULL, OPT_LIST_VENDORS},
@@ -177,13 +180,16 @@ int main(int argc, char *argv[])
.type = IGT_PRINT_USER,
};
- while ((c = getopt_long(argc, argv, "nspvld:h",
+ while ((c = getopt_long(argc, argv, "ncspvld:h",
long_options, &index)) != -1) {
switch(c) {
case OPT_NUMERIC:
fmt.numeric = true;
break;
+ case OPT_CODENAME:
+ fmt.codename = true;
+ break;
case OPT_PRINT_SIMPLE:
fmt.type = IGT_PRINT_SIMPLE;
break;
--
2.34.1
More information about the igt-dev
mailing list