diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-09 13:33:28 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-01-09 13:33:28 +0100 |
commit | 1e42e3e5fdbb6db03d930da2b947b76ae843c7e9 (patch) | |
tree | 3922cb673d71835f7cd614e45f5fa0321eb2a7e0 | |
parent | 3f57e269735e062928a5cb06cd6c50aaee85342a (diff) | |
download | drminfo-1e42e3e5fdbb6db03d930da2b947b76ae843c7e9.tar.gz |
prime: add import/export cmd line switches
-rw-r--r-- | prime.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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); |