From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH 3/3] modetest: Add a command line parameter to select the driver Date: Mon, 11 Feb 2013 22:15:40 +0100 Message-ID: <3137481.eKakhrnyKx@avalon> References: <1360327650-12126-1-git-send-email-laurent.pinchart@ideasonboard.com> <1360327650-12126-4-git-send-email-laurent.pinchart@ideasonboard.com> <87liazc5fd.fsf@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id 06317E5C94 for ; Mon, 11 Feb 2013 13:15:29 -0800 (PST) In-Reply-To: <87liazc5fd.fsf@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Jani Nikula Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Hi Jani, On Friday 08 February 2013 15:15:50 Jani Nikula wrote: > On Fri, 08 Feb 2013, Laurent Pinchart wrote: > > If the -M parameter is specific, modetest will use the requested device > > name instead of trying its builtin list of device names. > > > > Signed-off-by: Laurent Pinchart > > --- > > > > tests/modetest/modetest.c | 34 +++++++++++++++++++++++++++------- > > 1 file changed, 27 insertions(+), 7 deletions(-) > > > > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c > > index 34457e2..b6298fc 100644 > > --- a/tests/modetest/modetest.c > > +++ b/tests/modetest/modetest.c [snip] > > @@ -989,14 +996,27 @@ int main(int argc, char **argv) > > if (argc == 1) > > encoders = connectors = crtcs = planes = modes = framebuffers = > > 1; > > > > - for (i = 0; i < ARRAY_SIZE(modules); i++) { > > - printf("trying to load module %s...", modules[i]); > > + if (module) { > > > > fd = drmOpen(modules[i], NULL); > > If this worked for you, I presume you have some uncommitted changes in > your tree. ;) The compiler should cry about uninitialized use of i too. > > fd = drmOpen(module, NULL); ? Oops :-) modetest is compiled without any -W flag. I'll send a v4 that enables warnings and fixes them (please ignore the v3, sorry for the noise). > > if (fd < 0) { > > > > - printf("failed.\n"); > > - } else { > > - printf("success.\n"); > > - break; > > + printf("failed to open device '%s'.\n", module); > > + return 1; > > + } > > + } else { > > + for (i = 0; i < ARRAY_SIZE(modules); i++) { > > + printf("trying to open device '%s'...", modules[i]); > > + fd = drmOpen(modules[i], NULL); > > + if (fd < 0) { > > + printf("failed.\n"); > > + } else { > > + printf("success.\n"); > > + break; > > + } > > + } > > + > > + if (fd < 0) { > > + printf("no device found.\n", module); > > Extra param to printf. Will be fixed in v4. -- Regards, Laurent Pinchart