[{"id":553,"web_url":"https://patchwork.libcamera.org/comment/553/","msgid":"<20190124163419.GU4127@bigcity.dyn.berto.se>","date":"2019-01-24T16:34:19","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Group base\n\toperations in V4L2Base","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-01-24 16:31:35 +0100, Jacopo Mondi wrote:\n> Group operations commont to V4L2Device and the forthcoming V4L2Subdevice\n> in a common V4L2Base class.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n> As I started implementing V4L2Subdevice support, I realized I was going to\n> re-implement what is now part of V4L2Base.\n> \n> I would like to develop V4L2Subdevice on top of this.\n> Patch to be applied on top of my latest:\n> [PATCH v2 0/2] Add mplane support to V4L2 device\n> \n> Thanks\n>    j\n> ---\n>  src/libcamera/include/v4l2_device.h |  38 ++++++---\n>  src/libcamera/v4l2_device.cpp       | 127 ++++++++++++++++++----------\n>  2 files changed, 112 insertions(+), 53 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 2da30d1..08bfe9f 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -54,30 +54,48 @@ struct V4L2Capability final : v4l2_capability {\n>  };\n> \n>  class MediaEntity;\n> -class V4L2Device\n> +class V4L2Base\n>  {\n>  public:\n> -\texplicit V4L2Device(const std::string &deviceNode);\n> -\texplicit V4L2Device(const MediaEntity &entity);\n> +\tvirtual ~V4L2Base() { close(); }\n> +\n> +\tvirtual int open();\n> +\tbool isOpen() const { return fd_ != -1; }\n> +\tvirtual void close();\n> +\n> +protected:\n> +\tV4L2Base(const std::string &deviceNode);\n> +\tV4L2Base(const MediaEntity &entity);\n> +\tV4L2Base(const V4L2Base &) = delete;\n> +\tbool operator=(const V4L2Base &) = delete;\n> +\n> +\tstd::string deviceNode_;\n> +\tint fd_;\n> +};\n> +\n> +class V4L2Device : public V4L2Base\n> +{\n> +public:\n> +\texplicit V4L2Device(const std::string &deviceNode)\n> +\t\t: V4L2Base(deviceNode) {}\n> +\texplicit V4L2Device(const MediaEntity &entity)\n> +\t\t: V4L2Base(entity) {}\n>  \tV4L2Device(const V4L2Device &) = delete;\n> -\t~V4L2Device();\n> \n> -\tvoid operator=(const V4L2Device &) = delete;\n> +\t~V4L2Device() {}\n> \n> -\tint open();\n> -\tbool isOpen() const;\n> -\tvoid close();\n> +\tvoid operator=(const V4L2Device &) = delete;\n> \n>  \tconst char *driverName() const { return caps_.driver(); }\n>  \tconst char *deviceName() const { return caps_.card(); }\n>  \tconst char *busName() const { return caps_.bus_info(); }\n> \n> +\tint open();\n> +\n>  \tint format();\n>  \tint setFormat();\n> \n>  private:\n> -\tstd::string deviceNode_;\n> -\tint fd_;\n>  \tV4L2Capability caps_;\n> \n>  \tint getFormatSingleplane();\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 2ddb800..f505240 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -81,16 +81,15 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   */\n> \n>  /**\n> - * \\class V4L2Device\n> - * \\brief V4L2Device object and API\n> + * \\class V4L2Base\n> + * \\brief Group methods and field common to V4L2 devices and subdevices\n>   *\n> - * The V4L2 Device API class models an instance of a V4L2 device node.\n> - * It is constructed with the path to a V4L2 video device node. The device node\n> - * is only opened upon a call to open() which must be checked for success.\n> + * Represents the base class for V4L2 devices and sub-devices.\n> + * It is constructed with the path to a V4L2 video (sub-)device node or\n> + * with a MediaEntity, provided its deviceNode() path has been set.\n>   *\n> - * The device capabilities are validated when the device is opened and the\n> - * device is rejected if it is not a suitable V4L2 capture or output device, or\n> - * if the device does not support streaming I/O.\n> + * The device node is only opened upon a call to open() which must be\n> + * checked for success.\n>   *\n>   * No API call other than open(), isOpen() and close() shall be called on an\n>   * unopened device instance.\n> @@ -100,35 +99,32 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   */\n> \n>  /**\n> - * \\brief Construct a V4L2Device\n> - * \\param deviceNode The file-system path to the video device node\n> + * \\fn V4L2Base::V4L2Base(const std::string &deviceNode)\n> + * \\brief Construct a V4L2 base instance\n> + * \\param deviceNode The file-system path to the video (sub-)device node\n>   */\n> -V4L2Device::V4L2Device(const std::string &deviceNode)\n> +V4L2Base::V4L2Base(const std::string &deviceNode)\n>  \t: deviceNode_(deviceNode), fd_(-1)\n>  {\n>  }\n> \n>  /**\n> - * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\fn V4L2Base::V4L2Base(const MediaEntity &entity)\n> + * \\brief Construct a V4L2 base instance from a MediaEntity\n>   * \\param entity The MediaEntity to build the device from\n>   *\n> - * Construct a V4L2Device from a MediaEntity's device node path.\n> + * Construct a V4L2 base instance from a MediaEntity's device node path.\n>   */\n> -V4L2Device::V4L2Device(const MediaEntity &entity)\n> -\t: V4L2Device(entity.deviceNode())\n> -{\n> -}\n> -\n> -V4L2Device::~V4L2Device()\n> +V4L2Base::V4L2Base(const MediaEntity &entity)\n> +\t: V4L2Base(entity.deviceNode())\n>  {\n> -\tclose();\n>  }\n> \n>  /**\n> - * \\brief Open a V4L2 device and query its capabilities\n> + * \\brief Open a device node associated with a V4L2 device or subdevice\n>   * \\return 0 on success, or a negative error code otherwise\n>   */\n> -int V4L2Device::open()\n> +int V4L2Base::open()\n>  {\n>  \tint ret;\n> \n> @@ -147,6 +143,72 @@ int V4L2Device::open()\n>  \t}\n>  \tfd_ = ret;\n> \n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\fn V4L2Base::isOpen()\n> + * \\brief Check if device is successfully opened\n> + * \\return True if the device is open, false otherwise\n> + */\n> +\n> +/**\n> + * \\brief Close the device node, releasing any resources acquired by open()\n> + */\n> +void V4L2Base::close()\n> +{\n> +\tif (fd_ < 0)\n> +\t\treturn;\n\nI would use isOpen() here to make it consistent.\n\nWith this fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> +\n> +\t::close(fd_);\n> +\tfd_ = -1;\n> +}\n> +\n> +/**\n> + * \\var V4L2Base::deviceNode_\n> + * \\brief The device node path associated with the V4L2 instance.\n> + */\n> +\n> +/**\n> + * \\var V4L2Base::fd_\n> + * \\brief The file descriptor associated with an open device node\n> + */\n> +\n> +/**\n> + * \\class V4L2Device\n> + * \\brief V4L2Device object and API\n> + *\n> + * The V4L2 Device API class models an instance of a V4L2 device node.\n> + *\n> + * The device capabilities are validated when the device is opened and the\n> + * device is rejected if it is not a suitable V4L2 capture or output device, or\n> + * if the device does not support streaming I/O.\n> + */\n> +\n> +/**\n> + * \\fn V4L2Device::V4L2Device(const std::string &deviceNode)\n> + * \\brief Construct a V4L2Device\n> + * \\param deviceNode The file-system path to the video (sub)device node\n> + */\n> +\n> +/**\n> + * \\fn V4L2Device::V4L2Device(const MediaEntity &entity)\n> + * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\param entity The MediaEntity to build the device from\n> + *\n> + * Construct a V4L2Device from a MediaEntity's device node path.\n> + */\n> +\n> +/**\n> + * \\brief Open a V4L2 device and query its capabilities\n> + * \\return 0 on success, or a negative error code otherwise\n> + */\n> +int V4L2Device::open()\n> +{\n> +\tint ret = V4L2Base::open();\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>  \tret = ioctl(fd_, VIDIOC_QUERYCAP, &caps_);\n>  \tif (ret < 0) {\n>  \t\tret = -errno;\n> @@ -174,27 +236,6 @@ int V4L2Device::open()\n>  \treturn 0;\n>  }\n> \n> -/**\n> - * \\brief Check if device is successfully opened\n> - * \\return True if the device is open, false otherwise\n> - */\n> -bool V4L2Device::isOpen() const\n> -{\n> -\treturn fd_ != -1;\n> -}\n> -\n> -/**\n> - * \\brief Close the device, releasing any resources acquired by open()\n> - */\n> -void V4L2Device::close()\n> -{\n> -\tif (fd_ < 0)\n> -\t\treturn;\n> -\n> -\t::close(fd_);\n> -\tfd_ = -1;\n> -}\n> -\n>  /**\n>   * \\fn const char *V4L2Device::driverName()\n>   * \\brief Retrieve the name of the V4L2 device driver\n> --\n> 2.20.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BB57B60C81\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jan 2019 17:34:22 +0100 (CET)","by mail-lj1-x243.google.com with SMTP id t18-v6so5805543ljd.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jan 2019 08:34:22 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ty14-v6sm1066397ljj.55.2019.01.24.08.34.20\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 24 Jan 2019 08:34:20 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=sqrbffCw2DYmKw2wThBY9dZb8hvdqbJ4TxZvBafgprw=;\n\tb=gbVbMygQwvm35cKFjR+/xcu7XXbDmTtsg/83GcEGNdkkJPCnuT4m8sBQ03FkwE2JhY\n\trx38hfunYELERcj8kWF6x9JO4X7/B4akTaJWmMnUJH9viaEr5n04swnDfoyhna7KDuF0\n\tdcwlM8kdgUxvoFGcGgYz2vFwTgE9AwDjqzJQmI2n0aHqoixglKTMpKqVLmw+jRNoV9MI\n\tg/G5d/1AtJ6/WS6mKibC5n/0e72CxDXYbtDiijD4SFXkjilq73oTCURnWViEp4dgIpu5\n\tY5OUrSJ9kf7p8KuH8cDNRVjvJb+vrht6yKbAfXP7WA197VqOQV+93Te61g6iAWk5bzB4\n\tU2UA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=sqrbffCw2DYmKw2wThBY9dZb8hvdqbJ4TxZvBafgprw=;\n\tb=X4iVbY1Ou7bxkIJNWN07PiakPri1Ot1FUKZbh2RBrBvnvJyApwVR8UHH66BH3nNuiU\n\tz6Antg0Cki14mDb1l7ugfCHUDolr+YtlU27OpWvQ+Xl9SLZeht7Xfxg2034H7QBlImQs\n\tYs7xaaWDKbYRH5HJTl4G+JhNA/tXZw3LfwiYBUUWvMhMxxZ0v0spz7EG0FrrmXrmB26Y\n\t+vY17cYE1sEM9rEGxqVK0qguURaHKUm2NXdP8tidGJBilshW/xdOmg1dV3zb5oVgjjM0\n\tG5R2blanlYGFmwLUvMfkD8zGQQTz6F15Peik4Ajxmwj9f7mN/YnV/fJTv+m0ihG1ZVeq\n\tY8Qg==","X-Gm-Message-State":"AJcUukdiQOkAguFJZ5VMD51NtjGXJSQrNFQrNFOdukW+gL01wyipP/aZ\n\t7q6GlY9F85UgsacEh6v5uPOwfaNI0rU=","X-Google-Smtp-Source":"ALg8bN4U7D8krG7TwX2U+GX9jmgz7GsjPppxwyWXp0m7zQuIIiu1Hq3Vg7pSA5Wg5GkUmkYef/CwHA==","X-Received":"by 2002:a2e:974a:: with SMTP id\n\tf10-v6mr6613042ljj.61.1548347661473; \n\tThu, 24 Jan 2019 08:34:21 -0800 (PST)","Date":"Thu, 24 Jan 2019 17:34:19 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190124163419.GU4127@bigcity.dyn.berto.se>","References":"<20190124153135.378-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190124153135.378-1-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Group base\n\toperations in V4L2Base","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Thu, 24 Jan 2019 16:34:23 -0000"}},{"id":585,"web_url":"https://patchwork.libcamera.org/comment/585/","msgid":"<20190125111836.GF2934@pendragon.ideasonboard.com>","date":"2019-01-25T11:18:36","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Group base\n\toperations in V4L2Base","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Jan 24, 2019 at 04:31:35PM +0100, Jacopo Mondi wrote:\n> Group operations commont to V4L2Device and the forthcoming V4L2Subdevice\n> in a common V4L2Base class.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n> As I started implementing V4L2Subdevice support, I realized I was going to\n> re-implement what is now part of V4L2Base.\n\nAs I mentioned before, I think the amount of code currently in your\nV4L2Base class isn't worth it. It would be a different story if we had\nmore code to share, it would then be easier to convince me :-)\n\nFurthemore, the code in V4L2Base isn't V4L2-specific, so V4L2Base isn't\na proper name in my opinion and I don't think we want to create a custom\nFile class just to encapsulate open and close.\n\n> I would like to develop V4L2Subdevice on top of this.\n> Patch to be applied on top of my latest:\n> [PATCH v2 0/2] Add mplane support to V4L2 device\n> \n> ---\n>  src/libcamera/include/v4l2_device.h |  38 ++++++---\n>  src/libcamera/v4l2_device.cpp       | 127 ++++++++++++++++++----------\n>  2 files changed, 112 insertions(+), 53 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 2da30d1..08bfe9f 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -54,30 +54,48 @@ struct V4L2Capability final : v4l2_capability {\n>  };\n> \n>  class MediaEntity;\n> -class V4L2Device\n> +class V4L2Base\n>  {\n>  public:\n> -\texplicit V4L2Device(const std::string &deviceNode);\n> -\texplicit V4L2Device(const MediaEntity &entity);\n> +\tvirtual ~V4L2Base() { close(); }\n> +\n> +\tvirtual int open();\n> +\tbool isOpen() const { return fd_ != -1; }\n> +\tvirtual void close();\n> +\n> +protected:\n> +\tV4L2Base(const std::string &deviceNode);\n> +\tV4L2Base(const MediaEntity &entity);\n> +\tV4L2Base(const V4L2Base &) = delete;\n> +\tbool operator=(const V4L2Base &) = delete;\n> +\n> +\tstd::string deviceNode_;\n> +\tint fd_;\n> +};\n> +\n> +class V4L2Device : public V4L2Base\n> +{\n> +public:\n> +\texplicit V4L2Device(const std::string &deviceNode)\n> +\t\t: V4L2Base(deviceNode) {}\n> +\texplicit V4L2Device(const MediaEntity &entity)\n> +\t\t: V4L2Base(entity) {}\n>  \tV4L2Device(const V4L2Device &) = delete;\n> -\t~V4L2Device();\n> \n> -\tvoid operator=(const V4L2Device &) = delete;\n> +\t~V4L2Device() {}\n> \n> -\tint open();\n> -\tbool isOpen() const;\n> -\tvoid close();\n> +\tvoid operator=(const V4L2Device &) = delete;\n> \n>  \tconst char *driverName() const { return caps_.driver(); }\n>  \tconst char *deviceName() const { return caps_.card(); }\n>  \tconst char *busName() const { return caps_.bus_info(); }\n> \n> +\tint open();\n> +\n>  \tint format();\n>  \tint setFormat();\n> \n>  private:\n> -\tstd::string deviceNode_;\n> -\tint fd_;\n>  \tV4L2Capability caps_;\n> \n>  \tint getFormatSingleplane();\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 2ddb800..f505240 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -81,16 +81,15 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   */\n> \n>  /**\n> - * \\class V4L2Device\n> - * \\brief V4L2Device object and API\n> + * \\class V4L2Base\n> + * \\brief Group methods and field common to V4L2 devices and subdevices\n>   *\n> - * The V4L2 Device API class models an instance of a V4L2 device node.\n> - * It is constructed with the path to a V4L2 video device node. The device node\n> - * is only opened upon a call to open() which must be checked for success.\n> + * Represents the base class for V4L2 devices and sub-devices.\n> + * It is constructed with the path to a V4L2 video (sub-)device node or\n> + * with a MediaEntity, provided its deviceNode() path has been set.\n>   *\n> - * The device capabilities are validated when the device is opened and the\n> - * device is rejected if it is not a suitable V4L2 capture or output device, or\n> - * if the device does not support streaming I/O.\n> + * The device node is only opened upon a call to open() which must be\n> + * checked for success.\n>   *\n>   * No API call other than open(), isOpen() and close() shall be called on an\n>   * unopened device instance.\n> @@ -100,35 +99,32 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   */\n> \n>  /**\n> - * \\brief Construct a V4L2Device\n> - * \\param deviceNode The file-system path to the video device node\n> + * \\fn V4L2Base::V4L2Base(const std::string &deviceNode)\n> + * \\brief Construct a V4L2 base instance\n> + * \\param deviceNode The file-system path to the video (sub-)device node\n>   */\n> -V4L2Device::V4L2Device(const std::string &deviceNode)\n> +V4L2Base::V4L2Base(const std::string &deviceNode)\n>  \t: deviceNode_(deviceNode), fd_(-1)\n>  {\n>  }\n> \n>  /**\n> - * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\fn V4L2Base::V4L2Base(const MediaEntity &entity)\n> + * \\brief Construct a V4L2 base instance from a MediaEntity\n>   * \\param entity The MediaEntity to build the device from\n>   *\n> - * Construct a V4L2Device from a MediaEntity's device node path.\n> + * Construct a V4L2 base instance from a MediaEntity's device node path.\n>   */\n> -V4L2Device::V4L2Device(const MediaEntity &entity)\n> -\t: V4L2Device(entity.deviceNode())\n> -{\n> -}\n> -\n> -V4L2Device::~V4L2Device()\n> +V4L2Base::V4L2Base(const MediaEntity &entity)\n> +\t: V4L2Base(entity.deviceNode())\n>  {\n> -\tclose();\n>  }\n> \n>  /**\n> - * \\brief Open a V4L2 device and query its capabilities\n> + * \\brief Open a device node associated with a V4L2 device or subdevice\n>   * \\return 0 on success, or a negative error code otherwise\n>   */\n> -int V4L2Device::open()\n> +int V4L2Base::open()\n>  {\n>  \tint ret;\n> \n> @@ -147,6 +143,72 @@ int V4L2Device::open()\n>  \t}\n>  \tfd_ = ret;\n> \n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\fn V4L2Base::isOpen()\n> + * \\brief Check if device is successfully opened\n> + * \\return True if the device is open, false otherwise\n> + */\n> +\n> +/**\n> + * \\brief Close the device node, releasing any resources acquired by open()\n> + */\n> +void V4L2Base::close()\n> +{\n> +\tif (fd_ < 0)\n> +\t\treturn;\n> +\n> +\t::close(fd_);\n> +\tfd_ = -1;\n> +}\n> +\n> +/**\n> + * \\var V4L2Base::deviceNode_\n> + * \\brief The device node path associated with the V4L2 instance.\n> + */\n> +\n> +/**\n> + * \\var V4L2Base::fd_\n> + * \\brief The file descriptor associated with an open device node\n> + */\n> +\n> +/**\n> + * \\class V4L2Device\n> + * \\brief V4L2Device object and API\n> + *\n> + * The V4L2 Device API class models an instance of a V4L2 device node.\n> + *\n> + * The device capabilities are validated when the device is opened and the\n> + * device is rejected if it is not a suitable V4L2 capture or output device, or\n> + * if the device does not support streaming I/O.\n> + */\n> +\n> +/**\n> + * \\fn V4L2Device::V4L2Device(const std::string &deviceNode)\n> + * \\brief Construct a V4L2Device\n> + * \\param deviceNode The file-system path to the video (sub)device node\n> + */\n> +\n> +/**\n> + * \\fn V4L2Device::V4L2Device(const MediaEntity &entity)\n> + * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\param entity The MediaEntity to build the device from\n> + *\n> + * Construct a V4L2Device from a MediaEntity's device node path.\n> + */\n> +\n> +/**\n> + * \\brief Open a V4L2 device and query its capabilities\n> + * \\return 0 on success, or a negative error code otherwise\n> + */\n> +int V4L2Device::open()\n> +{\n> +\tint ret = V4L2Base::open();\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>  \tret = ioctl(fd_, VIDIOC_QUERYCAP, &caps_);\n>  \tif (ret < 0) {\n>  \t\tret = -errno;\n> @@ -174,27 +236,6 @@ int V4L2Device::open()\n>  \treturn 0;\n>  }\n> \n> -/**\n> - * \\brief Check if device is successfully opened\n> - * \\return True if the device is open, false otherwise\n> - */\n> -bool V4L2Device::isOpen() const\n> -{\n> -\treturn fd_ != -1;\n> -}\n> -\n> -/**\n> - * \\brief Close the device, releasing any resources acquired by open()\n> - */\n> -void V4L2Device::close()\n> -{\n> -\tif (fd_ < 0)\n> -\t\treturn;\n> -\n> -\t::close(fd_);\n> -\tfd_ = -1;\n> -}\n> -\n>  /**\n>   * \\fn const char *V4L2Device::driverName()\n>   * \\brief Retrieve the name of the V4L2 device driver","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E16A60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 12:18:37 +0100 (CET)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:a03f:4499:2700:1060:1d4c:d6a:8e80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A76B9325;\n\tFri, 25 Jan 2019 12:18:36 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548415116;\n\tbh=LPQCIFUmE7VYmOy8kIC6/94WuAnY8MwADF4Fqr1HjY0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SXfdtpuXTNdgIgX/vFuMI6OpPp5qI1fbwvUFcag01A76+nDhGEXwUS/4aeV8FlEY3\n\t+dv0ZLgZ7qxlv1BhD3d/twZ1Thjp/v+vpveY5lIi0lXoDK/fMQNY8BcbdVtjkvqjFZ\n\t+tUelG6tN+Ao1Wz76uygsYRYLw0F3M5Ci9HifMZk=","Date":"Fri, 25 Jan 2019 13:18:36 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125111836.GF2934@pendragon.ideasonboard.com>","References":"<20190124153135.378-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190124153135.378-1-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Group base\n\toperations in V4L2Base","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 25 Jan 2019 11:18:37 -0000"}}]