[{"id":4124,"web_url":"https://patchwork.libcamera.org/comment/4124/","msgid":"<20200320115109.j5fhrmabj2tvltwc@uno.localdomain>","date":"2020-03-20T11:51:09","subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: controls: Rename\n\tControlRange to ControlInfo","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Mar 09, 2020 at 05:24:05PM +0100, Jacopo Mondi wrote:\n> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> To prepare for storage of additional information in the ControlRange\n> structure, rename it to ControlInfo.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n> ---\n>  include/ipa/ipa_controls.h                    |  2 +-\n>  include/libcamera/controls.h                  | 16 ++++----\n>  src/libcamera/control_serializer.cpp          | 33 ++++++++-------\n>  src/libcamera/controls.cpp                    | 40 +++++++++----------\n>  src/libcamera/include/control_serializer.h    |  6 +--\n>  src/libcamera/include/v4l2_controls.h         |  4 +-\n>  src/libcamera/ipa_controls.cpp                | 38 +++++++++---------\n>  src/libcamera/pipeline/uvcvideo.cpp           |  4 +-\n>  src/libcamera/pipeline/vimc.cpp               |  4 +-\n>  src/libcamera/v4l2_controls.cpp               | 30 +++++++-------\n>  src/libcamera/v4l2_device.cpp                 |  2 +-\n>  .../{control_range.cpp => control_info.cpp}   | 10 ++---\n>  test/controls/meson.build                     |  2 +-\n>  test/serialization/serialization_test.cpp     |  4 +-\n>  test/v4l2_videodevice/controls.cpp            |  6 +--\n>  15 files changed, 100 insertions(+), 101 deletions(-)\n>  rename test/controls/{control_range.cpp => control_info.cpp} (83%)\n>\n> diff --git a/include/ipa/ipa_controls.h b/include/ipa/ipa_controls.h\n> index 37f97d6ad2a4..6d3bf279c22d 100644\n> --- a/include/ipa/ipa_controls.h\n> +++ b/include/ipa/ipa_controls.h\n> @@ -33,7 +33,7 @@ struct ipa_control_value_entry {\n>  \tuint32_t padding[1];\n>  };\n>\n> -struct ipa_control_range_entry {\n> +struct ipa_control_info_entry {\n>  \tuint32_t id;\n>  \tuint32_t type;\n>  \tuint32_t offset;\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 3d2250f43f3c..9c6cbffb88b5 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -229,12 +229,12 @@ private:\n>  \tControl &operator=(const Control &) = delete;\n>  };\n>\n> -class ControlRange\n> +class ControlInfo\n>  {\n>  public:\n> -\texplicit ControlRange(const ControlValue &min = 0,\n> -\t\t\t      const ControlValue &max = 0,\n> -\t\t\t      const ControlValue &def = 0);\n> +\texplicit ControlInfo(const ControlValue &min = 0,\n> +\t\t\t     const ControlValue &max = 0,\n> +\t\t\t     const ControlValue &def = 0);\n>\n>  \tconst ControlValue &min() const { return min_; }\n>  \tconst ControlValue &max() const { return max_; }\n> @@ -242,12 +242,12 @@ public:\n>\n>  \tstd::string toString() const;\n>\n> -\tbool operator==(const ControlRange &other) const\n> +\tbool operator==(const ControlInfo &other) const\n>  \t{\n>  \t\treturn min_ == other.min_ && max_ == other.max_;\n>  \t}\n>\n> -\tbool operator!=(const ControlRange &other) const\n> +\tbool operator!=(const ControlInfo &other) const\n>  \t{\n>  \t\treturn !(*this == other);\n>  \t}\n> @@ -260,10 +260,10 @@ private:\n>\n>  using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;\n>\n> -class ControlInfoMap : private std::unordered_map<const ControlId *, ControlRange>\n> +class ControlInfoMap : private std::unordered_map<const ControlId *, ControlInfo>\n>  {\n>  public:\n> -\tusing Map = std::unordered_map<const ControlId *, ControlRange>;\n> +\tusing Map = std::unordered_map<const ControlId *, ControlInfo>;\n>\n>  \tControlInfoMap() = default;\n>  \tControlInfoMap(const ControlInfoMap &other) = default;\n> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp\n> index dcc63d20c06c..eef875f4d96c 100644\n> --- a/src/libcamera/control_serializer.cpp\n> +++ b/src/libcamera/control_serializer.cpp\n> @@ -99,9 +99,9 @@ size_t ControlSerializer::binarySize(const ControlValue &value)\n>  \treturn value.data().size_bytes();\n>  }\n>\n> -size_t ControlSerializer::binarySize(const ControlRange &range)\n> +size_t ControlSerializer::binarySize(const ControlInfo &info)\n>  {\n> -\treturn binarySize(range.min()) + binarySize(range.max());\n> +\treturn binarySize(info.min()) + binarySize(info.max());\n>  }\n>\n>  /**\n> @@ -116,7 +116,7 @@ size_t ControlSerializer::binarySize(const ControlRange &range)\n>  size_t ControlSerializer::binarySize(const ControlInfoMap &infoMap)\n>  {\n>  \tsize_t size = sizeof(struct ipa_controls_header)\n> -\t\t    + infoMap.size() * sizeof(struct ipa_control_range_entry);\n> +\t\t    + infoMap.size() * sizeof(struct ipa_control_info_entry);\n>\n>  \tfor (const auto &ctrl : infoMap)\n>  \t\tsize += binarySize(ctrl.second);\n> @@ -150,11 +150,10 @@ void ControlSerializer::store(const ControlValue &value,\n>  \tbuffer.write(value.data());\n>  }\n>\n> -void ControlSerializer::store(const ControlRange &range,\n> -\t\t\t      ByteStreamBuffer &buffer)\n> +void ControlSerializer::store(const ControlInfo &info, ByteStreamBuffer &buffer)\n>  {\n> -\tstore(range.min(), buffer);\n> -\tstore(range.max(), buffer);\n> +\tstore(info.min(), buffer);\n> +\tstore(info.max(), buffer);\n>  }\n>\n>  /**\n> @@ -176,7 +175,7 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,\n>  {\n>  \t/* Compute entries and data required sizes. */\n>  \tsize_t entriesSize = infoMap.size()\n> -\t\t\t   * sizeof(struct ipa_control_range_entry);\n> +\t\t\t   * sizeof(struct ipa_control_info_entry);\n>  \tsize_t valuesSize = 0;\n>  \tfor (const auto &ctrl : infoMap)\n>  \t\tvaluesSize += binarySize(ctrl.second);\n> @@ -200,15 +199,15 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,\n>\n>  \tfor (const auto &ctrl : infoMap) {\n>  \t\tconst ControlId *id = ctrl.first;\n> -\t\tconst ControlRange &range = ctrl.second;\n> +\t\tconst ControlInfo &info = ctrl.second;\n>\n> -\t\tstruct ipa_control_range_entry entry;\n> +\t\tstruct ipa_control_info_entry entry;\n>  \t\tentry.id = id->id();\n>  \t\tentry.type = id->type();\n>  \t\tentry.offset = values.offset();\n>  \t\tentries.write(&entry);\n>\n> -\t\tstore(range, values);\n> +\t\tstore(info, values);\n>  \t}\n>\n>  \tif (buffer.overflow())\n> @@ -343,13 +342,13 @@ ControlValue ControlSerializer::loadControlValue(ControlType type,\n>  \treturn ControlValue();\n>  }\n>\n> -ControlRange ControlSerializer::loadControlRange(ControlType type,\n> -\t\t\t\t\t\t ByteStreamBuffer &b)\n> +ControlInfo ControlSerializer::loadControlInfo(ControlType type,\n> +\t\t\t\t\t       ByteStreamBuffer &b)\n>  {\n>  \tControlValue min = loadControlValue(type, b);\n>  \tControlValue max = loadControlValue(type, b);\n>\n> -\treturn ControlRange(min, max);\n> +\treturn ControlInfo(min, max);\n>  }\n>\n>  /**\n> @@ -397,7 +396,7 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &\n>  \tControlInfoMap::Map ctrls;\n>\n>  \tfor (unsigned int i = 0; i < hdr->entries; ++i) {\n> -\t\tconst struct ipa_control_range_entry *entry =\n> +\t\tconst struct ipa_control_info_entry *entry =\n>  \t\t\tentries.read<decltype(*entry)>();\n>  \t\tif (!entry) {\n>  \t\t\tLOG(Serializer, Error) << \"Out of data\";\n> @@ -419,9 +418,9 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &\n>  \t\t\treturn {};\n>  \t\t}\n>\n> -\t\t/* Create and store the ControlRange. */\n> +\t\t/* Create and store the ControlInfo. */\n>  \t\tctrls.emplace(controlIds_.back().get(),\n> -\t\t\t      loadControlRange(type, values));\n> +\t\t\t      loadControlInfo(type, values));\n>  \t}\n>\n>  \t/*\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 833a436c64df..53649fe897db 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -414,50 +414,50 @@ void ControlValue::set(ControlType type, bool isArray, const void *data,\n>   */\n>\n>  /**\n> - * \\class ControlRange\n> + * \\class ControlInfo\n>   * \\brief Describe the limits of valid values for a Control\n>   *\n> - * The ControlRange expresses the constraints on valid values for a control.\n> + * The ControlInfo expresses the constraints on valid values for a control.\n>   * The constraints depend on the object the control applies to, and are\n>   * constant for the lifetime of that object. They are typically constructed by\n>   * pipeline handlers to describe the controls they support.\n>   */\n>\n>  /**\n> - * \\brief Construct a ControlRange with minimum and maximum range parameters\n> + * \\brief Construct a ControlInfo with minimum and maximum range parameters\n>   * \\param[in] min The control minimum value\n>   * \\param[in] max The control maximum value\n>   * \\param[in] def The control default value\n>   */\n> -ControlRange::ControlRange(const ControlValue &min,\n> -\t\t\t   const ControlValue &max,\n> -\t\t\t   const ControlValue &def)\n> +ControlInfo::ControlInfo(const ControlValue &min,\n> +\t\t\t const ControlValue &max,\n> +\t\t\t const ControlValue &def)\n>  \t: min_(min), max_(max), def_(def)\n>  {\n>  }\n>\n>  /**\n> - * \\fn ControlRange::min()\n> + * \\fn ControlInfo::min()\n>   * \\brief Retrieve the minimum value of the control\n>   * \\return A ControlValue with the minimum value for the control\n>   */\n>\n>  /**\n> - * \\fn ControlRange::max()\n> + * \\fn ControlInfo::max()\n>   * \\brief Retrieve the maximum value of the control\n>   * \\return A ControlValue with the maximum value for the control\n>   */\n>\n>  /**\n> - * \\fn ControlRange::def()\n> + * \\fn ControlInfo::def()\n>   * \\brief Retrieve the default value of the control\n>   * \\return A ControlValue with the default value for the control\n>   */\n>\n>  /**\n> - * \\brief Provide a string representation of the ControlRange\n> + * \\brief Provide a string representation of the ControlInfo\n>   */\n> -std::string ControlRange::toString() const\n> +std::string ControlInfo::toString() const\n>  {\n>  \tstd::stringstream ss;\n>\n> @@ -467,15 +467,15 @@ std::string ControlRange::toString() const\n>  }\n>\n>  /**\n> - * \\fn bool ControlRange::operator==()\n> - * \\brief Compare ControlRange instances for equality\n> - * \\return True if the ranges have identical min and max, false otherwise\n> + * \\fn bool ControlInfo::operator==()\n> + * \\brief Compare ControlInfo instances for equality\n> + * \\return True if the constraints have identical min and max, false otherwise\n>   */\n>\n>  /**\n> - * \\fn bool ControlRange::operator!=()\n> - * \\brief Compare ControlRange instances for non equality\n> - * \\return False if the ranges have identical min and max, true otherwise\n> + * \\fn bool ControlInfo::operator!=()\n> + * \\brief Compare ControlInfo instances for non equality\n> + * \\return True if the constraints have different min and max, false otherwise\n>   */\n>\n>  /**\n> @@ -489,10 +489,10 @@ std::string ControlRange::toString() const\n>\n>  /**\n>   * \\class ControlInfoMap\n> - * \\brief A map of ControlId to ControlRange\n> + * \\brief A map of ControlId to ControlInfo\n>   *\n>   * The ControlInfoMap class describes controls supported by an object as an\n> - * unsorted map of ControlId pointers to ControlRange instances. Unlike the\n> + * unsorted map of ControlId pointers to ControlInfo instances. Unlike the\n>   * standard std::unsorted_map<> class, it is designed the be immutable once\n>   * constructed, and thus only exposes the read accessors of the\n>   * std::unsorted_map<> base class.\n> @@ -656,7 +656,7 @@ void ControlInfoMap::generateIdmap()\n>  \t\tif (ctrl.first->type() != ctrl.second.min().type()) {\n>  \t\t\tLOG(Controls, Error)\n>  \t\t\t\t<< \"Control \" << utils::hex(ctrl.first->id())\n> -\t\t\t\t<< \" type and range type mismatch\";\n> +\t\t\t\t<< \" type and info type mismatch\";\n>  \t\t\tidmap_.clear();\n>  \t\t\tclear();\n>  \t\t\treturn;\n> diff --git a/src/libcamera/include/control_serializer.h b/src/libcamera/include/control_serializer.h\n> index 026e62340328..70aa28fd5f58 100644\n> --- a/src/libcamera/include/control_serializer.h\n> +++ b/src/libcamera/include/control_serializer.h\n> @@ -35,17 +35,17 @@ public:\n>\n>  private:\n>  \tstatic size_t binarySize(const ControlValue &value);\n> -\tstatic size_t binarySize(const ControlRange &range);\n> +\tstatic size_t binarySize(const ControlInfo &info);\n>\n>  \tstatic void store(const ControlValue &value, ByteStreamBuffer &buffer);\n> -\tstatic void store(const ControlRange &range, ByteStreamBuffer &buffer);\n> +\tstatic void store(const ControlInfo &info, ByteStreamBuffer &buffer);\n>\n>  \ttemplate<typename T>\n>  \tControlValue loadControlValue(ByteStreamBuffer &buffer, bool isArray,\n>  \t\t\t\t      unsigned int count);\n>  \tControlValue loadControlValue(ControlType type, ByteStreamBuffer &buffer,\n>  \t\t\t\t      bool isArray = false, unsigned int count = 1);\n> -\tControlRange loadControlRange(ControlType type, ByteStreamBuffer &buffer);\n> +\tControlInfo loadControlInfo(ControlType type, ByteStreamBuffer &buffer);\n>\n>  \tunsigned int serial_;\n>  \tstd::vector<std::unique_ptr<ControlId>> controlIds_;\n> diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\n> index 882546a89340..cffe9efd9919 100644\n> --- a/src/libcamera/include/v4l2_controls.h\n> +++ b/src/libcamera/include/v4l2_controls.h\n> @@ -20,10 +20,10 @@ public:\n>  \tV4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl);\n>  };\n>\n> -class V4L2ControlRange : public ControlRange\n> +class V4L2ControlInfo : public ControlInfo\n>  {\n>  public:\n> -\tV4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);\n> +\tV4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);\n>  };\n>\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp\n> index da4724b178e2..b1d14190e3fe 100644\n> --- a/src/libcamera/ipa_controls.cpp\n> +++ b/src/libcamera/ipa_controls.cpp\n> @@ -18,7 +18,7 @@\n>   * transfer them through the IPA C interface and IPA IPC transports.\n>   *\n>   * A control packet contains a list of entries, each of them describing a single\n> - * control range or control value. The packet starts with a fixed-size header\n> + * control info or control value. The packet starts with a fixed-size header\n>   * described by the ipa_controls_header structure, followed by an array of\n>   * fixed-size entries. Each entry is associated with data, stored either\n>   * directly in the entry, or in a data section after the entries array.\n> @@ -79,19 +79,19 @@\n>   *         | |                         |    |                      |\n>   *         \\ |                         |    |                      |\n>   *           +-------------------------+    |                      |\n> - *         / | ipa_control_range_entry |    | hdr.data_offset      |\n> + *         / | ipa_control_info_entry  |    | hdr.data_offset      |\n>   *         | | #0                      |    |                      |\n>   * Control | +-------------------------+    |                      |\n> - *   range | | ...                     |    |                      |\n> + *    info | | ...                     |    |                      |\n>   * entries | +-------------------------+    |                      |\n> - *         | | ipa_control_range_entry |    |             hdr.size |\n> + *         | | ipa_control_info_entry  |    |             hdr.size |\n>   *         \\ | #hdr.entries - 1        |    |                      |\n>   *           +-------------------------+    |                      |\n>   *           | empty space (optional)  |    |                      |\n>   *           +-------------------------+ <--´  .                   |\n>   *         / | ...                     |       | entry[n].offset   |\n>   *    Data | | ...                     |       |                   |\n> - * section | | range data for entry #n | <-----´                   |\n> + * section | | info data for entry #n  | <-----´                   |\n>   *         \\ | ...                     |                           |\n>   *           +-------------------------+                           |\n>   *           | empty space (optional)  |                           |\n> @@ -100,8 +100,8 @@\n>   *\n>   * The packet header is identical to the ControlList packet header.\n>   *\n> - * Entries are described by the ipa_control_range_entry structure. They contain\n> - * the numerical ID and type of the control. The control range data is stored\n> + * Entries are described by the ipa_control_info_entry structure. They contain\n> + * the numerical ID and type of the control. The control info data is stored\n>   * in the data section as described by the following diagram.\n>   *\n>   * ~~~~\n> @@ -117,10 +117,10 @@\n>   * ~~~~\n>   *\n>   * The minimum and maximum value are stored in the platform's native data\n> - * format. The ipa_control_range_entry::offset field stores the offset from the\n> - * beginning of the data section to the range data.\n> + * format. The ipa_control_info_entry::offset field stores the offset from the\n> + * beginning of the data section to the info data.\n>   *\n> - * Range data in the data section shall be stored in the same order as the\n> + * Info data in the data section shall be stored in the same order as the\n>   * entries array, shall be aligned to a multiple of 8 bytes, and shall be\n>   * contiguous in memory.\n>   *\n> @@ -178,18 +178,18 @@ static_assert(sizeof(ipa_control_value_entry) == 16,\n>  \t      \"Invalid ABI size change for struct ipa_control_value_entry\");\n>\n>  /**\n> - * \\struct ipa_control_range_entry\n> - * \\brief Description of a serialized ControlRange entry\n> - * \\var ipa_control_range_entry::id\n> + * \\struct ipa_control_info_entry\n> + * \\brief Description of a serialized ControlInfo entry\n> + * \\var ipa_control_info_entry::id\n>   * The numerical ID of the control\n> - * \\var ipa_control_range_entry::type\n> + * \\var ipa_control_info_entry::type\n>   * The type of the control (defined by enum ControlType)\n> - * \\var ipa_control_range_entry::offset\n> + * \\var ipa_control_info_entry::offset\n>   * The offset in bytes from the beginning of the data section to the control\n> - * range data (shall be a multiple of 8 bytes)\n> - * \\var ipa_control_range_entry::padding\n> + * info data (shall be a multiple of 8 bytes)\n> + * \\var ipa_control_info_entry::padding\n>   * Padding bytes (shall be set to 0)\n>   */\n>\n> -static_assert(sizeof(ipa_control_range_entry) == 16,\n> -\t      \"Invalid ABI size change for struct ipa_control_range_entry\");\n> +static_assert(sizeof(ipa_control_info_entry) == 16,\n> +\t      \"Invalid ABI size change for struct ipa_control_info_entry\");\n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> index 29afb121aa46..24abc986112f 100644\n> --- a/src/libcamera/pipeline/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -342,7 +342,7 @@ int UVCCameraData::init(MediaEntity *entity)\n>  \tControlInfoMap::Map ctrls;\n>\n>  \tfor (const auto &ctrl : controls) {\n> -\t\tconst ControlRange &range = ctrl.second;\n> +\t\tconst ControlInfo &info = ctrl.second;\n>  \t\tconst ControlId *id;\n>\n>  \t\tswitch (ctrl.first->id()) {\n> @@ -365,7 +365,7 @@ int UVCCameraData::init(MediaEntity *entity)\n>  \t\t\tcontinue;\n>  \t\t}\n>\n> -\t\tctrls.emplace(id, range);\n> +\t\tctrls.emplace(id, info);\n>  \t}\n>\n>  \tcontrolInfo_ = std::move(ctrls);\n> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n> index 5d3d12fef30b..529909714bf5 100644\n> --- a/src/libcamera/pipeline/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc.cpp\n> @@ -431,7 +431,7 @@ int VimcCameraData::init(MediaDevice *media)\n>  \tControlInfoMap::Map ctrls;\n>\n>  \tfor (const auto &ctrl : controls) {\n> -\t\tconst ControlRange &range = ctrl.second;\n> +\t\tconst ControlInfo &info = ctrl.second;\n>  \t\tconst ControlId *id;\n>\n>  \t\tswitch (ctrl.first->id()) {\n> @@ -448,7 +448,7 @@ int VimcCameraData::init(MediaDevice *media)\n>  \t\t\tcontinue;\n>  \t\t}\n>\n> -\t\tctrls.emplace(id, range);\n> +\t\tctrls.emplace(id, info);\n>  \t}\n>\n>  \tcontrolInfo_ = std::move(ctrls);\n> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\n> index 7446c3880330..4861f9778df3 100644\n> --- a/src/libcamera/v4l2_controls.cpp\n> +++ b/src/libcamera/v4l2_controls.cpp\n> @@ -104,37 +104,37 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)\n>  }\n>\n>  /**\n> - * \\class V4L2ControlRange\n> - * \\brief Convenience specialisation of ControlRange for V4L2 controls\n> + * \\class V4L2ControlInfo\n> + * \\brief Convenience specialisation of ControlInfo for V4L2 controls\n>   *\n> - * The V4L2ControlRange class is a specialisation of the ControlRange for V4L2\n> + * The V4L2ControlInfo class is a specialisation of the ControlInfo for V4L2\n>   * controls. It offers a convenience constructor from a struct\n> - * v4l2_query_ext_ctrl, and is otherwise equivalent to the ControlRange class.\n> + * v4l2_query_ext_ctrl, and is otherwise equivalent to the ControlInfo class.\n>   */\n>\n>  /**\n> - * \\brief Construct a V4L2ControlRange from a struct v4l2_query_ext_ctrl\n> + * \\brief Construct a V4L2ControlInfo from a struct v4l2_query_ext_ctrl\n>   * \\param[in] ctrl The struct v4l2_query_ext_ctrl as returned by the kernel\n>   */\n> -V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n> +V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n>  {\n>  \tswitch (ctrl.type) {\n>  \tcase V4L2_CTRL_TYPE_BOOLEAN:\n> -\t\tControlRange::operator=(ControlRange(static_cast<bool>(ctrl.minimum),\n> -\t\t\t\t\t\t     static_cast<bool>(ctrl.maximum),\n> -\t\t\t\t\t\t     static_cast<bool>(ctrl.default_value)));\n> +\t\tControlInfo::operator=(ControlInfo(static_cast<bool>(ctrl.minimum),\n> +\t\t\t\t\t\t   static_cast<bool>(ctrl.maximum),\n> +\t\t\t\t\t\t   static_cast<bool>(ctrl.default_value)));\n>  \t\tbreak;\n>\n>  \tcase V4L2_CTRL_TYPE_INTEGER64:\n> -\t\tControlRange::operator=(ControlRange(static_cast<int64_t>(ctrl.minimum),\n> -\t\t\t\t\t\t     static_cast<int64_t>(ctrl.maximum),\n> -\t\t\t\t\t\t     static_cast<int64_t>(ctrl.default_value)));\n> +\t\tControlInfo::operator=(ControlInfo(static_cast<int64_t>(ctrl.minimum),\n> +\t\t\t\t\t\t   static_cast<int64_t>(ctrl.maximum),\n> +\t\t\t\t\t\t   static_cast<int64_t>(ctrl.default_value)));\n>  \t\tbreak;\n>\n>  \tdefault:\n> -\t\tControlRange::operator=(ControlRange(static_cast<int32_t>(ctrl.minimum),\n> -\t\t\t\t\t\t     static_cast<int32_t>(ctrl.maximum),\n> -\t\t\t\t\t\t     static_cast<int32_t>(ctrl.default_value)));\n> +\t\tControlInfo::operator=(ControlInfo(static_cast<int32_t>(ctrl.minimum),\n> +\t\t\t\t\t\t   static_cast<int32_t>(ctrl.maximum),\n> +\t\t\t\t\t\t   static_cast<int32_t>(ctrl.default_value)));\n>  \t\tbreak;\n>  \t}\n>  }\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 1698d2451449..98639bd0f07f 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -381,7 +381,7 @@ void V4L2Device::listControls()\n>  \t\t}\n>\n>  \t\tcontrolIds_.emplace_back(std::make_unique<V4L2ControlId>(ctrl));\n> -\t\tctrls.emplace(controlIds_.back().get(), V4L2ControlRange(ctrl));\n> +\t\tctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl));\n>  \t}\n>\n>  \tcontrols_ = std::move(ctrls);\n> diff --git a/test/controls/control_range.cpp b/test/controls/control_info.cpp\n> similarity index 83%\n> rename from test/controls/control_range.cpp\n> rename to test/controls/control_info.cpp\n> index 06ec3506ee62..1e05e13129ca 100644\n> --- a/test/controls/control_range.cpp\n> +++ b/test/controls/control_info.cpp\n> @@ -2,7 +2,7 @@\n>  /*\n>   * Copyright (C) 2019, Google Inc.\n>   *\n> - * control_range.cpp - ControlRange tests\n> + * control_info.cpp - ControlInfo tests\n>   */\n>\n>  #include <iostream>\n> @@ -15,7 +15,7 @@\n>  using namespace std;\n>  using namespace libcamera;\n>\n> -class ControlRangeTest : public Test\n> +class ControlInfoTest : public Test\n>  {\n>  protected:\n>  \tint run()\n> @@ -24,7 +24,7 @@ protected:\n>  \t\t * Test information retrieval from a range with no minimum and\n>  \t\t * maximum.\n>  \t\t */\n> -\t\tControlRange brightness;\n> +\t\tControlInfo brightness;\n>\n>  \t\tif (brightness.min().get<int32_t>() != 0 ||\n>  \t\t    brightness.max().get<int32_t>() != 0) {\n> @@ -36,7 +36,7 @@ protected:\n>  \t\t * Test information retrieval from a control with a minimum and\n>  \t\t * a maximum value.\n>  \t\t */\n> -\t\tControlRange contrast(10, 200);\n> +\t\tControlInfo contrast(10, 200);\n>\n>  \t\tif (contrast.min().get<int32_t>() != 10 ||\n>  \t\t    contrast.max().get<int32_t>() != 200) {\n> @@ -48,4 +48,4 @@ protected:\n>  \t}\n>  };\n>\n> -TEST_REGISTER(ControlRangeTest)\n> +TEST_REGISTER(ControlInfoTest)\n> diff --git a/test/controls/meson.build b/test/controls/meson.build\n> index 16a7f33fdcc6..7fff2413007e 100644\n> --- a/test/controls/meson.build\n> +++ b/test/controls/meson.build\n> @@ -1,7 +1,7 @@\n>  control_tests = [\n> +    [ 'control_info',               'control_info.cpp' ],\n>      [ 'control_info_map',           'control_info_map.cpp' ],\n>      [ 'control_list',               'control_list.cpp' ],\n> -    [ 'control_range',              'control_range.cpp' ],\n>      [ 'control_value',              'control_value.cpp' ],\n>  ]\n>\n> diff --git a/test/serialization/serialization_test.cpp b/test/serialization/serialization_test.cpp\n> index 68e0512a04ca..11d0f0f30031 100644\n> --- a/test/serialization/serialization_test.cpp\n> +++ b/test/serialization/serialization_test.cpp\n> @@ -22,7 +22,7 @@ using namespace libcamera;\n>\n>  bool SerializationTest::equals(const ControlInfoMap &lhs, const ControlInfoMap &rhs)\n>  {\n> -\tstd::map<unsigned int, ControlRange> rlhs;\n> +\tstd::map<unsigned int, ControlInfo> rlhs;\n>  \tstd::transform(lhs.begin(), lhs.end(), std::inserter(rlhs, rlhs.end()),\n>  \t\t\t[](const ControlInfoMap::value_type &v)\n>  \t\t\t\t-> decltype(rlhs)::value_type\n> @@ -30,7 +30,7 @@ bool SerializationTest::equals(const ControlInfoMap &lhs, const ControlInfoMap &\n>  \t\t\t\treturn { v.first->id(), v.second };\n>  \t\t\t});\n>\n> -\tstd::map<unsigned int, ControlRange> rrhs;\n> +\tstd::map<unsigned int, ControlInfo> rrhs;\n>  \tstd::transform(rhs.begin(), rhs.end(), std::inserter(rrhs, rrhs.end()),\n>  \t\t\t[](const ControlInfoMap::value_type &v)\n>  \t\t\t\t-> decltype(rrhs)::value_type\n> diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\n> index 1b71bf0633b4..478de3707a3c 100644\n> --- a/test/v4l2_videodevice/controls.cpp\n> +++ b/test/v4l2_videodevice/controls.cpp\n> @@ -41,9 +41,9 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>\n> -\t\tconst ControlRange &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;\n> -\t\tconst ControlRange &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;\n> -\t\tconst ControlRange &saturation = infoMap.find(V4L2_CID_SATURATION)->second;\n> +\t\tconst ControlInfo &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;\n> +\t\tconst ControlInfo &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;\n> +\t\tconst ControlInfo &saturation = infoMap.find(V4L2_CID_SATURATION)->second;\n>\n>  \t\t/* Test getting controls. */\n>  \t\tControlList ctrls(infoMap);\n> --\n> 2.25.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F22460416\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 12:48:13 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 259E3FF804\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 11:48:12 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Fri, 20 Mar 2020 12:51:09 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200320115109.j5fhrmabj2tvltwc@uno.localdomain>","References":"<20200309162414.720306-1-jacopo@jmondi.org>\n\t<20200309162414.720306-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200309162414.720306-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: controls: Rename\n\tControlRange to ControlInfo","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 20 Mar 2020 11:48:13 -0000"}}]