Ejemplo n.º 1
0
 def handleEventsTimeout(self, tv=None):
     if not isinstance(tv ,libusb1.timeval):
         assert tv is None, 'tv parameter is not supported yet'
         tv = libusb1.timeval(0, 0)
     result = libusb1.libusb_handle_events_timeout(self.context_p, byref(tv))
     if result:
         raise libusb1.USBError, result
Ejemplo n.º 2
0
 def handleEventsTimeout(self, tv=0):
     """
     Handle any pending event.
     If tv is 0, will return immediately after handling already-pending
     events.
     Othewire, defines the maximum amount of time to wait for events, in
     seconds.
     """
     if tv is None:
         tv = 0
     tv_s = int(tv)
     tv = libusb1.timeval(tv_s, int((tv - tv_s) * 1000000))
     result = libusb1.libusb_handle_events_timeout(self.__context_p,
         byref(tv))
     if result:
         raise libusb1.USBError(result)
Ejemplo n.º 3
0
 def getNextTimeout(self):
     """
     Returns the next internal timeout that libusb needs to handle, in
     seconds, or None if no timeout is needed.
     You should not have to call this method, unless you are integrating
     this class with a polling mechanism.
     """
     timeval = libusb1.timeval()
     result = libusb1.libusb_get_next_timeout(self.__context_p,
         byref(timeval))
     if result == 0:
         result = None
     elif result == 1:
         result = timeval.tv_sec + (timeval.tv_usec * 0.000001)
     else:
         raise libusb1.USBError(result)
     return result