{"id":16406,"url":"https://patchwork.libcamera.org/api/covers/16406/?format=json","web_url":"https://patchwork.libcamera.org/cover/16406/","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":"<20220629070416.17550-1-tomi.valkeinen@ideasonboard.com>","date":"2022-06-29T07:04:02","name":"[libcamera-devel,v2,00/14] Python bindings event handling","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/16406/mbox/","series":[{"id":3230,"url":"https://patchwork.libcamera.org/api/series/3230/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3230","date":"2022-06-29T07:04:02","name":"Python bindings event handling","version":2,"mbox":"https://patchwork.libcamera.org/series/3230/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/16406/comments/","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 9952FBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Jun 2022 07:04:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96F886563B;\n\tWed, 29 Jun 2022 09:04:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F95F60552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jun 2022 09:04:40 +0200 (CEST)","from deskari.lan (91-158-154-79.elisa-laajakaista.fi\n\t[91.158.154.79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C7EA4A8;\n\tWed, 29 Jun 2022 09:04:39 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656486282;\n\tbh=jj3dizpI6ArZZZ7WrJHaft6iRD1TBV/M310eawnjA2M=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=0POIa8kJUfsjJccA22GoSeOXVL943jiaNFH8v42D3AbMIci85YRFmnL6M+K1Q4bC2\n\twoPlJFq1AwUmnjUT1xJcetlQpw7o5hr3ddVog7XUxE2rG2ehs5z9V5bwSxpEAVYwfb\n\tPEGoH1hWAfWZ5DUapJ/7ez5/AJT65NnZbm558TqZv3ZfXiD4kujRaM7T6DdwVjDDcW\n\tCsGns4Sb3ndAeXnwB8fgv1tvbIMLmQy4yndRAyaT5L7l6GWVwQizRvTND7iczYgGvB\n\tMUuESWuvPL4mNLPTcXcaDj/7eo+CN/NlIAhymQN8SB9Vnh9ndov5DCcHVMKxndYRCy\n\tfJndQJNf9/y8g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656486279;\n\tbh=jj3dizpI6ArZZZ7WrJHaft6iRD1TBV/M310eawnjA2M=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=d/lNJLNym+5KNkXG6hTeyhaiv4Vjl6fMsYgrkKX/eUMoXC2vWvxhZidj784mE4A8A\n\tMPr0ItOVxOmYhgoNtBD2OQp+xXJcMMwwrjL4TbTA1JptE5bz0rVz/2mpAdxoqSPAa+\n\ttOCb9+f0fr7vpkTI8g7VOdWBkuFRoxzP2XA2kopQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"d/lNJLNy\"; 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":"Wed, 29 Jun 2022 10:04:02 +0300","Message-Id":"<20220629070416.17550-1-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 00/14] Python bindings event handling","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":"Hi,\n\nv2 of the event handling series. Plenty of changes to v1:\n\n- (Hopefully) most of the review comments addressed\n- PyCameraManager no longer inherits CameraManager. This also fixes the\n  camera added/removed events.\n- 7 new patches\n- API CHANGE: The eventfd is now always non-blocking. This causes an API\n  change only if you relied on the blocking read.\n- API CHANGE: many of the methods exposed to Python no longer return an\n  error code, but raise an exception on error.\n\nThe patches up to and including \"py: Switch to non-blocking eventfd\" can\nbe considered for merging.\n\nThe new event handling still needs more thought, I believe. I'm still\nnot sure if we should go with the dispatching method implemented now, or\ninstead returning a list of events which the user needs to process (a\nbit more like what we have now with the get_ready_requests). I'm also\nnot quite sure how to go with the camera.stop(), but there's an attempt\nto solve that in this series.\n\n Tomi\n\nTomi Valkeinen (14):\n  py: cam.py: Fix multi camera capture without -C\n  py: Add Python logging category\n  py: Move ControlValue helpers to py_helpers.cpp\n  py: cam.py: Remove todo comment\n  py: Create PyCameraManager\n  py: Use UniqueFD\n  py: Set EFD_CLOEXEC on eventfd to avoid fd leaking\n  py: Use libcamera's Mutex classes\n  py: Use exceptions instead of returning error codes\n  py: Switch to non-blocking eventfd\n  py: New event handling\n  py: cam.py: Use new events support\n  py: Discard/Dispatch Request events on camera.stop()\n  py: Add hotplug-monitor.py\n\n src/py/cam/cam.py                            |  57 +--\n src/py/examples/hotplug-monitor.py           |  38 ++\n src/py/examples/simple-cam.py                |  20 +-\n src/py/examples/simple-capture.py            |  33 +-\n src/py/examples/simple-continuous-capture.py |  26 +-\n src/py/libcamera/meson.build                 |   2 +\n src/py/libcamera/py_camera_manager.cpp       | 375 +++++++++++++++++++\n src/py/libcamera/py_camera_manager.h         | 100 +++++\n src/py/libcamera/py_helpers.cpp              |  97 +++++\n src/py/libcamera/py_helpers.h                |  13 +\n src/py/libcamera/py_main.cpp                 | 347 ++++++++---------\n src/py/libcamera/py_main.h                   |  14 +\n test/py/unittests.py                         |  83 ++--\n 13 files changed, 904 insertions(+), 301 deletions(-)\n create mode 100644 src/py/examples/hotplug-monitor.py\n create mode 100644 src/py/libcamera/py_camera_manager.cpp\n create mode 100644 src/py/libcamera/py_camera_manager.h\n create mode 100644 src/py/libcamera/py_helpers.cpp\n create mode 100644 src/py/libcamera/py_helpers.h\n create mode 100644 src/py/libcamera/py_main.h"}