diff options
author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2022-05-27 17:44:23 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-05-27 22:02:31 +0300 |
commit | 210ce547a42ca559592efaef069648ddfe0d2945 (patch) | |
tree | 08440f63961739e06ab80088471e965f9eeb86e2 /src/py/libcamera | |
parent | ccfcf5f2356fc3bd1dfb825652b2f05738651b46 (diff) |
py: Add CameraManager.read_event()
Add CameraManager.read_event() so that the user does not need to call
os.read().
We use eventfd, and we must always read 8 bytes. Hiding that inside
read_event() makes sense.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/py/libcamera')
-rw-r--r-- | src/py/libcamera/py_main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index e7066841..5d389942 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -212,6 +212,14 @@ PYBIND11_MODULE(_libcamera, m) return gEventfd; }) + .def("read_event", [](CameraManager &) { + uint8_t buf[8]; + + int ret = read(gEventfd, buf, 8); + if (ret != 8) + throw std::system_error(errno, std::generic_category()); + }) + .def("get_ready_requests", [](CameraManager &) { std::vector<Request *> v; |