示例#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
示例#2
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')
示例#3
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')