mirror of
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
synced 2026-10-24 00:48:53 +03:00
Several files under bindings/python/ have wrong license tags. In general: - Makefiles should be covered by GPL - all python sources under bindings/python/gpiod/ and bindings/python/tests/ that are part of importable modules should be licensed under LGPL - executable examples should be licensed under GPL Reported-by: Vincent Fazio <vfazio@xes-inc.com> Closes: https://github.com/brgl/libgpiod/issues/110 Acked-by: Vincent Fazio <vfazio@xes-inc.com> Link: https://lore.kernel.org/r/20241127150529.126896-1-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
20 lines
541 B
Python
20 lines
541 B
Python
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
# SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
|
|
|
|
from datetime import timedelta
|
|
from select import select
|
|
from typing import Optional, Union
|
|
|
|
__all__ = ["poll_fd"]
|
|
|
|
|
|
def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:
|
|
sec: Union[float, None]
|
|
if isinstance(timeout, timedelta):
|
|
sec = timeout.total_seconds()
|
|
else:
|
|
sec = timeout
|
|
|
|
readable, _, _ = select([fd], [], [], sec)
|
|
return True if fd in readable else False
|