summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/py/cam/cam.py3
-rw-r--r--src/py/libcamera/py_main.cpp8
2 files changed, 9 insertions, 2 deletions
diff --git a/src/py/cam/cam.py b/src/py/cam/cam.py
index e2bc78da..66df18bf 100755
--- a/src/py/cam/cam.py
+++ b/src/py/cam/cam.py
@@ -9,7 +9,6 @@
import argparse
import binascii
import libcamera as libcam
-import os
import sys
import traceback
@@ -294,7 +293,7 @@ def event_handler(state):
cm = state['cm']
contexts = state['contexts']
- os.read(cm.efd, 8)
+ cm.read_event()
reqs = cm.get_ready_requests()
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;