File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ trio-gpio (0.2.2-1) unstable; urgency=medium
2+
3+ * Access errno
4+
5+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 11 Jun 2018 08:29:53 +0200
6+
17trio-gpio (0.2.1-1) unstable; urgency=medium
28
39 * Allow (and prefer) the GPIO chip label instead of its number.
Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ def _enter_io(self):
137137 self .__exit__ ()
138138 raise RuntimeError ("Unknown direction" , r )
139139 if r != 0 :
140+ if r < 0 :
141+ r = gpio .ffi .errno
140142 self .__exit__ ()
141143 raise OSError ("unable to set direction" , r )
142144 self ._state = _IN_IO
@@ -149,7 +151,7 @@ def _enter_ev(self):
149151 req .flags = self ._flags
150152
151153 if gpio .lib .gpiod_line_request (self ._line , req , 0 ) != 0 :
152- raise OSError ("unable to request event monitoring" )
154+ raise OSError ("unable to request event monitoring" , gpio . ffi . errno )
153155 self ._state = _IN_EV
154156
155157 def __exit__ (self , * tb ):
@@ -277,7 +279,9 @@ async def __anext__(self):
277279 self ._is_open ()
278280 r = gpio .lib .gpiod_line_event_read_fd (fd , ev )
279281 if r != 0 :
280- raise OSError ("unable to read update" )
282+ if r < 0 :
283+ r = gpio .ffi .errno
284+ raise OSError ("unable to read update" , r )
281285 return Event (ev )
282286
283287 async def aclose (self ):
You can’t perform that action at this time.
0 commit comments