Beispiel #1
0
 def __init__(self, handle, iso_packets=0):
     """
     You should not instanciate this class directly.
     Call "getTransfer" method on an USBDeviceHandle instance to get
     instances of this class.
     """
     if iso_packets < 0:
         raise ValueError('Cannot request a negative number of iso '
             'packets.')
     self.__handle = handle
     self.__num_iso_packets = iso_packets
     result = libusb1.libusb_alloc_transfer(iso_packets)
     if not result:
         raise libusb1.USBError('Unable to get a transfer object')
     self.__transfer = result
     self.__ctypesCallbackWrapper = libusb1.libusb_transfer_cb_fn_p(
         self.__callbackWrapper)
Beispiel #2
0
 def fillControlTransfer(self, transfer, setup, callback,
                         user_data, timeout):
     libusb1.libusb_fill_control_transfer(transfer, self.handle,
         setup, libusb1.libusb_transfer_cb_fn_p(callback), user_data,
         timeout)
Beispiel #3
0
 def fillInterruptTransfer(self, transfer, endpoint, string_buffer,
                           callback, user_data, timeout):
     libusb1.libusb_fill_interrupt_transfer(transfer, self.handle,
         endpoint, string_buffer,  sizeof(string_buffer),
         libusb1.libusb_transfer_cb_fn_p(callback), user_data,
         timeout)