aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-08-09 12:00:51 +0200
committerDan Williams <dcbw@redhat.com>2011-08-09 16:49:29 +0200
commitf683391169cf7f143df380779bf69d6b9b3947b8 (patch)
tree29e5b3201b08f27039f073d6ab45bc0671dfecea
parent33a97cdb139059a8f4e2a1fefe9f2c237171caf1 (diff)
test: allow modem numbers in addition to object paths
If the command-line arg doesn't look like an object path, treat it as the modem # and make the object path.
-rwxr-xr-xtest/disable.py5
-rwxr-xr-xtest/enable.py5
-rwxr-xr-xtest/info.py6
-rwxr-xr-xtest/location.py5
-rwxr-xr-xtest/scan.py5
-rwxr-xr-xtest/send-pin.py6
-rwxr-xr-xtest/ussd.py6
7 files changed, 30 insertions, 8 deletions
diff --git a/test/disable.py b/test/disable.py
index 5b8c14a3..4e52cf1d 100755
--- a/test/disable.py
+++ b/test/disable.py
@@ -21,7 +21,10 @@ MM_DBUS_PATH='/org/freedesktop/ModemManager'
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
modem.Enable (False)
diff --git a/test/enable.py b/test/enable.py
index bfe1a6d1..7fa218da 100755
--- a/test/enable.py
+++ b/test/enable.py
@@ -21,7 +21,10 @@ MM_DBUS_PATH='/org/freedesktop/ModemManager'
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
modem.Enable (True)
diff --git a/test/info.py b/test/info.py
index 6659a3a4..82057fa5 100755
--- a/test/info.py
+++ b/test/info.py
@@ -224,8 +224,10 @@ def gsm_inspect(proxy, props):
bus = dbus.SystemBus()
-bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/%s" % str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
# Properties
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
diff --git a/test/location.py b/test/location.py
index b6af3871..96cd1e54 100755
--- a/test/location.py
+++ b/test/location.py
@@ -29,7 +29,10 @@ MM_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI = 0x00000002
MM_MODEM_LOCATION_CAPABILITY_GPS_RAW = 0x00000004
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPERTIES)
diff --git a/test/scan.py b/test/scan.py
index 2b961200..eff470d4 100755
--- a/test/scan.py
+++ b/test/scan.py
@@ -31,7 +31,10 @@ gsm_act = { 0: "(GSM)",
}
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
# Properties
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
diff --git a/test/send-pin.py b/test/send-pin.py
index 3cf47ee3..002f1b09 100755
--- a/test/send-pin.py
+++ b/test/send-pin.py
@@ -33,7 +33,11 @@ if not sys.argv[2].isdigit():
os._exit(1)
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
+
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPS)
req = props.Get(MM_DBUS_INTERFACE_MODEM, "UnlockRequired")
if req == "":
diff --git a/test/ussd.py b/test/ussd.py
index b3528f9d..73b8f8ec 100755
--- a/test/ussd.py
+++ b/test/ussd.py
@@ -27,7 +27,11 @@ else:
arg = sys.argv[2]
bus = dbus.SystemBus()
-proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
+objpath = sys.argv[1]
+if objpath[:1] != '/':
+ objpath = "/org/freedesktop/ModemManager/Modems/" + str(objpath)
+proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
+
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_USSD)
# For testing purposes treat all "common" USSD sequences as initiate and the