Patch Detail
Show a patch.
GET /api/patches/16077/?format=api
{ "id": 16077, "url": "https://patchwork.libcamera.org/api/patches/16077/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16077/", "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": "<20220527144447.94891-7-tomi.valkeinen@ideasonboard.com>", "date": "2022-05-27T14:44:23", "name": "[libcamera-devel,v3,06/30] py: Add CameraManager.read_event()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "020072f1453d7b84e3be667bb6b1f59954190cc7", "submitter": { "id": 109, "url": "https://patchwork.libcamera.org/api/people/109/?format=api", "name": "Tomi Valkeinen", "email": "tomi.valkeinen@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16077/mbox/", "series": [ { "id": 3146, "url": "https://patchwork.libcamera.org/api/series/3146/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3146", "date": "2022-05-27T14:44:17", "name": "More misc Python patches", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3146/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16077/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16077/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DF276C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 14:45:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5CEB65652;\n\tFri, 27 May 2022 16:45:13 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E4EB65638\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 16:45:07 +0200 (CEST)", "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 102D8FE0;\n\tFri, 27 May 2022 16:45:07 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653662713;\n\tbh=GrOP/OlQSS6f85g7v8fdN0LyeTNIso0TXXdoVOivEro=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=nfSLscfAIxUKlHYesqCCqQNZWEI9WguK7zLesqOn3xiX4YEthwOuY0yoAeYyZEVKO\n\te0/GlK2P/88oxppwJsuBBdkOo/F1/7VpGUsGRTYTsbrHag+dko2yS7DPVOcDEBjM1S\n\t0s6Wk6BBxAilka+6MW1TOonTA8F4JDyrcj5S6rk8JxES9Bh7/iN5IVD0KKLwAe32d3\n\ttr+O050JPuYM+LHTvo7rdwta4+DQTLN7B20cn2wYgi74v2WGbfDmRk0QzEvA95MjPk\n\tJgu6DJbnYJ/Mnx2LflxTZwBiVoNsqdST31mpwJdwsfrCRFcQfZIhooYlt5cuJO3QRM\n\t8DxNN8UfEVvQQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653662707;\n\tbh=GrOP/OlQSS6f85g7v8fdN0LyeTNIso0TXXdoVOivEro=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XiBouHCsLOtymTd64JtfZUZt6VJBlSdW0imhR1U2dkIBHxPBx/q1uCJ/J2Rw+c/j8\n\tRnrtJT5JpPOaN6u8x7x3k/t5N+prshAm64Kl4hXHCwQnDcAqFxjrYg6ukc8rgf112O\n\tJDeTOroOCeVg7sNsKhtf3vGlHH3pIbS+HTgVt3dM=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XiBouHCs\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>", "Date": "Fri, 27 May 2022 17:44:23 +0300", "Message-Id": "<20220527144447.94891-7-tomi.valkeinen@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220527144447.94891-1-tomi.valkeinen@ideasonboard.com>", "References": "<20220527144447.94891-1-tomi.valkeinen@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 06/30] py: Add\n\tCameraManager.read_event()", "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>", "From": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add CameraManager.read_event() so that the user does not need to call\nos.read().\n\nWe use eventfd, and we must always read 8 bytes. Hiding that inside\nread_event() makes sense.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/cam/cam.py | 3 +--\n src/py/libcamera/py_main.cpp | 8 ++++++++\n test/py/unittests.py | 3 +--\n 3 files changed, 10 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/py/cam/cam.py b/src/py/cam/cam.py\nindex e2bc78da..66df18bf 100755\n--- a/src/py/cam/cam.py\n+++ b/src/py/cam/cam.py\n@@ -9,7 +9,6 @@\n import argparse\n import binascii\n import libcamera as libcam\n-import os\n import sys\n import traceback\n \n@@ -294,7 +293,7 @@ def event_handler(state):\n cm = state['cm']\n contexts = state['contexts']\n \n- os.read(cm.efd, 8)\n+ cm.read_event()\n \n reqs = cm.get_ready_requests()\n \ndiff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp\nindex e7066841..5d389942 100644\n--- a/src/py/libcamera/py_main.cpp\n+++ b/src/py/libcamera/py_main.cpp\n@@ -212,6 +212,14 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t\treturn gEventfd;\n \t\t})\n \n+\t\t.def(\"read_event\", [](CameraManager &) {\n+\t\t\tuint8_t buf[8];\n+\n+\t\t\tint ret = read(gEventfd, buf, 8);\n+\t\t\tif (ret != 8)\n+\t\t\t\tthrow std::system_error(errno, std::generic_category());\n+\t\t})\n+\n \t\t.def(\"get_ready_requests\", [](CameraManager &) {\n \t\t\tstd::vector<Request *> v;\n \ndiff --git a/test/py/unittests.py b/test/py/unittests.py\nindex 7dede33b..8c445bc9 100755\n--- a/test/py/unittests.py\n+++ b/test/py/unittests.py\n@@ -7,7 +7,6 @@ from collections import defaultdict\n import errno\n import gc\n import libcamera as libcam\n-import os\n import selectors\n import time\n import typing\n@@ -278,7 +277,7 @@ class SimpleCaptureMethods(CameraTesterBase):\n while running:\n events = sel.select()\n for key, _ in events:\n- os.read(key.fd, 8)\n+ cm.read_event()\n \n ready_reqs = cm.get_ready_requests()\n \n", "prefixes": [ "libcamera-devel", "v3", "06/30" ] }