[PATCH 3/3] modetest: Add a command line parameter to select the driver
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Feb 11 13:15:40 PST 2013
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 <laurent.pinchart at ideasonboard.com>
> > ---
> >
> > 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
More information about the dri-devel
mailing list