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

minor fix to reset the modem if serial ports not found

parent b48c64d4
...@@ -28,17 +28,21 @@ from lib_autotest import * ...@@ -28,17 +28,21 @@ from lib_autotest import *
def find_open_port(): def find_open_port():
global serial_port, ser global serial_port, ser
max_ports=100 max_ports=100
if os.path.exists(serial_port) == True: while True:
return serial_port if os.path.exists(serial_port) == True:
for port in range(2,100): return serial_port
serial_port = '/dev/ttyUSB'+str(port) for port in range(2,100):
if os.path.exists(serial_port) == True: serial_port_tmp = '/dev/ttyUSB'+str(port)
print 'New Serial Port : ' + serial_port if os.path.exists(serial_port_tmp) == True:
break print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
ser = serial.Serial(port=serial_port) break
return 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' #serial_port = '/dev/ttyUSB2'
......
...@@ -28,16 +28,22 @@ from lib_autotest import * ...@@ -28,16 +28,22 @@ from lib_autotest import *
def find_open_port(): def find_open_port():
global serial_port, ser global serial_port, ser
max_ports=100 max_ports=100
if os.path.exists(serial_port) == True: while True:
return serial_port if os.path.exists(serial_port) == True:
for port in range(0,100): return serial_port
serial_port = '/dev/ttyUSB'+str(port) for port in range(2,100):
if os.path.exists(serial_port) == True: serial_port_tmp = '/dev/ttyUSB'+str(port)
print 'New Serial Port : ' + serial_port if os.path.exists(serial_port_tmp) == True:
break print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
ser = serial.Serial(port=serial_port) break
return 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