def test_multiple_interface(self): # the following calls used to create issues (several interfaces from # the same device). The test expects an FTDI 2232H here ftdi1 = Ftdi() ftdi1.open(vendor=0x403, product=0x6010, interface=1) ftdi2 = Ftdi() ftdi2.open(vendor=0x403, product=0x6010, interface=2) for _ in range(5): print("If#1: ", hex(ftdi1.poll_modem_status())) print("If#2: ", ftdi2.modem_status()) sleep(0.500) ftdi1.close() ftdi2.close()
def test_multiple_interface(self): # the following calls used to create issues (several interfaces from # the same device) ftdi1 = Ftdi() ftdi1.open(interface=1) ftdi2 = Ftdi() ftdi2.open(interface=2) import time for x in range(5): print "If#1: ", hex(ftdi1.poll_modem_status()) print "If#2: ", ftdi2.modem_status() time.sleep(0.500) ftdi1.close() ftdi2.close()
def test_multiple_interface(self): # the following calls used to create issues (several interfaces from # the same device). The test expect an FTDI 2232H here ftdi1 = Ftdi() ftdi1.open(vendor=0x403, product=0x6010, interface=1) ftdi2 = Ftdi() ftdi2.open(vendor=0x403, product=0x6010, interface=2) import time for x in range(5): print "If#1: ", hex(ftdi1.poll_modem_status()) print "If#2: ", ftdi2.modem_status() time.sleep(0.500) ftdi1.close() ftdi2.close()
ft.purge_tx_buffer() ft.purge_rx_buffer() ft.set_break(False) #ft.set_flowctrl() ft.read_data_bytes(5).tolist() fifo_wr = [] for i in range(N): aux = (i + 1) % 256 aux = randint(0, 255) fifo_wr.append(aux) print("______________") print("CTS? {}\tDSR? {}\tRI? {}".format(ft.get_cts(), ft.get_dsr(), ft.get_ri())) print("Poll Modem status? {}\tModem Status? {}".format( ft.poll_modem_status(), ft.modem_status())) print("______________") print("\twrite: " + str(ft.write_data(bytes([aux]))), aux) time.sleep(0.01) aux = ft.read_data_bytes(5).tolist() if (len(aux) > 0): print("\tread = {}".format(aux)) fifo_rd = fifo_rd + aux else: print("\t...") print("\n... Reading more...") while True: time.sleep(2) aux = ft.read_data_bytes(1).tolist() if (len(aux) == 0): break