{"id":18366,"url":"https://patchwork.libcamera.org/api/patches/18366/?format=json","web_url":"https://patchwork.libcamera.org/patch/18366/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230309142601.70556-6-tomi.valkeinen@ideasonboard.com>","date":"2023-03-09T14:25:51","name":"[libcamera-devel,v4,05/15] py: simple-capture.py: Use new events support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"eaa087af069179b7f6c52970c9b64a83772481f0","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18366/mbox/","series":[{"id":3796,"url":"https://patchwork.libcamera.org/api/series/3796/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3796","date":"2023-03-09T14:25:46","name":"py: New python bindings event handling","version":4,"mbox":"https://patchwork.libcamera.org/series/3796/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18366/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18366/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 A3224C329D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Mar 2023 14:26:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB4EE626F9;\n\tThu,  9 Mar 2023 15:26:23 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 57F0B626DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Mar 2023 15:26:18 +0100 (CET)","from desky.lan (91-154-32-225.elisa-laajakaista.fi [91.154.32.225])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CEDDC886;\n\tThu,  9 Mar 2023 15:26:17 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678371983;\n\tbh=edz4xFWTKtABKI4EC7dWnAxOKJeMyqJxs/BmtaJae4g=;\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=HOrnXeCXjn53XoVw37sYuHFpuDjYzueU2XubKyD7XMhLGjY6Jen2jpJCLxcvluq9g\n\tWGTr+o7U6Jkfk2byesE2nreN7yk9PeLqCPge1hzOnQAzyyKIlwokPXoPETVzJhk7wj\n\t4DShB6ZzFCt/qqJKPRJzv9So9ctlnZludXN2QIMMhIlxnBKVs9NOG+/+ifz0uSorvk\n\t0zJojbGcWlq75BXABndoYhj1olNtRyc/NXO63L1aqlHmxwveCUL+LNVwrG/o6DrJMd\n\t3sKbcuABlf/0mwgZfTqcjaZzNLfO//NfxXQtSOu27o/aJ+L/D5gr7ElB+TQ1KBdgEO\n\takX0AYVjTSUIQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678371978;\n\tbh=edz4xFWTKtABKI4EC7dWnAxOKJeMyqJxs/BmtaJae4g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ChpWjtCEUSAn99Eq7tKNHQtSClKDXdgmsDTSZCRgWBaFYEECfjOuuNINiQVz6hcjU\n\tIEOEwVrOZm1P/JkBDdF+TbncfXFMQWQhQSzIE+I8H20JDJw0ngvS8Gu5BP40WqmeJ5\n\t0+BE6MBHxQw5OpoCLNc+Zm30Uyxs7chZvrjJFxfc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ChpWjtCE\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  9 Mar 2023 16:25:51 +0200","Message-Id":"<20230309142601.70556-6-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","References":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 05/15] py: simple-capture.py: Use new\n\tevents support","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":"Update simple-capture.py to the new event model.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/py/examples/simple-capture.py | 15 ++++++++++-----\n 1 file changed, 10 insertions(+), 5 deletions(-)","diff":"diff --git a/src/py/examples/simple-capture.py b/src/py/examples/simple-capture.py\nindex 4b85408f..4fa36d6f 100755\n--- a/src/py/examples/simple-capture.py\n+++ b/src/py/examples/simple-capture.py\n@@ -107,17 +107,22 @@ def main():\n     sel.register(cm.event_fd, selectors.EVENT_READ)\n \n     while frames_done < TOTAL_FRAMES:\n-        # cm.get_ready_requests() does not block, so we use a Selector to wait\n-        # for a camera event. Here we should almost always get a single\n-        # Request, but in some cases there could be multiple or none.\n+        # cm.get_events() does not block, so we use a Selector to wait for a\n+        # camera event. Here we should almost always get a single request\n+        # completion event, but in some cases there could be multiple ones,\n+        # other events, or no events at all.\n \n         events = sel.select()\n         if not events:\n             continue\n \n-        reqs = cm.get_ready_requests()\n+        for ev in cm.get_events():\n+            # We are only interested in RequestCompleted events\n+            if ev.type != libcam.Event.Type.RequestCompleted:\n+                continue\n+\n+            req = ev.request\n \n-        for req in reqs:\n             frames_done += 1\n \n             buffers = req.buffers\n","prefixes":["libcamera-devel","v4","05/15"]}