Ejemplo n.º 1
0
def connect_test(serobj):
    try:
        serobj.open()
        if serobj.isOpen():
            testlib.passmessage("Opened serial port")
            return True
        else:
            testlib.failmessage("Can't open serial port")
            return False
    except:
        testlib.failmessage("Can't open serial port")
        return False
Ejemplo n.º 2
0
def setorder(portlist):
    revlist = []
    portlist = setbaud(portlist, stdbauds[0])
    if looptest(portlist):
        return portlist
    else:
        revlist.append(portlist[1])
        revlist.append(portlist[0])
    if looptest(revlist):
        return revlist
    else:
        testlib.failmessage('No port order seems to work')
        return portlist
Ejemplo n.º 3
0
def setorder(portlist):
    revlist = []
    portlist = setbaud(portlist,stdbauds[0])
    if looptest(portlist):
        return portlist
    else:
        revlist.append(portlist[1])
        revlist.append(portlist[0])
    if looptest(revlist):
        return revlist
    else:
        testlib.failmessage('No port order seems to work')
        return portlist
Ejemplo n.º 4
0
def main():
    portlist = getports()
    if (len(portlist) == 2):
        testlib.passmessage('Found two serial ports')
    else:
        # If we don't find two serial ports, this test is over
        testlib.failmessage('Did not find two serial ports')
        return -1
    testlib.infomessage(portlist[0].name + '  --> ' + portlist[1].name)
    for rate in stdbauds:
        portlist = setbaud(portlist, rate)
        time.sleep(1)  # Allow 1 second for baud configuration
        retval = looptest(portlist)
        if retval:
            testlib.passmessage(str(int(rate)) + ' baud loopback ok')
        else:
            testlib.failmessage(str(int(rate)) + ' baud loopback error')
Ejemplo n.º 5
0
def main():
    portlist = getports()
    if (len(portlist) == 2):
        testlib.passmessage('Found two serial ports')
    else:
        # If we don't find two serial ports, this test is over
        testlib.failmessage('Did not find two serial ports')
        return -1
    testlib.infomessage(portlist[0].name + '  --> ' + portlist[1].name)
    for rate in stdbauds:
        portlist = setbaud(portlist,rate)
        time.sleep(1) # Allow 1 second for baud configuration
        retval = looptest(portlist)
        if retval:
            testlib.passmessage(str(int(rate)) + ' baud loopback ok')
        else:
            testlib.failmessage(str(int(rate)) + ' baud loopback error')