feature_en: take DRM card name as arg, or use built-in option
authorSubhajit Paul <subhajit_paul@ti.com>
Thu, 4 Jul 2019 10:14:26 +0000 (15:44 +0530)
committerSubhajit Paul <subhajit_paul@ti.com>
Thu, 4 Jul 2019 10:14:26 +0000 (15:44 +0530)
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
app.c

diff --git a/app.c b/app.c
index 444b59d0538ea30e5a57c30898878a4baa6119d3..d2eb42f8007374c9d3bec50ac5e7d2dff2f5aec6 100644 (file)
--- a/app.c
+++ b/app.c
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <drm_util.h>
 #include <util.h>
+#include <unistd.h>
 
 #include <assets/asset-config.h>
 
@@ -28,18 +29,30 @@ bool plane_split = false;
 
 bool fps_show = true;
 
-int main()
+int main(int argc, char **argv)
 {
        int ret;
+       int opt;
        bool keep_going = true;
        int dial_layer_id;
        int needle_layer_id;
        pthread_t drm_thread;
+       char *dev_name = CONFIG_DRM_DEVICE_NAME;
 
        BUILD_BUG_ON(CONFIG_DISPLAY_WIDTH < CONFIG_WIDTH);
        BUILD_BUG_ON(CONFIG_DISPLAY_HEIGHT < CONFIG_HEIGHT);
 
-       ret = setup_drm(CONFIG_DRM_DEVICE_NAME);
+       while ((opt = getopt(argc, argv, "d:")) != -1) {
+               switch (opt) {
+               case 'd':
+                      dev_name = optarg;
+                      break;
+               default:
+                       printf("arguments parsing failed\n");
+                       return 0;
+               }
+       }
+       ret = setup_drm(dev_name);
        if(ret) {
                printf("setup_drm failed\n");
                return 0;