[PATCH v2 3/3] modetest: Add a command line parameter to select the driver
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Feb 11 12:33:30 PST 2013
On Monday 11 February 2013 21:13:45 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 | 41 ++++++++++++++++++++++++++++-------------
> 1 file changed, 28 insertions(+), 13 deletions(-)
>
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index 34457e2..9a2d1f8 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]);
> - fd = drmOpen(modules[i], NULL);
> + if (module) {
> + fd = drmOpen(module, NULL);
> if (fd < 0) {
> - printf("failed.\n");
> - } else {
> - printf("success.\n");
> - break;
> + fprintf(stderr, "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) {
> + fprintf(stderr, "no device found.\n", module);
I should sleep before sending patches... Sorry for the noise, v3 will fix
that.
> + return 1;
> }
> }
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list