[libcamera-devel] [PATCH 01/10] libcamera: v4l2_controls: Remove V4L2ControlInfo::size()
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Oct 15 02:07:43 CEST 2019
Hi Laurent,
Thanks for your work.
On 2019-10-14 02:27:47 +0300, Laurent Pinchart wrote:
> We don't support V4L2 compound controls, the size field is thus unused.
> Remove it to ease merging of the libcamera and V4L2 control info
> classes. Support for array controls can then be added later on top, and
> would be useful for libcamera controls too.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/libcamera/include/v4l2_controls.h | 4 ----
> src/libcamera/v4l2_controls.cpp | 8 --------
> src/libcamera/v4l2_device.cpp | 14 ++++++++++++--
> 3 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h
> index 89cc74485e6f..133f5262febf 100644
> --- a/src/libcamera/include/v4l2_controls.h
> +++ b/src/libcamera/include/v4l2_controls.h
> @@ -31,14 +31,10 @@ public:
> V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);
>
> const ControlId &id() const { return id_; }
> - size_t size() const { return size_; }
> -
> const ControlRange &range() const { return range_; }
>
> private:
> V4L2ControlId id_;
> - size_t size_;
> -
> ControlRange range_;
> };
>
> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
> index c45d3fda2e1f..dcf31b7a8f26 100644
> --- a/src/libcamera/v4l2_controls.cpp
> +++ b/src/libcamera/v4l2_controls.cpp
> @@ -127,8 +127,6 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)
> V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
> : id_(ctrl)
> {
> - size_ = ctrl.elem_size * ctrl.elems;
> -
> if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)
> range_ = ControlRange(static_cast<int64_t>(ctrl.minimum),
> static_cast<int64_t>(ctrl.maximum));
> @@ -143,12 +141,6 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
> * \return The V4L2 control ID
> */
>
> -/**
> - * \fn V4L2ControlInfo::size()
> - * \brief Retrieve the control value data size (in bytes)
> - * \return The V4L2 control value data size
> - */
> -
> /**
> * \fn V4L2ControlInfo::range()
> * \brief Retrieve the control value range
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index b47ba448f354..54cc214ecce9 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -8,11 +8,13 @@
> #include "v4l2_device.h"
>
> #include <fcntl.h>
> +#include <iomanip>
> #include <string.h>
> #include <sys/ioctl.h>
> #include <unistd.h>
>
> #include "log.h"
> +#include "utils.h"
> #include "v4l2_controls.h"
>
> /**
> @@ -360,6 +362,13 @@ void V4L2Device::listControls()
> ctrl.flags & V4L2_CTRL_FLAG_DISABLED)
> continue;
>
> + if (ctrl.elems != 1 || ctrl.nr_of_dims) {
> + LOG(V4L2, Debug)
> + << "Array control " << utils::hex(ctrl.id)
> + << " not supported";
> + continue;
> + }
> +
> switch (ctrl.type) {
> case V4L2_CTRL_TYPE_INTEGER:
> case V4L2_CTRL_TYPE_BOOLEAN:
> @@ -371,8 +380,9 @@ void V4L2Device::listControls()
> break;
> /* \todo Support compound controls. */
> default:
> - LOG(V4L2, Debug) << "Control type '" << ctrl.type
> - << "' not supported";
> + LOG(V4L2, Debug)
> + << "Control " << utils::hex(ctrl.id)
> + << " has unsupported type " << ctrl.type;
> continue;
This looks like something for a separate patch ;-)
With or without this fixed,
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list