{"id":1750,"url":"https://patchwork.libcamera.org/api/1.1/patches/1750/?format=json","web_url":"https://patchwork.libcamera.org/patch/1750/","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":"<20190808151221.24254-2-kieran.bingham@ideasonboard.com>","date":"2019-08-08T15:12:16","name":"[libcamera-devel,1/6] libcamera: v4l2_device: Add setFd()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a7a8a7faaf65786875877709f8d7a27c00ffb91a","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1750/mbox/","series":[{"id":449,"url":"https://patchwork.libcamera.org/api/1.1/series/449/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=449","date":"2019-08-08T15:12:15","name":"V4L2 M2M Support (+RPi PoC)","version":1,"mbox":"https://patchwork.libcamera.org/series/449/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1750/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1750/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@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 802B96161B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Aug 2019 17:12:26 +0200 (CEST)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D1840555;\n\tThu,  8 Aug 2019 17:12:25 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565277146;\n\tbh=CNmTZFvZTq1oxMqRhgSYgm353CpC7sBZ0D0sOKURtfc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Y5hVCuu25RZBEOFSiLg1TJMvBVNFuE4y+fEw1vEjFZC21J4ntu4syDabrVRTfT/M4\n\tUILk+PCo2nl4D2DuDu8LuXYUWJDFshV9vT5uGY2mDVvh20ZAsaMFIe0bATl5l9KYjr\n\t5nFF70HpsbAC6WF8oArrQHQyBwivBfwbRuLdKBuE=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Thu,  8 Aug 2019 16:12:16 +0100","Message-Id":"<20190808151221.24254-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190808151221.24254-1-kieran.bingham@ideasonboard.com>","References":"<20190808151221.24254-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/6] libcamera: v4l2_device: Add setFd()","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, 08 Aug 2019 15:12:26 -0000"},"content":"Provide a means for V4L2 device instances to set the fd_ explicitly.\nThis allows for V4L2Devices to operate when they must use an external open() call.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/include/v4l2_device.h |  1 +\n src/libcamera/v4l2_device.cpp       | 19 +++++++++++++++++++\n 2 files changed, 20 insertions(+)","diff":"diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex e7e9829cb05f..7c3af5f6ebe0 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -39,6 +39,7 @@ protected:\n \tint ioctl(unsigned long request, void *argp);\n \n \tint fd() { return fd_; }\n+\tint setFd(int fd);\n \n private:\n \tvoid listControls();\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 9a00566a532b..120f68e49d7a 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -308,6 +308,25 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n  * \\return The V4L2 device file descriptor, -1 if the device node is not open\n  */\n \n+/**\n+ * \\brief Set the file descriptor of a V4L2 device.\n+ * \\param[in] fd The file descriptor handle\n+ *\n+ * Allow a device to set the internal file descriptor rather than opening a\n+ * device node directly.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int V4L2Device::setFd(int fd)\n+{\n+\tif (fd_ != -1)\n+\t\treturn -1;\n+\n+\tfd_ = fd;\n+\n+\treturn 0;\n+}\n+\n /*\n  * \\brief List and store information about all controls supported by the\n  * V4L2 device\n","prefixes":["libcamera-devel","1/6"]}