[{"id":3292,"web_url":"https://patchwork.libcamera.org/comment/3292/","msgid":"<20200102000611.GB15498@pendragon.ideasonboard.com>","date":"2020-01-02T00:06:11","subject":"Re: [libcamera-devel] [PATCH v4 3/4] libcamera: pipeline_handler:\n\tuvcvideo: register all Cameras along with a devnum","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Mon, Dec 30, 2019 at 11:33:13PM -0600, Paul Elder wrote:\n> Register all UVC Cameras along with their device numbers, to eventually\n> allow the V4L2 compatibility layer to match against it.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> ---\n> No change in v4\n> \n> New in v3\n> ---\n>  src/libcamera/pipeline/uvcvideo.cpp | 7 +++++--\n>  1 file changed, 5 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> index 3043366b..096c1c09 100644\n> --- a/src/libcamera/pipeline/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -7,6 +7,7 @@\n>  \n>  #include <algorithm>\n>  #include <iomanip>\n> +#include <sys/sysmacros.h>\n>  #include <tuple>\n>  \n>  #include <libcamera/camera.h>\n> @@ -294,17 +295,19 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n>  \t\treturn false;\n>  \n>  \tstd::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);\n> +\tdev_t devnum = 0;\n>  \n>  \t/* Locate and initialise the camera data with the default video node. */\n>  \tfor (MediaEntity *entity : media->entities()) {\n>  \t\tif (entity->flags() & MEDIA_ENT_FL_DEFAULT) {\n>  \t\t\tif (data->init(entity))\n>  \t\t\t\treturn false;\n> +\t\t\tdevnum = makedev(entity->deviceMajor(), entity->deviceMinor());\n>  \t\t\tbreak;\n>  \t\t}\n>  \t}\n>  \n> -\tif (!data) {\n> +\tif (!data || !devnum) {\n\nThis actually fixes a bug in the UVC pipeline handler. I've just sent a\nfix for that (\"[PATCH] libcamera: pipeline: uvcvideo: Fix crash when\ndefault entity is not found\"), could you review it and rebase this\nseries on top ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\tLOG(UVC, Error) << \"Could not find a default video device\";\n>  \t\treturn false;\n>  \t}\n> @@ -312,7 +315,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n>  \t/* Create and register the camera. */\n>  \tstd::set<Stream *> streams{ &data->stream_ };\n>  \tstd::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams);\n> -\tregisterCamera(std::move(camera), std::move(data));\n> +\tregisterCamera(std::move(camera), std::move(data), devnum);\n>  \n>  \t/* Enable hot-unplug notifications. */\n>  \thotplugMediaDevice(media);","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 3C02360467\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jan 2020 01:06:21 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A8116516;\n\tThu,  2 Jan 2020 01:06:20 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577923580;\n\tbh=oVk1/6WcEF6pBiy/eybXexzwSCj8X09Ln7XXs5X15vM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DC2dFntWONnc1z2T4lhN1Tpz9ujRft5BznjeWLkcVsO2/JKTAhHH8iSHDHz2PbjXQ\n\tVHFa9cdMICuIQQ8QpF7qDjOg7+CyTthblfqeL4Fii8UFYRqdxXFL9Ul+5YrO0PR/tN\n\t1QB3ZmUsB0l1JSPAlsUCpD58pM2nGppo1H7sPIM4=","Date":"Thu, 2 Jan 2020 02:06:11 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200102000611.GB15498@pendragon.ideasonboard.com>","References":"<20191231053314.20063-1-paul.elder@ideasonboard.com>\n\t<20191231053314.20063-4-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20191231053314.20063-4-paul.elder@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 3/4] libcamera: pipeline_handler:\n\tuvcvideo: register all Cameras along with a devnum","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":"Thu, 02 Jan 2020 00:06:21 -0000"}}]