As a yet another example written in twisted framework: https://github.com/sardok/txgpio
sinx. On Friday, February 24, 2017 at 9:05:33 PM UTC+3, Artur Wroblewski wrote: > > (resurrecting very old thread) > > David Jander wrote: > [...] > > One such example is the Linux GPIO sysfs interface. (see > > https://www.kernel.org/doc/Documentation/gpio/sysfs.txt for more info). > > Via this interface, one can manipulate digital input/output signals > > directly from user-space. One exceptionally (no pun intended) cool > feature > > is the possibility of using inputs to trigger "software interrupts" in > > user-space via select() or poll(). > > > Probably this functionality would have to be implemented in the > selectors > >module first by means of support for EVENT_EXCEPTION in addition to > > EVENT_READ and EVENT_WRITE. > [...] > > I faced exactly the same problem few months ago. > > Assuming you are using Linux... from epoll(2) manpage > > Q3 Is the epoll file descriptor itself poll/epoll/selectable? > A3 Yes. If an epoll file descriptor has events waiting, then it will > indicate as being readable. > > Therefore, you can monitor a GPIO sysfs file with custom epoll instance > for > POLLPRI events, then monitor the instance with asyncio (or in other words, > the asyncio loop will notify you that the custom instance received a > POLLPRI > event). Please see GPIO class constructor at > > https://gitlab.com/wrobell/apgpio/blob/master/apgpio.py > > Regards, > > Artur >
