* [PATCH] test: fix list-modems hang & simplify handling of Byte/Bool properties
@ 2025-12-10 3:59 Andres Salomon
0 siblings, 0 replies; only message in thread
From: Andres Salomon @ 2025-12-10 3:59 UTC (permalink / raw)
To: ofono
From 690d6af7b672d883bd7d7b86435ddcfad5bdc15d Mon Sep 17 00:00:00 2001
From: Andres Salomon <dilinger@queued.net>
Date: Tue, 9 Dec 2025 22:36:16 -0500
Subject: [PATCH] test: fix list-modems hang & simplify handling of Byte/Bool
properties
Using list-modems with current phonesim (2.0) results in list-modems
hanging while trying to print SimToolkit's IdleModeIcon property. No
errors; it just silently hangs. The issue is that it's a dbus.Byte with
the value b'0' (which python implicitly converts to something that makes
its i/o and string handling deeply unhappy).
It's unpleasant to have to special-case every dbus.Byte property value,
so instead let's display Bytes based on their type. That will help
future-proof this script as new properties get added to interfaces.
While we're at it, also stop implicitly converting dbus.Boolean values
to "1"/"0", and use "TRUE"/"FALSE" to make it clearer that they are
bools.
A small sample of what list-modem's output looks like with phonesim:
task-0: [ org.ofono.SimToolkit ]
task-0: IdleModeText =
task-0: IdleModeIcon = 0
task-0: MainMenuTitle =
task-0: MainMenuIcon = 0
task-0: MainMenu =
task-0: [ org.ofono.MessageWaiting ]
task-0: VoicemailWaiting = TRUE
task-0: VoicemailMessageCount = 1
task-0: VoicemailMailboxNumber = 6789
task-0: [ org.ofono.SimAuthentication ]
task-0: NetworkAccessIdentity = 12345678@phonesim.org
---
test/list-modems | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/test/list-modems b/test/list-modems
index a163791e..1b262482 100755
--- a/test/list-modems
+++ b/test/list-modems
@@ -50,14 +50,6 @@ for path, properties in modems:
for i in properties[key]:
val += "[" + i + "] = '"
val += properties[key][i] + "' "
- elif key in ["MobileNetworkCodeLength",
- "VoicemailMessageCount",
- "MicrophoneVolume",
- "SpeakerVolume",
- "Strength",
- "DataStrength",
- "BatteryChargeLevel"]:
- val = int(properties[key])
elif key in ["MainMenu"]:
val = ", ".join([ text + " (" + str(int(icon)) +
")" for text, icon in properties[key] ])
@@ -76,6 +68,10 @@ for path, properties in modems:
else:
val += properties[key][i]
val += " }"
+ elif type(properties[key]) == dbus.Byte:
+ val = int(properties[key])
+ elif type(properties[key]) == dbus.Boolean:
+ val = str(bool(properties[key])).upper()
else:
val = properties[key]
print(" %s = %s" % (key, val))
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-10 4:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 3:59 [PATCH] test: fix list-modems hang & simplify handling of Byte/Bool properties Andres Salomon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox