(self, request_type, request, value, index, buffer_or_len,
            callback=None, user_data=None, timeout=0)
Setup transfer for control use.

        request_type, request, value, index
            See USBDeviceHandle.controlWrite.
            request_type defines transfer direction (see
            libusb1.LIBUSB_ENDPOINT_OUT and libusb1.LIBUSB_ENDPOINT_IN)).
        buffer_or_len
            Either a string (when sending data), or expected data length (when
            receiving data).
        callback
            Callback function to be invoked on transfer completion.
            Called with transfer as parameter, return value ignored.
        user_data
            User data to pass to callback function.
        timeout
            Transfer timeout in milliseconds. 0 to disable.
Setup transfer for control use.
Setup transfer for control use .
def setControl(self, request_type, request, value, index, buffer_or_len,
            callback=None, user_data=None, timeout=0):
        """
        Setup transfer for control use.

        request_type, request, value, index
            See USBDeviceHandle.controlWrite.
            request_type defines transfer direction (see
            libusb1.LIBUSB_ENDPOINT_OUT and libusb1.LIBUSB_ENDPOINT_IN)).
        buffer_or_len
            Either a string (when sending data), or expected data length (when
            receiving data).
        callback
            Callback function to be invoked on transfer completion.
            Called with transfer as parameter, return value ignored.
        user_data
            User data to pass to callback function.
        timeout
            Transfer timeout in milliseconds. 0 to disable.
        """
        if self.__submitted:
            raise ValueError('Cannot alter a submitted transfer')
        if self.__doomed:
            raise DoomedTransferError('Cannot reuse a doomed transfer')
        if isinstance(buffer_or_len, (int, long)):
            length = buffer_or_len
            string_buffer = create_binary_buffer(length + \
                libusb1.LIBUSB_CONTROL_SETUP_SIZE)
        else:
            length = len(buffer_or_len)
            string_buffer = create_binary_buffer(CONTROL_SETUP + buffer_or_len)
        self.__initialized = False
        self.__transfer_buffer = string_buffer
        self.__user_data = user_data
        libusb1.libusb_fill_control_setup(string_buffer, request_type,
            request, value, index, length)
        libusb1.libusb_fill_control_transfer(self.__transfer, self.__handle,
            string_buffer, self.__ctypesCallbackWrapper, None, timeout)
        self.__callback = callback
        self.__initialized = True
def setControl ( self , request_type , request , value , index , buffer_or_len , callback = None , user_data = None , timeout = 0 ) : if self . __submitted : raise ValueError ( 'Cannot alter a submitted transfer' ) if self . __doomed : raise DoomedTransferError ( 'Cannot reuse a doomed transfer' ) if isinstance ( buffer_or_len , ( int , long ) ) : length = buffer_or_len string_buffer = create_binary_buffer ( length + libusb1 . LIBUSB_CONTROL_SETUP_SIZE ) else : length = len ( buffer_or_len ) string_buffer = create_binary_buffer ( CONTROL_SETUP + buffer_or_len ) self . __initialized = False self . __transfer_buffer = string_buffer self . __user_data = user_data libusb1 . libusb_fill_control_setup ( string_buffer , request_type , request , value , index , length ) libusb1 . libusb_fill_control_transfer ( self . __transfer , self . __handle , string_buffer , self . __ctypesCallbackWrapper , None , timeout ) self . __callback = callback self . __initialized = True