Commit 8cfe28f6 authored by Rohit Gupta's avatar Rohit Gupta

minor fix to reset the modem if serial ports not found

parent b48c64d4
......@@ -28,17 +28,21 @@ from lib_autotest import *
def find_open_port():
global serial_port, ser
max_ports=100
if os.path.exists(serial_port) == True:
return serial_port
for port in range(2,100):
serial_port = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port) == True:
print 'New Serial Port : ' + serial_port
break
ser = serial.Serial(port=serial_port)
return
while True:
if os.path.exists(serial_port) == True:
return serial_port
for port in range(2,100):
serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
break
if serial_port == '':
print" Not able to detect valid serial ports. Resetting the modem now..."
reset_ue()
else :
ser = serial.Serial(port=serial_port)
return
#serial_port = '/dev/ttyUSB2'
......
......@@ -28,16 +28,22 @@ from lib_autotest import *
def find_open_port():
global serial_port, ser
max_ports=100
if os.path.exists(serial_port) == True:
return serial_port
for port in range(0,100):
serial_port = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port) == True:
print 'New Serial Port : ' + serial_port
break
ser = serial.Serial(port=serial_port)
return
while True:
if os.path.exists(serial_port) == True:
return serial_port
for port in range(2,100):
serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
break
if serial_port == '':
print" Not able to detect valid serial ports. Resetting the modem now..."
reset_ue()
else :
ser = serial.Serial(port=serial_port)
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment