示例#1
0
 def getPipeInformation(self, interfaceIndex, pipeIndex):
     """Returns a dictionary describing the pipe infromationfor the specified indexes. """
     pipeDesc = _ft.FT_PIPE_INFORMATION()
     self.status = call_ft(_ft.FT_GetPipeInformation, self.handle,
                           _ft.UCHAR(interfaceIndex), _ft.UCHAR(pipeIndex),
                           c.byref(pipeDesc))
     return pipeDesc
示例#2
0
 def getStringDescriptor(self, index):
     """Returns a string descriptor. """
     strDesc = _ft.FT_STRING_DESCRIPTOR()
     lenTransferred = _ft.DWORD()
     self.status = call_ft(_ft.FT_GetDescriptor, self.handle,
                           _ft.UCHAR(FT_STRING_DESCRIPTOR_TYPE),
                           _ft.UCHAR(index), c.pointer(strDesc),
                           c.sizeof(strDesc), c.byref(lenTransferred))
     return strDesc
示例#3
0
 def readPipe(self, channel, data, datalen, timeout=1000):
     """Recv the data to the device."""
     bytesTransferred = _ft.ULONG()
     self.status = call_ft(_ft.FT_ReadPipeEx, self.handle,
                           _ft.UCHAR(channel), data, _ft.ULONG(datalen),
                           c.byref(bytesTransferred), timeout)
     return bytesTransferred.value
示例#4
0
 def readPipe(self, pipe, data, datalen):
     """Recv the data to the device."""
     bytesTransferred = _ft.ULONG()
     self.status = call_ft(_ft.FT_ReadPipe, self.handle,
                           _ft.UCHAR(pipe), data, _ft.ULONG(datalen),
                           c.byref(bytesTransferred), None)
     return bytesTransferred.value
示例#5
0
 def readPipeEx(self, channel, datalen, timeout=1000, raw=False):
     """Recv the data to the device."""
     bytesTransferred = _ft.ULONG()
     data = c.c_buffer(datalen)
     self.status = call_ft(_ft.FT_ReadPipeEx, self.handle,
                           _ft.UCHAR(channel), data, _ft.ULONG(datalen),
                           c.byref(bytesTransferred), timeout)
     return {
         'bytesTransferred':
         bytesTransferred.value,
         'bytes':
         data.value[:bytesTransferred.value]
         if raw == False else data.raw[:bytesTransferred.value]
     }
示例#6
0
 def readPipeEx(self, pipe, datalen, raw=True):
     """Recv the data to the device."""
     bytesTransferred = _ft.ULONG()
     data = c.c_buffer(datalen)
     self.status = call_ft(_ft.FT_ReadPipe, self.handle,
                           _ft.UCHAR(pipe), data, _ft.ULONG(datalen),
                           c.byref(bytesTransferred), None)
     return {
         'bytesTransferred':
         bytesTransferred.value,
         'bytes':
         data.raw[:bytesTransferred.value]
         if raw == True else data.value[:bytesTransferred.value]
     }
示例#7
0
 def abortPipe(self, pipe):
     """Abort ongoing transfers for the specifed pipe"""
     self.status = call_ft(_ft.FT_AbortPipe, self.handle,
                           _ft.UCHAR(pipe))
     return None
示例#8
0
 def clearStreamPipe(self, pipe):
     """Clear stream pipe for continous transfer of fixed size"""
     self.status = call_ft(_ft.FT_ClearStreamPipe, self.handle,
                           _ft.BOOLEAN(0), _ft.BOOLEAN(0),
                           _ft.UCHAR(pipe))
     return None
示例#9
0
 def setStreamPipe(self, pipe, size):
     """Set stream pipe for continous transfer of fixed size"""
     self.status = call_ft(_ft.FT_SetStreamPipe, self.handle,
                           _ft.BOOLEAN(0), _ft.BOOLEAN(0),
                           _ft.UCHAR(pipe), _ft.ULONG(size))
     return None
示例#10
0
 def getPipeTimeout(self, pipeid):
     """Get pipe timeout"""
     timeoutMS = _ft.ULONG()
     self.status = call_ft(_ft.FT_GetPipeTimeout, self.handle,
                           _ft.UCHAR(pipeid), c.byref(timeoutMS))
     return timeoutMS.value
示例#11
0
 def setPipeTimeout(self, pipeid, timeoutMS):
     """Set pipe timeout"""
     self.status = call_ft(_ft.FT_SetPipeTimeout, self.handle,
                           _ft.UCHAR(pipeid), _ft.ULONG(timeoutMS))
     return None
示例#12
0
 def getInterfaceDescriptor(self, interfaceIndex):
     """Returns a dictionary describing the interface descriptor for the specified index. """
     ifDesc = _ft.FT_INTERFACE_DESCRIPTOR()
     self.status = call_ft(_ft.FT_GetInterfaceDescriptor, self.handle,
                           _ft.UCHAR(interfaceIndex), c.byref(ifDesc))
     return ifDesc
示例#13
0
 def flushPipe(self, pipe):
     """Flush pipe"""
     self.status = call_ft(_ft.FT_FlushPipe, self.handle, _ft.UCHAR(pipe))
     return None