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.
This commit is contained in:
@@ -21,7 +21,10 @@ MM_DBUS_PATH='/org/freedesktop/ModemManager'
|
|||||||
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
|
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
||||||
modem.Enable (False)
|
modem.Enable (False)
|
||||||
|
|
||||||
|
@@ -21,7 +21,10 @@ MM_DBUS_PATH='/org/freedesktop/ModemManager'
|
|||||||
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
|
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
||||||
modem.Enable (True)
|
modem.Enable (True)
|
||||||
|
|
||||||
|
@@ -224,8 +224,10 @@ def gsm_inspect(proxy, props):
|
|||||||
|
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
bus = dbus.SystemBus()
|
objpath = sys.argv[1]
|
||||||
proxy = bus.get_object(MM_DBUS_SERVICE, sys.argv[1])
|
if objpath[:1] != '/':
|
||||||
|
objpath = "/org/freedesktop/ModemManager/Modems/%s" % str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
||||||
|
@@ -29,7 +29,10 @@ MM_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI = 0x00000002
|
|||||||
MM_MODEM_LOCATION_CAPABILITY_GPS_RAW = 0x00000004
|
MM_MODEM_LOCATION_CAPABILITY_GPS_RAW = 0x00000004
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_MODEM)
|
||||||
|
|
||||||
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPERTIES)
|
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPERTIES)
|
||||||
|
@@ -31,7 +31,10 @@ gsm_act = { 0: "(GSM)",
|
|||||||
}
|
}
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
props = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
||||||
|
@@ -33,7 +33,11 @@ if not sys.argv[2].isdigit():
|
|||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
|
|
||||||
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPS)
|
props = dbus.Interface(proxy, dbus_interface=DBUS_INTERFACE_PROPS)
|
||||||
req = props.Get(MM_DBUS_INTERFACE_MODEM, "UnlockRequired")
|
req = props.Get(MM_DBUS_INTERFACE_MODEM, "UnlockRequired")
|
||||||
if req == "":
|
if req == "":
|
||||||
|
@@ -27,7 +27,11 @@ else:
|
|||||||
arg = sys.argv[2]
|
arg = sys.argv[2]
|
||||||
|
|
||||||
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/" + str(objpath)
|
||||||
|
proxy = bus.get_object(MM_DBUS_SERVICE, objpath)
|
||||||
|
|
||||||
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_USSD)
|
modem = dbus.Interface(proxy, dbus_interface=MM_DBUS_INTERFACE_USSD)
|
||||||
|
|
||||||
# For testing purposes treat all "common" USSD sequences as initiate and the
|
# For testing purposes treat all "common" USSD sequences as initiate and the
|
||||||
|
Reference in New Issue
Block a user