summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2014-05-30Fix uninitialized pointer dereference in media_device_add_entityLaurent Pinchart
When the entity being added has the default flag set, the function tries to set the entity as the default entity for its type by storing the entity pointer in the appropriate default entity field. If the entity type isn't recognized, the default entity pointer is left uninitialized, leading to a crash. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2014-05-30Return NULL for default entity types in media_get_default_entityLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2014-05-30Remove unused variablesLaurent Pinchart
The ret variable is declared but unused in two functions. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2014-05-30Add ARGB32 and AYUV32 media bus codes supportLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2014-03-10Add support for emulated devicesLaurent Pinchart
Emulated media devices are backed by real hardware devices for the functions they provide, but have no kernel media device counterpart. 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>
2014-03-10Expose default devicesLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
2014-03-10Make the media_entity structure privateLaurent Pinchart
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>
2014-03-10Make the media_device structure privateLaurent Pinchart
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>
2014-03-10Split media_device creation and openingLaurent Pinchart
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>
2014-03-10Read errno before media_dbg callsLaurent Pinchart
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>
2013-09-26Print v4l parser position on errorLaurent Pinchart
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>
2013-09-26Print more detailed v4l parse error messagesLaurent Pinchart
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>
2013-08-22Support both " and ' as string delimiters when parsing the command lineLaurent Pinchart
Entity names are enclosed in quotes. Support both double-quoted and single-quoted strings. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2013-08-21options: don't imply -v when doing a -p.André Draszik
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>
2013-06-10Print parser position on errorSascha Hauer
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>
2013-06-10Print more detailed parse error messagesSascha Hauer
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>
2013-03-25Fix linking of shared librariesAndreas Bombe
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>
2013-03-25Add missing stdlib.h and ctype.h includesAndreas Bombe
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>
2013-03-25Sort headers alphabeticallyLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2013-03-25Print media entity flags when printing device topologyLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-11-15media: Fix valgrind warningsLaurent Pinchart
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>
2012-07-18Add a copy of V4L2 kernel headersLaurent Pinchart
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>
2012-07-18Replace V4L2 subdev selection targets with the V4L2 onesSakari Ailus
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>
2012-07-18Drop _ACTUAL from selection target namesSakari Ailus
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-05-28media-ctl: Compose print fixesSakari Ailus
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>
2012-05-25Compose rectangle support for libv4l2subdevSakari Ailus
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-05-25New, more flexible syntax for formatSakari Ailus
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>
2012-05-25options: Remove unnecessary commas from EBNF syntaxLaurent Pinchart
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-05-05libmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id()Sakari Ailus
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> [laurent.pinchart@ideasonboard Clarify documentation] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2012-05-05Support selections API for cropSakari Ailus
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>
2012-04-29Compare name length to avoid false positives in media_get_entity_by_nameSergio Aguirre
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>
2012-04-09Add support for YUV420 formatsSergio Aguirre
Signed-off-by: Sergio Aguirre <saaguirre@ti.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2011-10-22Several printout fixes.Sakari Ailus
- 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>
2011-10-14Print media device information when called with -p/--printLaurent Pinchart
In addition to printing pipeline information, print the media device information. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2011-10-10Switch to the LGPLv2.1+ licenseLaurent Pinchart
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>
2011-10-08Additional formats used by BT-656 sensorsGary Thomas
Signed-off-by: Gary Thomas <gary@mlbassoc.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2011-10-08Remove extra verbositySakari Ailus
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>
2011-10-08Add debugging handlerSakari Ailus
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>
2011-10-08Add link to media_device from the media_entitySakari Ailus
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>
2011-10-08libv4l2subdev and libmediactl are not test programsSakari Ailus
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>
2011-10-08Move V4L2 subdev format parsing from main.c to subdev.cSakari Ailus
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>
2011-10-08Move link parsing from main.c to media.c, making it part of libmediactlSakari Ailus
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>
2011-10-08Rename files to match the names of the librariesSakari Ailus
Rename media.* to mediactl.* and subdev.* v4l2subdev.*. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2011-09-06libmediactl: get rid of memset via using callocAndy Shevchenko
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>
2011-09-06libmediactl: get the device name via udevAndy Shevchenko
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>
2011-09-06libmediactl: split media_get_devname_sysfs from media_enum_entitiesAndy Shevchenko
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2011-09-06libmediactl: restruct error pathAndy Shevchenko
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>
2011-06-21Add Y10, Y12 formatsMichael Jones
Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
2011-05-11Add missing 8-, 10- and 12-bit Bayer formatsLaurent Pinchart
Thanks for Javier Martin for pointing out they were missing. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2011-04-12Reset file descriptor value after closing a subdevTodor Tomov
After a subdev is closed set entity->fd to -1. Signed-off-by: Todor Tomov <ttomov@mm-sol.com>