aboutsummaryrefslogtreecommitdiffstats
path: root/prime.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-01-09 13:33:28 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-01-09 13:33:28 +0100
commit1e42e3e5fdbb6db03d930da2b947b76ae843c7e9 (patch)
tree3922cb673d71835f7cd614e45f5fa0321eb2a7e0 /prime.c
parent3f57e269735e062928a5cb06cd6c50aaee85342a (diff)
downloaddrminfo-1e42e3e5fdbb6db03d930da2b947b76ae843c7e9.tar.gz
prime: add import/export cmd line switches
Diffstat (limited to 'prime.c')
-rw-r--r--prime.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/prime.c b/prime.c
index 1ef531c..55a4e80 100644
--- a/prime.c
+++ b/prime.c
@@ -159,7 +159,7 @@ void gbm_export_import(int ex, int im)
char devname[64];
int card_ex, card_im, dmabuf;
- fprintf(stderr, "test export/import: %d -> %d\n", ex, im);
+ fprintf(stderr, "test export/import: card %d -> card %d\n", ex, im);
snprintf(devname, sizeof(devname), DRM_DEV_NAME, DRM_DIR_NAME, ex);
card_ex = open(devname, O_RDWR);
@@ -216,6 +216,8 @@ static void usage(FILE *fp)
"\n"
"options:\n"
" -h print this\n"
+ " -e <nr> export from this card\n"
+ " -i <nr> import into this card\n"
"\n");
}
@@ -228,10 +230,16 @@ int main(int argc, char **argv)
int im = -1;
for (;;) {
- c = getopt(argc, argv, "h");
+ c = getopt(argc, argv, "he:i:");
if (c == -1)
break;
switch (c) {
+ case 'e':
+ ex = atoi(optarg);
+ break;
+ case 'i':
+ im = atoi(optarg);
+ break;
case 'h':
usage(stdout);
exit(0);