media-ctl.git
9 years agoMake the media_device structure private
Laurent Pinchart [Tue, 31 Jul 2012 13:28:22 +0000 (15:28 +0200)]
Make the media_device structure private

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
9 years agoSplit media_device creation and opening
Laurent Pinchart [Tue, 31 Jul 2012 11:10:44 +0000 (13:10 +0200)]
Split media_device creation and opening

Make the media_device refcounted to manage its life time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
9 years agoRead errno before media_dbg calls
Laurent Pinchart [Mon, 10 Mar 2014 18:49:22 +0000 (19:49 +0100)]
Read errno before media_dbg calls

The media_dbg() in error paths can modify the errno value, leading to
the wrong error (or no error at all) being returned. Fix this by reading
the errno value before calling media_dbg().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agoPrint v4l parser position on error
Laurent Pinchart [Thu, 26 Sep 2013 20:16:24 +0000 (22:16 +0200)]
Print v4l parser position on error

Most parser functions take a **endp argument to indicate the caller
where parsing has stopped. This is currently only used after parsing
something successfully. This patch sets **endp to the erroneous
position in the error case and prints its position after an error
has occured.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agoPrint more detailed v4l parse error messages
Laurent Pinchart [Thu, 26 Sep 2013 19:57:44 +0000 (21:57 +0200)]
Print more detailed v4l parse error messages

The following errors usually resulted in the same 'Unable to parse
format' message:

- syntax error in format description
- the requested pixel code isn't supported

Add more detailed error messages to give the user a clue what is going
wrong.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agoSupport both " and ' as string delimiters when parsing the command line
Laurent Pinchart [Thu, 22 Aug 2013 16:20:59 +0000 (18:20 +0200)]
Support both " and ' as string delimiters when parsing the command line

Entity names are enclosed in quotes. Support both double-quoted and
single-quoted strings.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agooptions: don't imply -v when doing a -p.
André Draszik [Mon, 5 Aug 2013 13:28:04 +0000 (14:28 +0100)]
options: don't imply -v when doing a -p.

This avoids us getting (unnecessary) debug messages during -p.

Signed-off-by: Alain Volmat <alain.volmat@st.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agoPrint parser position on error
Sascha Hauer [Wed, 8 May 2013 13:27:54 +0000 (15:27 +0200)]
Print parser position on error

Most parser functions take a **endp argument to indicate the caller
where parsing has stopped. This is currently only used after parsing
something successfully. This patch sets **endp to the erroneous
position in the error case and prints its position after an error
has occured.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[Remove endp NULL checks spread around the code]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agoPrint more detailed parse error messages
Sascha Hauer [Wed, 8 May 2013 13:27:53 +0000 (15:27 +0200)]
Print more detailed parse error messages

The following errors usually resulted in the same 'Unable to parse link'
message:

- one of the given entities does not exist
- one of the pads of a given entity does not exist
- No link exists between given pads
- syntax error in link description

Add more detailed error messages to give the user a clue what is going wrong.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
10 years agoFix linking of shared libraries
Andreas Bombe [Tue, 19 Feb 2013 21:03:53 +0000 (22:03 +0100)]
Fix linking of shared libraries

When using libudev, it is actually libmediactl that uses it and not the
media-ctl executable. libv4l2subdev uses functions from libmediactl and
therefore needs to be linked against it.

Signed-off-by: Andreas Bombe <aeb@debian.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoAdd missing stdlib.h and ctype.h includes
Andreas Bombe [Mon, 18 Feb 2013 00:12:44 +0000 (01:12 +0100)]
Add missing stdlib.h and ctype.h includes

src/mediactl.c needs ctype.h for its use of isspace().

src/v4l2subdev.c needs stdlib.h for strtoul() and ctype.h for isspace()
and isupper().

Signed-off-by: Andreas Bombe <aeb@debian.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoconfigure.ac: Respect CPPFLAGS from environment
Andreas Bombe [Mon, 18 Feb 2013 00:10:02 +0000 (01:10 +0100)]
configure.ac: Respect CPPFLAGS from environment

Signed-off-by: Andreas Bombe <aeb@debian.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoSort headers alphabetically
Laurent Pinchart [Mon, 25 Mar 2013 22:00:35 +0000 (23:00 +0100)]
Sort headers alphabetically

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoPrint media entity flags when printing device topology
Laurent Pinchart [Wed, 8 Aug 2012 19:00:57 +0000 (21:00 +0200)]
Print media entity flags when printing device topology

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoAdd documentation generation through Doxygen
Laurent Pinchart [Tue, 5 Feb 2013 13:14:08 +0000 (14:14 +0100)]
Add documentation generation through Doxygen

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agomedia: Fix valgrind warnings
Laurent Pinchart [Thu, 15 Nov 2012 10:30:44 +0000 (11:30 +0100)]
media: Fix valgrind warnings

valgrind has no way to know that the kernel will fill links and pads
arrays passed to an ioctl through __user pointers. Allocate the arrays
with calloc() to make sure they get initialized. This also fixes the
potential integer overflow.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
10 years agomedia-ctl: Fix build error with newer autotools
Gary Thomas [Mon, 24 Sep 2012 14:34:24 +0000 (08:34 -0600)]
media-ctl: Fix build error with newer autotools

 Rename configure.in to be configure.ac - required for newer
 versions of autotools (older versions silently handled
 this, now it's an error)

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agofix for automake-1.12
Stefan Herbrechtsmeier [Tue, 31 Jul 2012 10:54:07 +0000 (12:54 +0200)]
fix for automake-1.12

This patch fixes following kind of issues with automake 1.12
| automake: warnings are treated as errors
...
| warning: 'libmediactl.la': linking libtool libraries using a non-POSIX
| ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.in'
| warning: 'libv4l2subdev.la': linking libtool libraries using a non-POSIX
| ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.in'
...
| src/Makefile.am:10: warning: compiling 'main.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.in'

Signed-off-by: Stefan Herbrechtsmeier <sherbrec@cit-ec.uni-bielefeld.de>
10 years agoAdd a copy of V4L2 kernel headers
Laurent Pinchart [Tue, 17 Jul 2012 23:58:16 +0000 (01:58 +0200)]
Add a copy of V4L2 kernel headers

To make compilation possible on older (< v3.6) kernels, include a
private copy of the V4L2 headers. API availability is checked and
handled at runtime.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoReplace V4L2 subdev selection targets with the V4L2 ones
Sakari Ailus [Tue, 22 May 2012 22:31:00 +0000 (01:31 +0300)]
Replace V4L2 subdev selection targets with the V4L2 ones

V4L2 selection targets will replace V4L2 subdev selection targets in the
near future. As the targets are guaranteed to be the same and the chance is
anticipated very soon, replace the subdev targets with more future-proof
V4L2 targets.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 years agoDrop _ACTUAL from selection target names
Sakari Ailus [Tue, 22 May 2012 22:30:59 +0000 (01:30 +0300)]
Drop _ACTUAL from selection target names

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agomedia-ctl: Compose print fixes
Sakari Ailus [Sat, 26 May 2012 16:43:16 +0000 (19:43 +0300)]
media-ctl: Compose print fixes

The compose rectangles were printed incorrectly in my recent patch "Compose
rectangle support for libv4l2subdev" without parenthesis. Fix this.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoCompose rectangle support for libv4l2subdev
Sakari Ailus [Tue, 22 May 2012 22:30:58 +0000 (01:30 +0300)]
Compose rectangle support for libv4l2subdev

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoNew, more flexible syntax for format
Sakari Ailus [Tue, 22 May 2012 22:30:57 +0000 (01:30 +0300)]
New, more flexible syntax for format

More flexible and extensible syntax for format which allows better usage
of the selection API.

Continue supporting the old syntax but remove the documentation for it. It
was not supported in an official release and its use is thus deprecated.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agooptions: Remove unnecessary commas from EBNF syntax
Laurent Pinchart [Fri, 25 May 2012 09:06:49 +0000 (11:06 +0200)]
options: Remove unnecessary commas from EBNF syntax

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agolibmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id()
Sakari Ailus [Sat, 14 Jan 2012 19:33:36 +0000 (21:33 +0200)]
libmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id()

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
[laurent.pinchart@ideasonboard Clarify documentation]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoSupport selections API for crop
Sakari Ailus [Fri, 4 May 2012 08:24:41 +0000 (11:24 +0300)]
Support selections API for crop

Support the new selections API for crop. Fall back to use the old crop API
in case the selection API isn't available.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoCompare name length to avoid false positives in media_get_entity_by_name
Sergio Aguirre [Wed, 25 Apr 2012 13:57:13 +0000 (08:57 -0500)]
Compare name length to avoid false positives in media_get_entity_by_name

If two subdevice have names that only differ by a suffix (such as "OMAP4
ISS ISP IPIPE" and "OMAP4 ISS ISP IPIPEIF") the media_get_entity_by_name
function might return a pointer to the entity with the longest name when
called with the shortest name. Fix this by verifying that the candidate
entity name length is equal to the requested name length.

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoAdd support for YUV420 formats
Sergio Aguirre [Sun, 8 Apr 2012 03:54:34 +0000 (22:54 -0500)]
Add support for YUV420 formats

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoSeveral printout fixes.
Sakari Ailus [Fri, 14 Oct 2011 16:05:33 +0000 (19:05 +0300)]
Several printout fixes.

- There are sink and source pads, not input and output.
- Print also DYNAMIC flag.
- Don't print "pad" before pad number in some cases. The strings are more
  usable for link parsing now.
- Don't print extra commas afterlink flags.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoPrint media device information when called with -p/--print
Laurent Pinchart [Tue, 11 Oct 2011 09:42:49 +0000 (11:42 +0200)]
Print media device information when called with -p/--print

In addition to printing pipeline information, print the media device
information.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoSwitch to the LGPLv2.1+ license
Laurent Pinchart [Wed, 5 Oct 2011 19:41:22 +0000 (21:41 +0200)]
Switch to the LGPLv2.1+ license

Mail sent to all contributors on 2011-09-30:

Hi everybody,

Sakari made me realize today that the media-ctl project is still licensed
under the GPL v2+ license, while I would have sworn that we had switched to
LGPL a long time ago.

I would like to relicense the media-ctl project under the LGPL v2.1+, to allow
LGPL-compatible applications and libraries (such as libv4l for instance, or
its plugins) to link to libmediactl and libv4l2subdev.

As you all have submitted patches that are now included in the media-ctl
project, I'm requesting your permission to proceed with the license change.

--------------------------------------------------------------------------------
From: Todor Tomov <ttomov@mm-sol.com>
  To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2011-09-30 12:06:17

Hi Laurent,

No problems from my side.

--
Best regards,
Todor Tomov

--------------------------------------------------------------------------------
From: "Aguirre, Sergio" <saaguirre@ti.com>
  To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2011-09-30 15:41:45

Hi Laurent,

No problem for me. You can go ahead, if everyone else agrees of course.

Regards,
Sergio

--------------------------------------------------------------------------------
From: Sakari Ailus <sakari.ailus@iki.fi>
  To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2011-09-30 16:17:18

I'm in favour of the change, actually I think it's next to mandatory for the
library to be useful in a way it was intended.

Cheers,

--
Sakari Ailus

--------------------------------------------------------------------------------
From: Michael Jones <michael.jones@matrix-vision.de>
  To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2011-10-04 08:33:17

Changing the license is fine with me.

-Michael

--------------------------------------------------------------------------------
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (Intel Finland Oy)
  To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2011-10-10 14:26:00

I have no objections.
But I didn't remember libudev exact license... Ah, okay, it's licensed
under LGPLv2.1+.

--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

--------------------------------------------------------------------------------

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoAdditional formats used by BT-656 sensors
Gary Thomas [Thu, 6 Oct 2011 13:40:22 +0000 (07:40 -0600)]
Additional formats used by BT-656 sensors

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoRemove extra verbosity
Sakari Ailus [Fri, 7 Oct 2011 15:38:08 +0000 (18:38 +0300)]
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>
11 years agoAdd debugging handler
Sakari Ailus [Fri, 7 Oct 2011 15:38:07 +0000 (18:38 +0300)]
Add debugging handler

Add debugging handler to media_device that may be used to redirect all debug
formatting to user-supplied function. fprintf will do, and that's what
media-ctl test program will use.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoAdd link to media_device from the media_entity
Sakari Ailus [Fri, 7 Oct 2011 15:38:06 +0000 (18:38 +0300)]
Add link to media_device from the media_entity

This makes it possible to obtain the media device an entity belongs to.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agolibv4l2subdev and libmediactl are not test programs
Sakari Ailus [Fri, 7 Oct 2011 15:38:05 +0000 (18:38 +0300)]
libv4l2subdev and libmediactl are not test programs

Call the libraries libraries rather than test programs.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoMove V4L2 subdev format parsing from main.c to subdev.c
Sakari Ailus [Fri, 7 Oct 2011 15:38:04 +0000 (18:38 +0300)]
Move V4L2 subdev format parsing from main.c to subdev.c

This makes format parsing a part of the libv4l2subdev and thus available on
all who use the library.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoMove link parsing from main.c to media.c, making it part of libmediactl
Sakari Ailus [Fri, 7 Oct 2011 15:38:03 +0000 (18:38 +0300)]
Move link parsing from main.c to media.c, making it part of libmediactl

This makes it possible to benefit from the link parsing code anywhere the
library is being used.

dprintf macro will later be replaced with proper debug support.

Also fix a case where -1 was returned on error and the user was expected to
check the value of errno. Negative error codes are now returned
consistently.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoRename files to match the names of the libraries
Sakari Ailus [Fri, 7 Oct 2011 15:38:02 +0000 (18:38 +0300)]
Rename files to match the names of the libraries

Rename media.* to mediactl.* and subdev.* v4l2subdev.*.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agolibmediactl: get rid of memset via using calloc
Andy Shevchenko [Mon, 5 Sep 2011 15:24:07 +0000 (18:24 +0300)]
libmediactl: get rid of memset via using calloc

The code snippet
x = malloc(sizeof(*x));
memset(x, 0, sizeof(*x));
could be easily changed to
x = calloc(1, sizeof(*x));

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
11 years agolibmediactl: get the device name via udev
Andy Shevchenko [Mon, 5 Sep 2011 15:24:05 +0000 (18:24 +0300)]
libmediactl: get the device name via udev

If configured with --with-libudev, the libmediactl is built with libudev
support. It allows to get the device name in right way in the modern linux
systems.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[laurent.pinchart@ideasonboard.com: Remove media_private structure]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agolibmediactl: split media_get_devname_sysfs from media_enum_entities
Andy Shevchenko [Mon, 5 Sep 2011 15:24:04 +0000 (18:24 +0300)]
libmediactl: split media_get_devname_sysfs from media_enum_entities

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
11 years agolibmediactl: restruct error path
Andy Shevchenko [Mon, 5 Sep 2011 15:24:03 +0000 (18:24 +0300)]
libmediactl: restruct error path

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[laurent.pinchart@ideasonboard.com: Fix return value at end of
enumeration]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoDon't perform AC_FUNC_MALLOC and AC_FUNC_REALLOC when cross-compiling
Laurent Pinchart [Tue, 6 Sep 2011 09:53:21 +0000 (11:53 +0200)]
Don't perform AC_FUNC_MALLOC and AC_FUNC_REALLOC when cross-compiling

Those autoconf tests assume that the target libc doesn't have
GNU-compatible malloc and realloc implementations when cross-compiling,
which breaks compilation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 years agoAllow using autoconf 2.61+
Michael Jones [Tue, 21 Jun 2011 07:39:17 +0000 (09:39 +0200)]
Allow using autoconf 2.61+

Autoconf v2.61 seems to work just fine. Allow it.

Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
11 years agoAdd Y10, Y12 formats
Michael Jones [Tue, 21 Jun 2011 07:39:16 +0000 (09:39 +0200)]
Add Y10, Y12 formats

Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
12 years agoAdd missing 8-, 10- and 12-bit Bayer formats
Laurent Pinchart [Wed, 11 May 2011 09:40:21 +0000 (11:40 +0200)]
Add missing 8-, 10- and 12-bit Bayer formats

Thanks for Javier Martin for pointing out they were missing.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoReset file descriptor value after closing a subdev
Todor Tomov [Mon, 11 Apr 2011 15:51:16 +0000 (18:51 +0300)]
Reset file descriptor value after closing a subdev

After a subdev is closed set entity->fd to -1.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUpdate stored link flags correctly in media_setup_link()
Todor Tomov [Fri, 8 Apr 2011 08:07:30 +0000 (11:07 +0300)]
Update stored link flags correctly in media_setup_link()

The flags stored in media_link structure are not updated correctly if
media_setup_link() is called on an immutable link - the immutable flag
is cleared. Fix this.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUpdate to the latest media kernel API
Laurent Pinchart [Tue, 21 Dec 2010 12:00:02 +0000 (13:00 +0100)]
Update to the latest media kernel API

The media kernel API has seen many changes during the review process,
update the media-ctl application accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoPrint all links in media_print_topology_text()
Todor Tomov [Tue, 25 Jan 2011 15:46:49 +0000 (17:46 +0200)]
Print all links in media_print_topology_text()

Add printing of inbound links in media_print_topology_text().

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUpdate to the latest media kernel API
Laurent Pinchart [Tue, 21 Dec 2010 12:00:02 +0000 (13:00 +0100)]
Update to the latest media kernel API

The media kernel API has seen many changes during the review process,
update the media-ctl application accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoRename libraries to descriptive names
Todor Tomov [Wed, 16 Feb 2011 12:33:34 +0000 (14:33 +0200)]
Rename libraries to descriptive names

Rename libraries to more descriptive names:
libmedia  -> libmediactl
libsubdev -> libv4l2subdev

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoInstall header files to subdir
Todor Tomov [Wed, 16 Feb 2011 12:33:33 +0000 (14:33 +0200)]
Install header files to subdir

Install media.h and subdev.h header files to mediactl/ subdirectory.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUpdate flags in twin link in media_setup_link()
Todor Tomov [Fri, 11 Feb 2011 14:24:04 +0000 (16:24 +0200)]
Update flags in twin link in media_setup_link()

Fix media_setup_link() to update flags in twin link too.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUse local variable to access link's flags in media_enum_links()
Todor Tomov [Fri, 11 Feb 2011 14:24:03 +0000 (16:24 +0200)]
Use local variable to access link's flags in media_enum_links()

Local variable link is defined in media_enum_links() for more simple
access to link's data. Use it when accessing link's flags.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUpdate .gitignore
Todor Tomov [Fri, 11 Feb 2011 14:24:02 +0000 (16:24 +0200)]
Update .gitignore

Add autotools temporary files to .gitignore.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUse pkg-config
Todor Tomov [Thu, 3 Feb 2011 08:50:51 +0000 (10:50 +0200)]
Use pkg-config

Install libmedia.pc and libsubdev.pc files for use from pkg-config.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoCreate debian packages
Todor Tomov [Thu, 3 Feb 2011 08:50:50 +0000 (10:50 +0200)]
Create debian packages

Create debian packages for media-ctl application, media controller
and v4l2 subdevice libraries.
Set initial version 0.0.1-1.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoBuild libmedia and libsubdev
Todor Tomov [Thu, 3 Feb 2011 08:50:49 +0000 (10:50 +0200)]
Build libmedia and libsubdev

Build media controller and v4l2 subdevice shared libraries.
Use libtool for building.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUse autotools
Todor Tomov [Thu, 3 Feb 2011 08:50:48 +0000 (10:50 +0200)]
Use autotools

Use autoconf and automake for building.
Quick instructions are added in INSTALL.
Application source files are moved to src subdirectory.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd v4l2_subdev_get_frame_interval()
Todor Tomov [Tue, 25 Jan 2011 15:46:48 +0000 (17:46 +0200)]
Add v4l2_subdev_get_frame_interval()

Add function to get frame interval.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd doxygen comments
Todor Tomov [Tue, 25 Jan 2011 15:46:47 +0000 (17:46 +0200)]
Add doxygen comments

Add doxygen format comments to header files.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoShorten media structures names
Todor Tomov [Tue, 25 Jan 2011 15:46:46 +0000 (17:46 +0200)]
Shorten media structures names

Shorten structures names:
struct media_entity_link => struct media_link
struct media_entity_pad => struct media_pad

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd padding to media structures
Todor Tomov [Tue, 25 Jan 2011 15:46:45 +0000 (17:46 +0200)]
Add padding to media structures

Add padding to
struct media_entity_link
struct media_entity_pad
struct media_entity
struct media_device

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd v4l2_subdev_open() and v4l2_subdev_close() to subdev.h
Todor Tomov [Tue, 25 Jan 2011 15:46:44 +0000 (17:46 +0200)]
Add v4l2_subdev_open() and v4l2_subdev_close() to subdev.h

Add v4l2_subdev_close() function and declare both in subdev.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd inbound links support
Todor Tomov [Tue, 25 Jan 2011 15:46:43 +0000 (17:46 +0200)]
Add inbound links support

Store all inbound and outbound links in media_entity.links.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoModify media_entity_remote_pad() to return source pad only
Todor Tomov [Tue, 25 Jan 2011 15:46:42 +0000 (17:46 +0200)]
Modify media_entity_remote_pad() to return source pad only

Rename media_entity_remote_pad() to media_entity_remote_source().
When it is called on a sink pad, return the linked source pad.
When it is called on a source pad, return NULL.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoMove printing functions to main.c
Todor Tomov [Tue, 25 Jan 2011 15:46:41 +0000 (17:46 +0200)]
Move printing functions to main.c

Move printing and helper functions to media-ctl application source.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoAdd media_entity_type() to media.h and make it inline.
Todor Tomov [Tue, 25 Jan 2011 15:46:40 +0000 (17:46 +0200)]
Add media_entity_type() to media.h and make it inline.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoFix printf typos
Michael Jones [Thu, 20 Jan 2011 15:59:01 +0000 (16:59 +0100)]
Fix printf typos

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agomedia-ctl: subdev: add Y8 format.
Martin Hostettler [Thu, 20 Jan 2011 23:00:29 +0000 (00:00 +0100)]
media-ctl: subdev: add Y8 format.

12 years agomain.c: allow spaces in format definition
Todor Tomov [Wed, 19 Jan 2011 15:03:37 +0000 (17:03 +0200)]
main.c: allow spaces in format definition

Allow spaces after '[' in format definition.
Example:
media-ctl -f '"OMAP3 ISP resizer":1[ UYVY 864x480]'

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agomedia.c: fix NULL pointer dereference in media_enum_links()
Todor Tomov [Tue, 4 Jan 2011 09:49:56 +0000 (11:49 +0200)]
media.c: fix NULL pointer dereference in media_enum_links()

Do not dereference source and sink in media_enum_links() if one
of them is NULL.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agomedia.c: fix array overrun in media_entity_subtype_to_string()
Todor Tomov [Tue, 4 Jan 2011 09:49:55 +0000 (11:49 +0200)]
media.c: fix array overrun in media_entity_subtype_to_string()

Fix overrun of static arrays node_types and subdev_types in
media_entity_subtype_to_string().

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUse installed kernel headers instead of in-tree headers
Laurent Pinchart [Tue, 21 Dec 2010 11:47:38 +0000 (12:47 +0100)]
Use installed kernel headers instead of in-tree headers

To install kernel headers to usr/include inside a kernel tree, just run
make headers_install. media-ctl can then be compiled by setting KDIR to
the patch to the kernel tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoUpdate to the latest media kernel API
Laurent Pinchart [Thu, 21 Oct 2010 14:37:07 +0000 (16:37 +0200)]
Update to the latest media kernel API

The media kernel API has seen many changes during the review process,
update the media-ctl application accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoPrint subdev device node names in dot diagrams
Laurent Pinchart [Wed, 20 Oct 2010 16:12:19 +0000 (18:12 +0200)]
Print subdev device node names in dot diagrams

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agomain.c: Fix crop rectangle printing format
Todor Tomov [Tue, 28 Sep 2010 11:59:50 +0000 (14:59 +0300)]
main.c: Fix crop rectangle printing format

Fix crop rectangle printing format after L,T/WxH to (L,T)/WxH change.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoUse sysfs to locate devices nodes
Laurent Pinchart [Fri, 20 Aug 2010 08:57:19 +0000 (10:57 +0200)]
Use sysfs to locate devices nodes

Changes made during the v4l2_subdev API review renamed the /dev/subdev*
device nodes to /dev/v4l-subdev*. Instead of hardcoding the names in the
media-ctl application, use sysfs to retrieve the kernel device name and
assume the device node name is identical.

This isn't a perfect solution, we should really use libudev, but it will
do for now.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoMake format setting optional for -f option
Todor Tomov [Thu, 12 Aug 2010 10:55:34 +0000 (13:55 +0300)]
Make format setting optional for -f option

This allows to setup crop rectangle or frame interval alone - without format.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoChange crop rectangle format from L,T/WxH to (L,T)/WxH
Todor Tomov [Thu, 12 Aug 2010 10:55:33 +0000 (13:55 +0300)]
Change crop rectangle format from L,T/WxH to (L,T)/WxH

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoAdd a --get-format option
Laurent Pinchart [Wed, 11 Aug 2010 07:28:09 +0000 (09:28 +0200)]
Add a --get-format option

The option takes a pad name as argument and returns the active format
(and optional crop settings if available) for that pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoConfigure cropping on output pads before setting the format
Laurent Pinchart [Sun, 1 Aug 2010 19:09:55 +0000 (21:09 +0200)]
Configure cropping on output pads before setting the format

Image size on output pads depend on the cropping parameters. Cropping
must be configured before setting the image size on those pads.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoBe able to add more CFLAGS
Sergio Aguirre [Wed, 14 Jul 2010 16:17:26 +0000 (11:17 -0500)]
Be able to add more CFLAGS

This allows the gcc compilation to build with extra parameters.

For example, if we want to build with -static, we just do:

make CFLAGS=-static

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
12 years agoCreate initial .gitignore file
Sergio Aguirre [Wed, 14 Jul 2010 16:17:24 +0000 (11:17 -0500)]
Create initial .gitignore file

Ignore build generated files as well as the "standard" patches subfolder
used by quilt.

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
12 years agoPrint video device node names in dot diagrams
Laurent Pinchart [Fri, 2 Jul 2010 16:16:05 +0000 (18:16 +0200)]
Print video device node names in dot diagrams

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agomain.c: fix spaces check in parse_pad()
Todor Tomov [Thu, 24 Jun 2010 08:02:27 +0000 (11:02 +0300)]
main.c: fix spaces check in parse_pad()

Check for spaces before colon also when entity is numeric.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
12 years agoPrint crop rectangle when printing the topology
Laurent Pinchart [Thu, 1 Jul 2010 08:46:46 +0000 (10:46 +0200)]
Print crop rectangle when printing the topology

For subdev pads that support cropping, print the active crop rectangle
in media_print_topology_text().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoV4L2 subdev frame interval support
Todor Tomov [Wed, 30 Jun 2010 07:55:43 +0000 (10:55 +0300)]
V4L2 subdev frame interval support

Extend the V4L2 media bus format syntax to support an optional frame interval
value. If specified, the frame interval is set on the subdev.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoV4L2 subdev crop support
Laurent Pinchart [Tue, 29 Jun 2010 10:09:35 +0000 (12:09 +0200)]
V4L2 subdev crop support

Extend the V4L2 media bus format syntax to support an optional crop
rectangle. If specified, the crop rectangle is set on the subdev pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agoEnumerate entities using MEDIA_ENTITY_ID_FLAG_NEXT
Laurent Pinchart [Mon, 14 Jun 2010 20:57:45 +0000 (22:57 +0200)]
Enumerate entities using MEDIA_ENTITY_ID_FLAG_NEXT

Entity IDs don't have to be contiguous. Use the new flag-based
enumeration system instead of looping over consecutive IDs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12 years agostrerror takes a non-negative integer
Laurent Pinchart [Tue, 8 Jun 2010 12:27:50 +0000 (14:27 +0200)]
strerror takes a non-negative integer

Negative error codes were passed untouched to strerror which then
reported an unknown error. Use the positive error code instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoDon't exit with an error when called with -h
Laurent Pinchart [Thu, 3 Jun 2010 12:00:24 +0000 (14:00 +0200)]
Don't exit with an error when called with -h

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoPrint active formats when printing device topology
Laurent Pinchart [Wed, 2 Jun 2010 14:39:13 +0000 (16:39 +0200)]
Print active formats when printing device topology

When run with the -p argument, print the active format on all subdev
pads.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoAdd --print-dot option to print topology as a dot graph
Laurent Pinchart [Fri, 21 May 2010 14:38:55 +0000 (16:38 +0200)]
Add --print-dot option to print topology as a dot graph

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoDon't set formats on remote pads if the remote entity is not a subdev
Laurent Pinchart [Thu, 20 May 2010 22:45:48 +0000 (00:45 +0200)]
Don't set formats on remote pads if the remote entity is not a subdev

When setting format on an output pad, the same format is automatically
set on the remote pads, if any. As the format setting API is
subdev-specific, skip remote pads that belong to a non-subdev entity.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoZero structures before filling them
Laurent Pinchart [Wed, 19 May 2010 21:31:39 +0000 (23:31 +0200)]
Zero structures before filling them

The parse_format function fills a v4l2_mbus_framefmt structure but
doesn't zero it beforehand. This results in some fields being
uninitialized. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 years agoReturn -errno in functions returning a negative error code
Laurent Pinchart [Wed, 19 May 2010 21:11:34 +0000 (23:11 +0200)]
Return -errno in functions returning a negative error code

errno is a positive value, fix functions that return errno when they are
expected to return a negative error code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>