def BulkRead(self, numbytes, timeout=None): t = self.TimeoutSeconds(timeout) readable, _, _ = select.select([self._connection], [], [], t) if readable: return self._connection.recv(numbytes) msg = 'Reading from {} timed out (Timeout {}s)'.format( self._serial_number, t) raise usb_exceptions.TcpTimeoutException(msg)
def BulkWrite(self, data, timeout=None): t = self.TimeoutSeconds(timeout) _, writeable, _ = select.select([], [self._connection], [], t) if writeable: return self._connection.send(data) msg = 'Sending data to {} timed out after {}s. No data was sent.'.format( self.serial_number, t) raise usb_exceptions.TcpTimeoutException(msg)