testdisplay: Test the first mode if there is no preferred mode.
authorHai Lan <hai.lan@intel.com>
Tue, 31 May 2011 21:13:30 +0000 (17:13 -0400)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 13 Jul 2011 06:05:54 +0000 (14:05 +0800)
For a TV device, there  might be no preferred mode. In this case,
we can test the first mode.

Signed-off-by: Hai Lan <hai.lan@intel.com>
tests/testdisplay.c

index e8e3309..dae52ca 100644 (file)
@@ -325,9 +325,16 @@ static void connector_find_preferred_mode(struct connector *c)
        }
 
        if (!c->mode_valid) {
-               fprintf(stderr, "failed to find any modes on connector %d\n",
-                       c->id);
-               return;
+               if (connector->count_modes > 0) {
+                       /* use the first mode as test mode */
+                       c->mode = connector->modes[0];
+                       c->mode_valid = 1;
+               }
+               else {
+                       fprintf(stderr, "failed to find any modes on connector %d\n",
+                               c->id);
+                       return;
+               }
        }
 
        /* Now get the encoder */