Patch Detail
Show a patch.
GET /api/1.1/patches/1763/?format=api
{ "id": 1763, "url": "https://patchwork.libcamera.org/api/1.1/patches/1763/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1763/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190809150459.14421-2-kieran.bingham@ideasonboard.com>", "date": "2019-08-09T15:04:54", "name": "[libcamera-devel,v2,1/6] libcamera: v4l2_device: Add setFd()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "582117bce863c90727184907350373ff5bd2ea59", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1763/mbox/", "series": [ { "id": 451, "url": "https://patchwork.libcamera.org/api/1.1/series/451/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=451", "date": "2019-08-09T15:04:53", "name": "V4L2 M2M Support (+RPi PoC)", "version": 2, "mbox": "https://patchwork.libcamera.org/series/451/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1763/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1763/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75E4D61623\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 9 Aug 2019 17:05:04 +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 C58DD52A;\n\tFri, 9 Aug 2019 17:05:03 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565363104;\n\tbh=scZ+LsVhsRd6HwQ5nyJ5QSywLwwPhVYT4603NAhUuwA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=sXlR/ajLM8z+YC+tcbzqyWsCZiwMzquu7d0bT8SEAHGydIu1BYBvvm84fltY3wCIq\n\t9a7Y8oFjT6Rijsxc4gomYeEieDcrHOeqatGoGCeiTPpKQnb0XEqjHHVvNp456+H/2y\n\tsAIgh3FbYeWkwy72Py5JCw+JO1YZPCJekSBjTPFA=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Fri, 9 Aug 2019 16:04:54 +0100", "Message-Id": "<20190809150459.14421-2-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190809150459.14421-1-kieran.bingham@ideasonboard.com>", "References": "<20190809150459.14421-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 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": "Fri, 09 Aug 2019 15:05:04 -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\nopen() call.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_device.h | 1 +\n src/libcamera/v4l2_device.cpp | 26 ++++++++++++++++++++++++++\n 2 files changed, 27 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..ba4c0d725752 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -308,6 +308,32 @@ 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+ * This method allows a device to provide an already opened file descriptor\n+ * referring to the V4L2 device node, instead of opening it with open(). This\n+ * can be used for V4L2 M2M devices where a single video device node is used for\n+ * both the output and capture devices, or when receiving an open file\n+ * descriptor in a context that doesn't have permission to open the device node\n+ * itself.\n+ *\n+ * This method and the open() method are mutually exclusive, only one of the two\n+ * shall be used for a V4L2Device instance.\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", "v2", "1/6" ] }