py: Merge read_event() and get_ready_requests()

We always call CameraManager.read_event() and
CameraManager.get_ready_requests(), so to simplify the use merge the
read_event() into the get_ready_requests().

This has the side effect that get_ready_requests() will now block if
there is no event ready. If we ever need to call get_ready_requests() in
a polling manner we will need a new function which behaves differently.

However, afaics the only sensible way to manage the event loop is to use
select/poll on the eventfd and then call get_ready_requests() once,
which is the use case what the current merged function supports.

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:
Tomi Valkeinen 2022-05-30 17:27:17 +03:00 committed by Laurent Pinchart
parent b4bb5ce629
commit 7ef83e0228
3 changed files with 2 additions and 11 deletions

View file

@ -210,8 +210,6 @@ class SimpleCaptureMethods(CameraTesterBase):
reqs = []
while True:
cm.read_event()
ready_reqs = cm.get_ready_requests()
reqs += ready_reqs
@ -283,8 +281,6 @@ class SimpleCaptureMethods(CameraTesterBase):
while running:
events = sel.select()
for key, _ in events:
cm.read_event()
ready_reqs = cm.get_ready_requests()
reqs += ready_reqs