iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 3/5] auto-t: allow printing devices in AP mode
Date: Wed, 26 Oct 2022 11:56:54 -0700	[thread overview]
Message-ID: <20221026185656.489888-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20221026185656.489888-1-prestwoj@gmail.com>

The __str__ function assumed station mode which throws an exception
if the device is in AP mode. Fix this as well as print out the mode
the device is in.
---
 autotests/util/iwd.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index a9e2f2f5..9e96382a 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -690,14 +690,17 @@ class Device(IWDDBusAbstract):
         return self._device_provisioning.stop()
 
     def __str__(self, prefix = ''):
-        return prefix + 'Device: ' + self.device_path + '\n'\
+        s = prefix + 'Device: ' + self.device_path + '\n'\
                + prefix + '\tName:\t\t' + self.name + '\n'\
-               + prefix + '\tAddress:\t' + self.address + '\n'\
-               + prefix + '\tState:\t\t' + str(self.state) + '\n'\
+               + prefix + '\tAddress:\t' + self.address + '\n' \
                + prefix + '\tPowered:\t' + str(self.powered) + '\n'\
-               + prefix + '\tConnected net:\t' + str(self.connected_network) +\
-                                                                            '\n'
+               + prefix + '\tMode:\t\t' + self._properties['Mode'] + '\n'
 
+        if self._properties['Mode'] == 'station':
+            s += prefix + '\tState:\t\t' + str(self.state) + '\n'\
+               + prefix + '\tConnected net:\t' + str(self.connected_network) + '\n'
+
+        return s
 
 class Network(IWDDBusAbstract):
     '''Class represents a network object: net.connman.iwd.Network'''
-- 
2.34.3


  parent reply	other threads:[~2022-10-26 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 18:56 [PATCH 1/5] eapol: choose key descriptor version in AP mode James Prestwood
2022-10-26 18:56 ` [PATCH 2/5] auto-t: fix get_ordered_network if hostapd isn't running James Prestwood
2022-10-26 18:56 ` James Prestwood [this message]
2022-10-26 18:56 ` [PATCH 4/5] unit: test-arc4: test RC4 both directions James Prestwood
2022-10-26 18:56 ` [PATCH 5/5] eapol: add TKIP support in AP mode James Prestwood
2022-10-26 19:55 ` [PATCH 1/5] eapol: choose key descriptor version " 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=20221026185656.489888-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).