[{"id":108,"web_url":"https://patchwork.libcamera.org/comment/108/","msgid":"<3659005.urt4m7xkRp@avalon>","date":"2018-12-28T23:30:20","subject":"Re: [libcamera-devel] [PATCH 07/12] libcamera: deviceenumerator:\n\tadd factory for DeviceEnumerators","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Sunday, 23 December 2018 01:00:36 EET Niklas Söderlund wrote:\n> Provide a factory for DeviceEnumerator objects. Depending on which\n> libraries are available there will be different ways to enumerate\n> information in the system. This factory hides this from the rest of the\n> library.\n> \n> Currently udev enumeration is the only supported implementation, a sysfs\n> implementation is another method that surely will be added in the\n> future.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/deviceenumerator.cpp       | 17 +++++++++++++++++\n>  src/libcamera/include/deviceenumerator.h |  2 ++\n>  2 files changed, 19 insertions(+)\n> \n> diff --git a/src/libcamera/deviceenumerator.cpp\n> b/src/libcamera/deviceenumerator.cpp index\n> f4c40bf0376ab453..6d675fc78af8e586 100644\n> --- a/src/libcamera/deviceenumerator.cpp\n> +++ b/src/libcamera/deviceenumerator.cpp\n> @@ -138,6 +138,23 @@ bool DeviceMatch::matchEntities(const\n> std::vector<std::string> &entities) const * Enumerator Base\n>   */\n> \n> +DeviceEnumerator *DeviceEnumerator::create()\n> +{\n> +\tDeviceEnumerator *enumerator;\n> +\n> +\t/* TODO: add compile time checks to only try udev enumerator if libudev is\n> available */\n> +\tenumerator = new DeviceEnumeratorUdev();\n> +\tif (!enumerator->init())\n> +\t\treturn enumerator;\n> +\n> +\t/* NOTE: Either udev is not available or initialization of it\n> +\t * failed, use/fallback on sysfs enumerator */\n\nPlease have /* and */ on a line of their own.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\t/* TODO: add a sysfs based enumerator */\n> +\n> +\treturn NULL;\n> +}\n> +\n>  DeviceEnumerator::~DeviceEnumerator()\n>  {\n>  \tfor (DeviceInfo *dev : devices_) {\n> diff --git a/src/libcamera/include/deviceenumerator.h\n> b/src/libcamera/include/deviceenumerator.h index\n> 2c7ff3f336ba127d..6aa6e59d4a8a9729 100644\n> --- a/src/libcamera/include/deviceenumerator.h\n> +++ b/src/libcamera/include/deviceenumerator.h\n> @@ -59,6 +59,8 @@ private:\n>  class DeviceEnumerator\n>  {\n>  public:\n> +\tstatic DeviceEnumerator *create();\n> +\n>  \tvirtual ~DeviceEnumerator();\n> \n>  \tvirtual int init() = 0;","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 8E6A260B2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Dec 2018 00:29:24 +0100 (CET)","from avalon.localnet (unknown\n\t[IPv6:2a02:2788:66a:3eb:2624:a446:f4b7:b19d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2794EDF;\n\tSat, 29 Dec 2018 00:29:24 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1546039764;\n\tbh=IrpqMsrjQxTnOjfXtQV37ZBGtjTOn9JU3mY6iC5xBcE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=qTgmFprwOaM8PObis+Oi+Nc9zq7TkEREobmx7OD/eKmaE1d9xXqXe5uBWkxoovrjN\n\trvbdZz2J4nAdRQNFJD+1JRjlMUeTwmbdQJwdM5WcXBcrudO5biW7UsdhcAvxYngMs3\n\t7JT6PlsiwahPx5H+Mzeb0fxsEW3KHWOGWO8ax3Io=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 29 Dec 2018 01:30:20 +0200","Message-ID":"<3659005.urt4m7xkRp@avalon>","Organization":"Ideas on Board Oy","In-Reply-To":"<20181222230041.29999-8-niklas.soderlund@ragnatech.se>","References":"<20181222230041.29999-1-niklas.soderlund@ragnatech.se>\n\t<20181222230041.29999-8-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","Content-Type":"text/plain; charset=\"iso-8859-1\"","Subject":"Re: [libcamera-devel] [PATCH 07/12] libcamera: deviceenumerator:\n\tadd factory for DeviceEnumerators","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, 28 Dec 2018 23:29:24 -0000"}}]