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

minor fix to reset the modem if serial ports not found

parent b48c64d4
...@@ -28,19 +28,23 @@ from lib_autotest import * ...@@ -28,19 +28,23 @@ 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
while True:
if os.path.exists(serial_port) == True: if os.path.exists(serial_port) == True:
return serial_port return serial_port
for port in range(2,100): for port in range(2,100):
serial_port = '/dev/ttyUSB'+str(port) serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port) == True: if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
break 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) ser = serial.Serial(port=serial_port)
return return
#serial_port = '/dev/ttyUSB2' #serial_port = '/dev/ttyUSB2'
bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf' bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf'
......
...@@ -28,19 +28,25 @@ from lib_autotest import * ...@@ -28,19 +28,25 @@ 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
while True:
if os.path.exists(serial_port) == True: if os.path.exists(serial_port) == True:
return serial_port return serial_port
for port in range(0,100): for port in range(2,100):
serial_port = '/dev/ttyUSB'+str(port) serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port) == True: if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port print 'New Serial Port : ' + serial_port_tmp
serial_port = serial_port_tmp
break 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) ser = serial.Serial(port=serial_port)
return return
#serial_port = '/dev/ttyUSB2' #serial_port = '/dev/ttyUSB2'
bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf' bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf'
......
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