From c3f3d1ac96037d4aa78bda8baad2435b4b01d2b6 Mon Sep 17 00:00:00 2001
From: Rohit Gupta <rohit.gupta@eurecom.fr>
Date: Tue, 10 Nov 2015 16:27:32 +0100
Subject: [PATCH]  fixed a bug to search for an open port

---
 .../autotests/tools/configure_cots_bandrich_ue.py   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
index 7cc1f20f53..7ba02bc0b1 100644
--- a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
@@ -7,9 +7,20 @@ import re
 import threading
 import signal
 import traceback
+import os
 
 # configure the serial connections (the parameters differs on the device you are connecting to)
-serial_port = '/dev/ttyUSB2'
+#First we find an open port to work with
+serial_port=''
+max_ports=100
+for port in range(1,100):
+  serial_port = '/dev/ttyUSB'+str(port)
+  if os.path.exists(serial_port) == True:
+     break
+
+print 'Using Serial port : ' + serial_port  
+    
+#serial_port = '/dev/ttyUSB2'
 bandrich_ppd_config = '$OPENAIR_DIR/cmake_targets/autotests/tools/wdial.bandrich.conf'
 
 exit_flag=0
-- 
GitLab