[PATCH v1] test: Add optional modem path argument to volume scripts
Shuai Zhang <[email protected]> Fri, 17 Jul 2026 16:06:05 +0800
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
set-mic-volume and set-speaker-volume scripts hardcode the call
path to modems[0][0], the first modem in the list. When the DUT is
paired with multiple devices and the active call is not on
modem[0], the scripts fail to target the correct modem.
Add an optional modem path first argument to both scripts,
following the same pattern already used in hangup-all, allowing
the caller to explicitly specify the target modem path.
---
test/set-mic-volume | 8 +++++++-
test/set-speaker-volume | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/test/set-mic-volume b/test/set-mic-volume
index cd6c73fa..4cdf2c99 100755
--- a/test/set-mic-volume
+++ b/test/set-mic-volume
@@ -11,7 +11,13 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
path = modems[0][0]
+if (len(sys.argv) == 3):
+ path = sys.argv[1]
+ volume = sys.argv[2]
+else:
+ volume = sys.argv[1]
+
cv = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CallVolume')
-cv.SetProperty("MicrophoneVolume", dbus.Byte(int(sys.argv[1])))
+cv.SetProperty("MicrophoneVolume", dbus.Byte(int(volume)))
diff --git a/test/set-speaker-volume b/test/set-speaker-volume
index 6d4e3019..3f468da0 100755
--- a/test/set-speaker-volume
+++ b/test/set-speaker-volume
@@ -11,7 +11,13 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
path = modems[0][0]
+if (len(sys.argv) == 3):
+ path = sys.argv[1]
+ volume = sys.argv[2]
+else:
+ volume = sys.argv[1]
+
cv = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CallVolume')
-cv.SetProperty("SpeakerVolume", dbus.Byte(int(sys.argv[1])))
+cv.SetProperty("SpeakerVolume", dbus.Byte(int(volume)))
--
2.34.1