2 * Media controller test application
4 * Copyright (C) 2010 Ideas on board SPRL <laurent.pinchart@ideasonboard.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
27 #define MEDIA_DEVNAME_DEFAULT "/dev/media0"
29 struct media_options media_opts = {
30 .devname = MEDIA_DEVNAME_DEFAULT,
33 static void usage(const char *argv0)
35 printf("%s [options] device\n", argv0);
36 printf("-d, --device dev Media device name (default: %s)\n", MEDIA_DEVNAME_DEFAULT);
37 printf("-e, --entity name Print the device name associated with the given entity\n");
38 printf("-f, --formats Comma-separated list of formats to setup\n");
39 printf("-h, --help Show this help screen\n");
40 printf("-i, --interactive Modify links interactively\n");
41 printf("-l, --links Comma-separated list of links descriptors to setup\n");
42 printf("-p, --print-topology Print the device topology (implies -v)\n");
43 printf("-r, --reset Reset all links to inactive\n");
44 printf("-v, --verbose Be verbose\n");
47 static struct option opts[] = {
48 {"device", 1, 0, 'd'},
49 {"entity", 1, 0, 'e'},
50 {"formats", 1, 0, 'f'},
52 {"interactive", 0, 0, 'i'},
54 {"print-topology", 0, 0, 'p'},
56 {"verbose", 0, 0, 'v'},
59 int parse_cmdline(int argc, char **argv)
69 while ((opt = getopt_long(argc, argv, "d:e:f:hil:prv", opts, NULL)) != -1) {
72 media_opts.devname = optarg;
76 media_opts.entity = optarg;
80 media_opts.formats = optarg;
88 media_opts.interactive = 1;
92 media_opts.links = optarg;
97 media_opts.verbose = 1;
101 media_opts.reset = 1;
105 media_opts.verbose = 1;
109 printf("Invalid option -%c\n", opt);
110 printf("Run %s -h for help.\n", argv[0]);