The docs don't mention it but currently passing None as the timeout to
one of the event wait methods works like passing 0 to select() - the wait
method returns immediately. Change it to a more standard behavior - None
makes the method block indefinitely until an event becomes available for
reading.
This is a slight change in the behavior but let's hope nobody complains
as libgpiod v2 is still pretty recent and its adoption is (hopegully)
not wide-spread yet.
Reported-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Suggested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Args:
timeout:
Wait time limit represented as either a datetime.timedelta object
- or the number of seconds stored in a float.
+ or the number of seconds stored in a float. If set to 0, the
+ method returns immediately, if set to None it blocks indefinitely.
Returns:
True if an info event is ready to be read from the chip, False if the
def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:
- if timeout is None:
- timeout = 0.0
-
if isinstance(timeout, timedelta):
sec = timeout.total_seconds()
else:
Args:
timeout:
Wait time limit expressed as either a datetime.timedelta object
- or the number of seconds stored in a float.
+ or the number of seconds stored in a float. If set to 0, the
+ method returns immediately, if set to None it blocks indefinitely.
Returns:
True if events are ready to be read. False on timeout.