Skip to contentSkip to conversation

python test scripts

PATCH In review Ryan M. Raasch 3 participants 11 messages Oct 29, 2009

lore
Share & tools
lore
#0 lore raw

cover python test scripts

Hello,

Python script to enter a pin number to unlock the sim card.

Regards,
Ryan

 test/enable-modem |    6 +++++-
 test/enable-sim   |   18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletions(-)
 create mode 100755 test/enable-sim
#1 lore raw

PATCH 1/2 Added functionality to remove modem from system, if needed.

---
 test/enable-modem |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
test/enable-modem +5 -1
index 0f9f604..d44783d 100755
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import sys
 
 bus = dbus.SystemBus()
 
@@ -14,4 +15,7 @@ path = properties["Modems"][0]
 modem = dbus.Interface(bus.get_object('org.ofono', path),
 						'org.ofono.Modem')
 
-modem.SetProperty("Powered", dbus.Boolean(1))
+if len(sys.argv) > 1 and sys.argv[1] == '0' :
+    modem.SetProperty("Powered", dbus.Boolean(0))
+else :
+    modem.SetProperty("Powered", dbus.Boolean(1))
Signature · 1 line
1.6.4.GIT
#2 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

Hi Ryan,

Quoted 17 lines
---
 test/enable-modem |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
test/enable-modem +1 -0
index 0f9f604..d44783d 100755
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import sys
 
 bus = dbus.SystemBus()
 

test/enable-modem path = properties["Modems"][0] · line 21

Quoted 8 lines
test/enable-modem +4 -1
@@ -14,4 +15,7 @@ path = properties["Modems"][0]
 modem = dbus.Interface(bus.get_object('org.ofono', path),
 						'org.ofono.Modem')
 
-modem.SetProperty("Powered", dbus.Boolean(1))
+if len(sys.argv) > 1 and sys.argv[1] == '0' :
+    modem.SetProperty("Powered", dbus.Boolean(0))
+else :
+    modem.SetProperty("Powered", dbus.Boolean(1))

if you want this, then add a disable-modem script.

Regards

Marcel

#3 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

Quoted 22 lines · Marcel Holtmann

Hi Ryan,

Quoted 20 lines
---
 test/enable-modem |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
test/enable-modem +1 -0
index 0f9f604..d44783d 100755
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import sys
 
 bus = dbus.SystemBus()
 
@@ -14,4 +15,7 @@ path = properties["Modems"][0]
 modem = dbus.Interface(bus.get_object('org.ofono', path),
 						'org.ofono.Modem')
 
Quoted 7 lines

test/enable-modem path = properties["Modems"][0] · line 21

Quoted 5 lines
test/enable-modem +4 -1
-modem.SetProperty("Powered", dbus.Boolean(1))
+if len(sys.argv) > 1 and sys.argv[1] == '0' :
+    modem.SetProperty("Powered", dbus.Boolean(0))
+else :
+    modem.SetProperty("Powered", dbus.Boolean(1))

if you want this, then add a disable-modem script.

Ok. If no one else thinks it may be needed, i won't. In my case, i thought it would be helpful to see what happens to the system to remove a modem out of the system, ie. power off. I would be nice to be able to set a toggle power to the modem, and allow the daemon to be in the correct state to recover.

I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state.

Greetings,
Ryan

Quoted 10 lines

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#4 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

Hi Ryan,

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
 test/enable-modem |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
test/enable-modem +1 -0
index 0f9f604..d44783d 100755
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import sys
 
 bus = dbus.SystemBus()
 
@@ -14,4 +15,7 @@ path = properties["Modems"][0]
 modem = dbus.Interface(bus.get_object('org.ofono', path),
 						'org.ofono.Modem')
 
Quoted 7 lines

test/enable-modem path = properties["Modems"][0] · line 21

Quoted 5 lines
test/enable-modem +4 -1
-modem.SetProperty("Powered", dbus.Boolean(1))
+if len(sys.argv) > 1 and sys.argv[1] == '0' :
+    modem.SetProperty("Powered", dbus.Boolean(0))
+else :
+    modem.SetProperty("Powered", dbus.Boolean(1))

if you want this, then add a disable-modem script.

Quoted 5 lines

Ok. If no one else thinks it may be needed, i won't. In my case, i thought it would be helpful to see what happens to the system to remove a modem out of the system, ie. power off. I would be nice to be able to set a toggle power to the modem, and allow the daemon to be in the correct state to recover.

I am fine with disable-modem script. I just never needed it so far. Otherwise it would have been there.

Quoted 3 lines

I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state.

Weird. Might need some udev magic to do the right thing. Or some special handling inside the plugin.

Regards

Marcel

#5 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

Quoted 36 lines · Marcel Holtmann

Hi Ryan,

Quoted 25 lines
Quoted 19 lines
Quoted 19 lines
 test/enable-modem |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
test/enable-modem +1 -0
index 0f9f604..d44783d 100755
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import sys
 
 bus = dbus.SystemBus()
 
@@ -14,4 +15,7 @@ path = properties["Modems"][0]
 modem = dbus.Interface(bus.get_object('org.ofono', path),
 						'org.ofono.Modem')
 
Quoted 6 lines

test/enable-modem path = properties["Modems"][0] · line 21

Quoted 5 lines
test/enable-modem +4 -1
-modem.SetProperty("Powered", dbus.Boolean(1))
+if len(sys.argv) > 1 and sys.argv[1] == '0' :
+    modem.SetProperty("Powered", dbus.Boolean(0))
+else :
+    modem.SetProperty("Powered", dbus.Boolean(1))

if you want this, then add a disable-modem script.

Quoted 5 lines

Ok. If no one else thinks it may be needed, i won't. In my case, i thought it would be helpful to see what happens to the system to remove a modem out of the system, ie. power off. I would be nice to be able to set a toggle power to the modem, and allow the daemon to be in the correct state to recover.

I am fine with disable-modem script. I just never needed it so far. Otherwise it would have been there.

Quoted 6 lines
Quoted 3 lines

I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state.

Weird. Might need some udev magic to do the right thing. Or some special handling inside the plugin.

Yea. I haven't looked at that part of the code, only that AT+CRC is the first command sent (if i remember right). Our modem sends a ^SYSSTART on powerup, what causes ofonod to go back to its initial state?

What is the "normal" start-up string for modems (i was told mc75 doesn't really abide the norm) ?

Thanks,
Ryan

Quoted 10 lines

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

#6 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

Hi Ryan,

Quoted 3 lines

Yea. I haven't looked at that part of the code, only that AT+CRC is the first command sent (if i remember right). Our modem sends a ^SYSSTART on powerup, what causes ofonod to go back to its initial state?

The core has no idea, everything is up to the modem driver. Only the driver knows when the powered up / down events happened. The driver is responsible for informing the core.

Quoted 3 lines

What is the "normal" start-up string for modems (i was told mc75 doesn't really abide the norm) ?

There isn't one, they are all different.

Regards,
-Denis

#7 lore raw

Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.

In reply to Marcel Holtmann

Hi,

Quoted 6 lines
Quoted 3 lines

I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state.

Weird. Might need some udev magic to do the right thing. Or some special handling inside the plugin.

What kind of modem is this? If it is a UART modem then udev won't help here. Custom plugin handling is required.

Regards,
-Denis

#8 lore raw

PATCH 2/2 This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.

In reply to Ryan M. Raasch
---
 test/enable-sim |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100755 test/enable-sim
test/enable-sim new file +18 -0
new file mode 100755
index 0000000..bbfd34f
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+						'org.ofono.Manager')
+
+properties = manager.GetProperties()
+
+path = properties["Modems"][0]
+
+modem = dbus.Interface(bus.get_object('org.ofono', path),
+						'org.ofono.SimManager')
+
+modem.EnterPin(sys.argv[1], sys.argv[2])
Signature · 1 line
1.6.4.GIT
#9 lore raw

Re: [PATCH 2/2] This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.

Hi Ryan,

Quoted 19 lines
---
 test/enable-sim |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100755 test/enable-sim
test/enable-sim new file +8 -0
new file mode 100755
index 0000000..bbfd34f
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),

test/enable-sim line 18

Quoted 10 lines
test/enable-sim new file +10 -0
+						'org.ofono.Manager')
+
+properties = manager.GetProperties()
+
+path = properties["Modems"][0]
+
+modem = dbus.Interface(bus.get_object('org.ofono', path),
+						'org.ofono.SimManager')
+
+modem.EnterPin(sys.argv[1], sys.argv[2])

call this script enter-pin and have it check if a PIN is actually required.

Regards

Marcel

#10 lore raw

Re: [PATCH 2/2] This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.

Quoted 26 lines · Marcel Holtmann

Hi Ryan,

Quoted 24 lines
---
 test/enable-sim |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100755 test/enable-sim
test/enable-sim new file +13 -0
new file mode 100755
index 0000000..bbfd34f
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+						'org.ofono.Manager')
+
+properties = manager.GetProperties()
+
+path = properties["Modems"][0]
Quoted 9 lines

test/enable-sim line 18

Quoted 5 lines
test/enable-sim new file +5 -0
+
+modem = dbus.Interface(bus.get_object('org.ofono', path),
+						'org.ofono.SimManager')
+
+modem.EnterPin(sys.argv[1], sys.argv[2])

call this script enter-pin and have it check if a PIN is actually required.

No prob.

Thanks,
Ryan

Quoted 9 lines

Regards

Marcel

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono