示例#1
0
 def getPollFDList(self):
     """
     Return file descriptors to be used to poll USB events.
     You should not have to call this method, unless you are integrating
     this class with a polling mechanism.
     """
     pollfd_p_p = libusb1.libusb_get_pollfds(self.__context_p)
     if not pollfd_p_p:
         errno = get_errno()
         if errno:
             raise OSError(errno)
         else:
             # Assume not implemented
             raise NotImplementedError("Your libusb doesn't seem to "
                 "implement pollable FDs")
     try:
         result = []
         append = result.append
         fd_index = 0
         while pollfd_p_p[fd_index]:
             append((pollfd_p_p[fd_index].contents.fd,
                     pollfd_p_p[fd_index].contents.events))
             fd_index += 1
     finally:
         _free(pollfd_p_p)
     return result
示例#2
0
 def getPollFDList(self):
     pollfd_p_p = libusb1.libusb_get_pollfds(self.context_p)
     result = []
     append = result.append
     fd_index = 0
     while pollfd_p_p[fd_index]:
         append((pollfd_p_p[fd_index].contents.fd,
                 pollfd_p_p[fd_index].contents.events))
         fd_index += 1
     # XXX: causes problems, why ?
     #libusb1.libusb.free(pollfd_p_p)
     return result