summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/gsmselftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/Advance/gsmselftest.py')
-rwxr-xr-xFor Weekly Test/Advance/gsmselftest.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/For Weekly Test/Advance/gsmselftest.py b/For Weekly Test/Advance/gsmselftest.py
index 9874ce6..6f1fa7c 100755
--- a/For Weekly Test/Advance/gsmselftest.py
+++ b/For Weekly Test/Advance/gsmselftest.py
@@ -178,7 +178,7 @@ def findPort(portName): # take information in existing usb port
else:
connect = 0
-def initDevice(deviceName):
+def initDevice(deviceName): # Manual init device
print 'Device Name :',deviceName
print ' Device IMEI : ',
imei = sys.stdin.readline().rstrip("\r\n")
@@ -187,28 +187,25 @@ def initDevice(deviceName):
print 'Port Name : /dev/',
portName = sys.stdin.readline().rstrip("\r\n")
print ''
-
- if deviceName == 'GSMRZ2' or deviceName == 'GSMRZ2':
- if number =='':
- print ' == cant save device configuration, number missing =='
- else:
- portClass.initUpdate(deviceName, portName, number)
+
+ if imei == '' or portName == '':
+ print ' == cant save device configuration, please fill IMEI / port name of the device =='
else:
- if imei == '' or portName == '':
- print ' == cant save device configuration, please fill IMEI / port name of the device =='
+ findPort(portName)
+ if connect == 1:
+ if str(IMEI) != str(imei) and str(num) != str(number):
+ print '== error, device not found IMEI and Number doesnt match =='
+ elif str(IMEI) == str(imei):
+ if number == '':
+ print ' == cant save device configuration, number missing =='
+ else:
+ portClass.initUpdate(deviceName, portName, number) # update device database
+ print '== Device succeced added, please re-check the number =='
+ elif str(num) == str(number) and str(IMEI) != str(imei):
+ portClass.initUpdate(deviceName, portName, number) # update device database
+ print '== Device succeced added, but have different IMEI =='
else:
- findPort(portName)
- if connect == 1:
- if str(IMEI) != str(imei) and str(num) != str(number):
- print '== error, device not found =='
- elif str(IMEI) == str(imei):
- portClass.initUpdate(deviceName, portName, number)
- print '== Device succeced added =='
- elif str(num) == str(number) and str(IMEI) != str(imei):
- portClass.initUpdate(deviceName, portName, number)
- print '== Device succeced added, but have different IMEI =='
- else:
- print '== error, no device connected =='
+ print '== error, no device connected =='
def autoUpdateDevice():
@@ -253,7 +250,7 @@ def updateDevice(): #update port name list of device on DB
print " 5. GSM RZ 1"
print " 6. Back to menu"
print ""
- print "your choise : ",
+ print "your choice : ",
input = sys.stdin.readline().rstrip("\r\n")
if input == '8':