summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_subdevice.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-02-19 12:12:27 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-03-01 12:31:45 +0100
commitc6daee909c562ed104aff690f6a8b7a2e6ae090b (patch)
tree6039781989a6320205dfd3fed1778da16b3d38a0 /src/libcamera/v4l2_subdevice.cpp
parent77100a7578d8a0ccc56e6ab11a8dbe3c74665c4d (diff)
libcamera: v4l2_subdevice: Store media entity
Store the media entity backing the V4L2Subdevice and add a deviceName() method to retrieve the human readable name of the subdevice, which is created using the name of the associated media entity. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/v4l2_subdevice.cpp')
-rw-r--r--src/libcamera/v4l2_subdevice.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index d47001d4..143f281a 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -88,7 +88,7 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)
* path
*/
V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)
- : deviceNode_(entity->deviceNode()), fd_(-1)
+ : entity_(entity), fd_(-1)
{
}
@@ -106,11 +106,11 @@ int V4L2Subdevice::open()
return -EBUSY;
}
- ret = ::open(deviceNode_.c_str(), O_RDWR);
+ ret = ::open(deviceNode().c_str(), O_RDWR);
if (ret < 0) {
ret = -errno;
LOG(V4L2Subdev, Error)
- << "Failed to open V4L2 subdevice '" << deviceNode_
+ << "Failed to open V4L2 subdevice '" << deviceNode()
<< "': " << strerror(-ret);
return ret;
}
@@ -148,6 +148,13 @@ void V4L2Subdevice::close()
*/
/**
+ * \fn V4L2Subdevice::deviceName()
+ * \brief Retrieve the name of the media entity associated with the subdevice
+ *
+ * \return The name of the media entity the subdevice is associated to
+ */
+
+/**
* \brief Set a crop rectangle on one of the V4L2 subdevice pads
* \param[in] pad The 0-indexed pad number the rectangle is to be applied to
* \param[inout] rect The rectangle describing crop target area
@@ -189,7 +196,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)
ret = -errno;
LOG(V4L2Subdev, Error)
<< "Unable to get format on pad " << pad
- << " of " << deviceNode_ << ": " << strerror(-ret);
+ << " of " << deviceNode() << ": " << strerror(-ret);
return ret;
}
@@ -255,7 +262,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
ret = -errno;
LOG(V4L2Subdev, Error)
<< "Unable to set rectangle " << target << " on pad "
- << pad << " of " << deviceNode_ << ": "
+ << pad << " of " << deviceNode() << ": "
<< strerror(-ret);
return ret;
}