Skip to content

Commit 2761bae

Browse files
committed
Use a pseudo socket
1 parent 7e2c4d7 commit 2761bae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

asyncgpio/gpio.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
import datetime
66

77

8+
class _sock:
9+
def __init__(self,fd):
10+
self.fd = fd
11+
def fileno(self):
12+
return self.fd
13+
814
class Chip:
915
"""Represents a GPIO chip.
1016
@@ -285,7 +291,7 @@ async def __anext__(self):
285291
fd = gpio.lib.gpiod_line_event_get_fd(self._line)
286292
if fd < 0:
287293
raise OSError("line is closed")
288-
await anyio.wait_socket_readable(fd)
294+
await anyio.wait_socket_readable(_sock(fd))
289295
self._is_open()
290296
r = gpio.lib.gpiod_line_event_read_fd(fd, ev)
291297
if r != 0:

0 commit comments

Comments
 (0)