From 1f9d9e1eb1b15b14839c90bb15ba23df183475be Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 26 Oct 2022 11:56:54 -0700 Subject: [PATCH] auto-t: allow printing devices in AP mode 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'''