{"id":2480,"url":"https://patchwork.libcamera.org/api/1.1/patches/2480/?format=json","web_url":"https://patchwork.libcamera.org/patch/2480/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191231053314.20063-4-paul.elder@ideasonboard.com>","date":"2019-12-31T05:33:13","name":"[libcamera-devel,v4,3/4] libcamera: pipeline_handler: uvcvideo: register all Cameras along with a devnum","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c44be33817ff1879c28bf8111de8cf4b938bb598","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2480/mbox/","series":[{"id":595,"url":"https://patchwork.libcamera.org/api/1.1/series/595/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=595","date":"2019-12-31T05:33:10","name":"V4L2 compatibility layer","version":4,"mbox":"https://patchwork.libcamera.org/series/595/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2480/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2480/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@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 D479860465\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Dec 2019 06:33:27 +0100 (CET)","from neptunite.amanokami.net (173-16-160-11.client.mchsi.com\n\t[173.16.160.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 915A3B76;\n\tTue, 31 Dec 2019 06:33:26 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577770407;\n\tbh=dOAs2LYtUhJ1boZ7yjcU847mYZ59gSvd1VScfNM8mVs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=j25DWgEg0tMgvV5O6c25AFWSrwu8qENnuUBWZ/A+SAE6WjcIfaYxxriKZni7oQPzV\n\t8CguET/Y2TlzVPsJf1qu4J25UErMjl7EdGsYRaiIwHGXNHiLYdzmVl3MGoM64rXwvb\n\tTWao+81Q8f9LqVm7xZgaqBPvzaxQT6bVJg0dbTSs=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 30 Dec 2019 23:33:13 -0600","Message-Id":"<20191231053314.20063-4-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191231053314.20063-1-paul.elder@ideasonboard.com>","References":"<20191231053314.20063-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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":"Tue, 31 Dec 2019 05:33:28 -0000"},"content":"Register all UVC Cameras along with their device numbers, to eventually\nallow the V4L2 compatibility layer to match against it.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v4\n\nNew in v3\n---\n src/libcamera/pipeline/uvcvideo.cpp | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 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 \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);\n","prefixes":["libcamera-devel","v4","3/4"]}