summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2011-10-07 18:38:08 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-10-08 13:32:28 +0200
commitfa46b9ec30558c5c3680b167e7a4b4966c6e9e46 (patch)
treef441a2c1889683f7c6e2ebd96e73ac9814091ea0 /src/main.c
parent2738635d82da5f010bae6a60472a6306df949ea5 (diff)
Remove extra verbosity
Remove extra verbosity by default; "-v" option brings back what used to be there. The error messages are now being printed by main.c with the possibly helpful error code attached. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 40ab13e..57bbc16 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,10 +288,16 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
/* Open the media device and enumerate entities, pads and links. */
- media = media_open_debug(media_opts.devname, media_opts.verbose,
- (void (*)(void *, ...))fprintf, stdout);
- if (media == NULL)
+ if (media_opts.verbose)
+ media = media_open_debug(
+ media_opts.devname,
+ (void (*)(void *, ...))fprintf, stdout);
+ else
+ media = media_open(media_opts.devname);
+ if (media == NULL) {
+ printf("Failed to open %s\n", media_opts.devname);
goto out;
+ }
if (media_opts.entity) {
struct media_entity *entity;
@@ -326,15 +332,34 @@ int main(int argc, char **argv)
}
if (media_opts.reset) {
- printf("Resetting all links to inactive\n");
- media_reset_links(media);
+ if (media_opts.verbose)
+ printf("Resetting all links to inactive\n");
+ ret = media_reset_links(media);
+ if (ret) {
+ printf("Unable to reset links: %s (%d)\n",
+ strerror(-ret), -ret);
+ goto out;
+ }
}
- if (media_opts.links)
- media_parse_setup_links(media, media_opts.links);
+ if (media_opts.links) {
+ ret = media_parse_setup_links(media, media_opts.links);
+ if (ret) {
+ printf("Unable to parse link: %s (%d)\n",
+ strerror(-ret), -ret);
+ goto out;
+ }
+ }
- if (media_opts.formats)
- v4l2_subdev_parse_setup_formats(media, media_opts.formats);
+ if (media_opts.formats) {
+ ret = v4l2_subdev_parse_setup_formats(media,
+ media_opts.formats);
+ if (ret) {
+ printf("Unable to parse format: %s (%d)\n",
+ strerror(-ret), -ret);
+ goto out;
+ }
+ }
if (media_opts.interactive) {
while (1) {
@@ -348,7 +373,10 @@ int main(int argc, char **argv)
if (buffer[0] == '\n')
break;
- media_parse_setup_link(media, buffer, &end);
+ ret = media_parse_setup_link(media, buffer, &end);
+ if (ret)
+ printf("Unable to parse link: %s (%d)\n",
+ strerror(-ret), -ret);
}
}