mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-19 02:15:05 +03:00
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>
This commit is contained in:
parent
ccfcf5f235
commit
210ce547a4
3 changed files with 10 additions and 4 deletions
|
@ -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()
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue