summaryrefslogtreecommitdiffstats
path: root/For Weekly Test
diff options
context:
space:
mode:
authortt412011-09-03 01:01:49 +0200
committertt412011-09-03 01:01:49 +0200
commit6fa6d1485b2380fe93c8968733976364f6a23189 (patch)
tree362aa543cddb880cf1de2fcac3cc378316be3836 /For Weekly Test
parentMerge branch 'master' of lab.ks.uni-freiburg.de:lsfks/projekte/gsm-selftest (diff)
downloadgsm-selftest-6fa6d1485b2380fe93c8968733976364f6a23189.tar.gz
gsm-selftest-6fa6d1485b2380fe93c8968733976364f6a23189.tar.xz
gsm-selftest-6fa6d1485b2380fe93c8968733976364f6a23189.zip
add new feature for detecting USB but still in progress, not yet done.
Diffstat (limited to 'For Weekly Test')
-rw-r--r--For Weekly Test/12-09-2011/devicePortList.log1
-rw-r--r--For Weekly Test/12-09-2011/dmesg.log8
-rw-r--r--For Weekly Test/12-09-2011/usbDetect.py150
3 files changed, 159 insertions, 0 deletions
diff --git a/For Weekly Test/12-09-2011/devicePortList.log b/For Weekly Test/12-09-2011/devicePortList.log
new file mode 100644
index 0000000..16ad7c7
--- /dev/null
+++ b/For Weekly Test/12-09-2011/devicePortList.log
@@ -0,0 +1 @@
+[O2] [/dev/ttyUSB1]
diff --git a/For Weekly Test/12-09-2011/dmesg.log b/For Weekly Test/12-09-2011/dmesg.log
new file mode 100644
index 0000000..653c5f5
--- /dev/null
+++ b/For Weekly Test/12-09-2011/dmesg.log
@@ -0,0 +1,8 @@
+[ 5587.149816] usb 2-1.2: pl2303 converter now attached to ttyUSB0
+[ 5700.233641] usb 2-1.2: pl2303 converter now attached to ttyUSB0
+[ 5736.494612] usb 2-1.4: pl2303 converter now attached to ttyUSB1
+[ 6294.456248] usb 2-1.1: pl2303 converter now attached to ttyUSB0
+[ 7701.796802] usb 2-1.2: pl2303 converter now attached to ttyUSB0
+[ 8875.087711] usb 2-1.2: pl2303 converter now attached to ttyUSB0
+[ 9604.128581] usb 2-1.2: pl2303 converter now attached to ttyUSB0
+[19245.501608] usb 2-1.4: pl2303 converter now attached to ttyUSB1
diff --git a/For Weekly Test/12-09-2011/usbDetect.py b/For Weekly Test/12-09-2011/usbDetect.py
new file mode 100644
index 0000000..311ebb2
--- /dev/null
+++ b/For Weekly Test/12-09-2011/usbDetect.py
@@ -0,0 +1,150 @@
+from serial import * #serial port library
+import sys
+
+def initLog():
+ portLog = os.popen('dmesg | grep \'pl2303 converter now attached to ttyUSB\'').read()
+
+ dmesgfile = open('dmesg.log', 'w')
+ dmesgfile.write(portLog)
+ dmesgfile.close()
+
+def initLine():
+ global i
+ logfile = open('dmesg.log')
+ i = 0
+
+ while 1:
+ line = logfile.readline()
+
+ if not line:
+ break
+ i = i+1
+ logfile.close()
+
+def initPort():
+ global lines
+ x = 0
+ logfile = open('dmesg.log')
+ while 1:
+ line = logfile.readline()
+ x = x+1
+ if not line:
+ break
+ if x == i:
+ lines = line
+ logfile.close()
+
+def newConf(device):
+
+ portDev = '[/dev/'+port+']\n'
+ file.write('['+device+'] ')
+ file.writelines(portDev)
+
+def searchList():
+ global found
+ for item in portList:
+ if item[1] == port:
+ found = 1
+ else:
+ found = 0
+def initO2():
+
+ print "pluged in, O2 Mobile Device [then Enter]"
+ input = sys.stdin.readline().rstrip("\r\n")
+ scanPort()
+ portList.append(['O2', port])
+ newConf('O2')
+
+def initVoda():
+
+ print "pluged in, Vodaphone Mobile Device [then Enter]"
+ input = sys.stdin.readline().rstrip("\r\n")
+ scanPort()
+ searchList()
+ if found == 1:
+ initRepeat()
+ if found == 0:
+ portList.append(['Voda', port])
+ newConf('Voda')
+ if repeat == True:
+ initVoda()
+
+def initEplus():
+ print "pluged in, Eplus Mobile Device [then Enter]"
+ input = sys.stdin.readline().rstrip("\r\n")
+ scanPort()
+
+ searchList()
+ if found == 1:
+ initRepeat()
+ if found == 0:
+ portList.append(['Eplus', port])
+ newConf('Eplus')
+ if repeat == True:
+ initEplus()
+
+def initTmobile():
+
+ print "pluged in, T-Mobile Mobile Device [then Enter]"
+ input = sys.stdin.readline().rstrip("\r\n")
+ scanPort()
+ searchList()
+ if found == 1:
+ initRepeat()
+ if found == 0:
+ portList.append(['Tm', port])
+ newConf('Tm')
+ if repeat == True:
+ initTmobile()
+
+def initRepeat():
+ global repeat
+ while True:
+ print 'No new device has pluged in'
+ print 't = try again, i = ignore, q = quit'
+ input = sys.stdin.readline().rstrip("\r\n")
+ if input == 'i':
+ repeat = False
+ break
+ elif input == 'q':
+ file.close()
+ sys.exit()
+ elif input == 't':
+ repeat = True
+ break
+
+def scanPort():
+ global port
+ initLog()
+ initLine()
+ initPort()
+ port = str(lines[59:66])
+
+
+global file
+global portList
+portList = list()
+while True:
+ print "Mobile device port configuration"
+ print "Menu: n = make new configuration, q = quit"
+
+ input = sys.stdin.readline().rstrip("\r\n")
+ if input == "n":
+ file = open('devicePortList.log', 'w')
+ print "== Pluged Out all mobile devices [then Enter] =="
+ input = sys.stdin.readline().rstrip("\r\n")
+
+ initO2()
+ initVoda()
+ initEplus()
+ initTmobile()
+
+ file.close()
+
+ if input == "q":
+ break
+
+
+
+
+