Patch Detail
Show a patch.
GET /api/patches/998/?format=api
{ "id": 998, "url": "https://patchwork.libcamera.org/api/patches/998/?format=api", "web_url": "https://patchwork.libcamera.org/patch/998/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20190415231859.9747-6-jacopo@jmondi.org>", "date": "2019-04-15T23:18:57", "name": "[libcamera-devel,v5,5/7] libcamera: camera: Validate Request befor queueing it", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "87ff483381a6b4c480d22202122e46809edad57d", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/998/mbox/", "series": [ { "id": 251, "url": "https://patchwork.libcamera.org/api/series/251/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=251", "date": "2019-04-15T23:18:52", "name": "libcamera: Framework changes to prepare for multiple streams support", "version": 5, "mbox": "https://patchwork.libcamera.org/series/251/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/998/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/998/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 039DC60DC8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 01:18:22 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 8A9161BF203;\n\tMon, 15 Apr 2019 23:18:21 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 16 Apr 2019 01:18:57 +0200", "Message-Id": "<20190415231859.9747-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190415231859.9747-1-jacopo@jmondi.org>", "References": "<20190415231859.9747-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 5/7] libcamera: camera: Validate\n\tRequest befor queueing it", "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": "Mon, 15 Apr 2019 23:18:22 -0000" }, "content": "Validate the Request before proceeding to prepare it at\nCamera::queueRequest() time.\n\nFor now limit the validation to making sure the Request contains at\nleast one Stream to capture from.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera.cpp | 15 +++++++++++++--\n 1 file changed, 13 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 21caa24b90b5..e93e7b3b8477 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -715,8 +715,9 @@ Request *Camera::createRequest()\n * \\param[in] request The request to queue to the camera\n *\n * This method queues a \\a request allocated with createRequest() to the camera\n- * for capture. Once the request has been queued, the camera will notify its\n- * completion through the \\ref requestCompleted signal.\n+ * for capture and validates it by making sure it contains at least one stream\n+ * where to capture from. Once the request has been queued, the camera will\n+ * notify its completion through the \\ref requestCompleted signal.\n *\n * Ownership of the request is transferred to the camera. It will be deleted\n * automatically after it completes.\n@@ -724,6 +725,7 @@ Request *Camera::createRequest()\n * \\return 0 on success or a negative error code otherwise\n * \\retval -ENODEV The camera has been disconnected from the system\n * \\retval -EACCES The camera is not running so requests can't be queued\n+ * \\retval -EINVAL The request is not valid\n */\n int Camera::queueRequest(Request *request)\n {\n@@ -733,6 +735,15 @@ int Camera::queueRequest(Request *request)\n \tif (!stateIs(CameraRunning))\n \t\treturn -EACCES;\n \n+\t/*\n+\t * \\todo: Centralize validation if it gets more complex and update\n+\t * the documentation.\n+\t */\n+\tif (request->empty()) {\n+\t\tLOG(Camera, Error) << \"Invalid request\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \tint ret = request->prepare();\n \tif (ret) {\n \t\tLOG(Camera, Error) << \"Failed to prepare request\";\n", "prefixes": [ "libcamera-devel", "v5", "5/7" ] }