Show a patch.

GET /api/patches/16012/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16012,
    "url": "https://patchwork.libcamera.org/api/patches/16012/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16012/",
    "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": "<20220524114610.41848-7-tomi.valkeinen@ideasonboard.com>",
    "date": "2022-05-24T11:45:57",
    "name": "[libcamera-devel,v2,06/19] 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/16012/mbox/",
    "series": [
        {
            "id": 3134,
            "url": "https://patchwork.libcamera.org/api/series/3134/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3134",
            "date": "2022-05-24T11:45:51",
            "name": "More misc Python patches",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3134/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16012/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16012/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 ED79EC326E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 May 2022 11:46:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 718EE65686;\n\tTue, 24 May 2022 13:46:39 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F3B46566F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 May 2022 13:46:33 +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 8565E4A8;\n\tTue, 24 May 2022 13:46:32 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653392799;\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=LhFlN3c8dTHn/H/Dt3f4bb3XO+mi3B1VDaGwuz/g1RWVIWb4heMcvWO3loxVeOWoG\n\tRLovsOSAWa1+EFtG8wu+MvsuSVTs3naF0ltxC1vkK0Y/6rK6jTpsQY4VkkQX8QNyrR\n\tu8+a7tbwJjQ7kExtHIuxRJqhCNgXqVYzoT3U4hjDtZrrA/2IKXZ/hWVP55+HB7nSHH\n\t5NCyokXTYweZzKcKNI5Crk0BwwIMt1JItgygdoV09jmAQB53DsJPFGBZgJkNvcFubq\n\tkaFg2fur1lzcyb4vzukdRmajykC+lfI/zvIwGJmgaCLwBoB4RH1mRNI80Rkm6wyYZu\n\tz/ZI4LaaUn/jw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653392792;\n\tbh=GrOP/OlQSS6f85g7v8fdN0LyeTNIso0TXXdoVOivEro=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=J8iZSKo7Sek8eoT3eDnOYDSnZOYlVySbA4n7Fxf9nbvKwdeRGNkT9/f7r3Rq5Yi9D\n\t4wi3GjMzQljl03i1LJH/+k1ALrWT6kYXZtMIDq0rnGz0kFZVQ88I3Vs+sEIdDW14j3\n\t15RZE1wfqmSLWfrM9NL/oVCe7+w5kwnjZOEg0M4w="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"J8iZSKo7\"; 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": "Tue, 24 May 2022 14:45:57 +0300",
        "Message-Id": "<20220524114610.41848-7-tomi.valkeinen@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>",
        "References": "<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 06/19] 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",
        "v2",
        "06/19"
    ]
}