Patch Detail
Show a patch.
GET /api/1.1/patches/1800/?format=api
{ "id": 1800, "url": "https://patchwork.libcamera.org/api/1.1/patches/1800/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1800/", "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": "<20190813094020.10277-2-kieran.bingham@ideasonboard.com>", "date": "2019-08-13T09:40:15", "name": "[libcamera-devel,v3,1/6] libcamera: v4l2_device: Add setFd()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1c9f516c057127c01d074e0b76b0e07bfc08ce09", "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/1800/mbox/", "series": [ { "id": 458, "url": "https://patchwork.libcamera.org/api/1.1/series/458/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=458", "date": "2019-08-13T09:40:14", "name": "V4L2 M2M Support (+RPi PoC)", "version": 3, "mbox": "https://patchwork.libcamera.org/series/458/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1800/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1800/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 3819060E2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2019 11:40:25 +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 7F7D5327;\n\tTue, 13 Aug 2019 11:40:24 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565689224;\n\tbh=xI2XcWja3BLJ6a0uba0Qub2XZnAnpLCWWkJyhpEgTXM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=l23AjlQbYzPz+56z+lqA/dbwag8evyov10QUHJ5YheOmenB7BWG+gLk2pnX+etQjF\n\tgRBmDFt26D88OoppIM0c4Qh+j8NCTVtSXWuFqdXjaH8QGWmvNJvgrjzynDTVJpnUkx\n\tg/SzTzcH6tt8wGZ995GesK60hhiZbGQ32F/KoZ2I=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Tue, 13 Aug 2019 10:40:15 +0100", "Message-Id": "<20190813094020.10277-2-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190813094020.10277-1-kieran.bingham@ideasonboard.com>", "References": "<20190813094020.10277-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 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": "Tue, 13 Aug 2019 09:40:25 -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..75a52c33d821 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -35,6 +35,7 @@ protected:\n \t~V4L2Device();\n \n \tint open(unsigned int flags);\n+\tint setFd(int fd);\n \n \tint ioctl(unsigned long request, void *argp);\n \ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 9a00566a532b..f89546610ac6 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -88,6 +88,32 @@ int V4L2Device::open(unsigned int flags)\n \treturn 0;\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 (isOpen())\n+\t\treturn -EBUSY;\n+\n+\tfd_ = fd;\n+\n+\treturn 0;\n+}\n+\n /**\n * \\brief Close the device node\n *\n", "prefixes": [ "libcamera-devel", "v3", "1/6" ] }