From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 8/8] test: add a script for GetDiagnostics
Date: Mon, 11 Jan 2021 09:12:39 -0800 [thread overview]
Message-ID: <20210111171239.472372-8-prestwoj@gmail.com> (raw)
In-Reply-To: <20210111171239.472372-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
---
test/get-diagnostics | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100755 test/get-diagnostics
diff --git a/test/get-diagnostics b/test/get-diagnostics
new file mode 100755
index 00000000..c508c58c
--- /dev/null
+++ b/test/get-diagnostics
@@ -0,0 +1,37 @@
+#!/usr/bin/python3
+
+import sys
+import dbus
+
+# Map dict keys to units. Units can be a function/lambda which should return the
+# entire value with units as a string.
+unit_map = {
+ "ConnectedBss" : None,
+ "RSSI" : "dBm",
+ "RxBitrate" : lambda k : str(100 * int(k)) + ' Kbps',
+ "RxMCS" : lambda i : str(int(i)),
+ "TxBitrate" : lambda k : str(100 * int(k)) + ' Kbps',
+ "TxMCS" : lambda i : str(int(i)),
+ "ExpectedThroughput" : "Kbps"
+}
+
+if (len(sys.argv) != 2):
+ print("Usage: %s <device>" % (sys.argv[0]))
+ sys.exit(1)
+
+bus = dbus.SystemBus()
+device = dbus.Interface(bus.get_object("net.connman.iwd", sys.argv[1]),
+ "net.connman.iwd.StationDiagnostic")
+diagnostics = device.GetDiagnostics()
+
+for key, value in diagnostics.items():
+ if key in unit_map:
+ units = unit_map[key]
+ if units is None:
+ units = ''
+ elif callable(units):
+ value = units(value)
+ units = ''
+
+ print('%s : %s %s' % (key, value, units))
+
--
2.26.2
next prev parent reply other threads:[~2021-01-11 17:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 17:12 [PATCH 1/8] doc: diagnostic DBus interface definition James Prestwood
2021-01-11 17:12 ` [PATCH 2/8] netdev: add netdev_get_station James Prestwood
2021-01-11 20:49 ` Denis Kenzior
2021-01-11 20:54 ` James Prestwood
2021-01-11 21:08 ` Denis Kenzior
2021-01-11 17:12 ` [PATCH 3/8] netdev: update RSSI polling to use netdev_get_station James Prestwood
2021-01-11 17:12 ` [PATCH 4/8] netdev: parse rates in netdev_get_station James Prestwood
2021-01-11 17:12 ` [PATCH 5/8] dbus: add diagnostic interface definition James Prestwood
2021-01-11 20:52 ` Denis Kenzior
2021-01-11 17:12 ` [PATCH 6/8] netdev: parse expected throughput in netdev_get_station James Prestwood
2021-01-11 17:12 ` [PATCH 7/8] station: create StationDiagnostic interface James Prestwood
2021-01-11 21:04 ` Denis Kenzior
2021-01-11 17:12 ` James Prestwood [this message]
2021-01-11 20:51 ` [PATCH 1/8] doc: diagnostic DBus interface definition Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210111171239.472372-8-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.