* [PATCH 2/4] ap: update Scanning property when AP starts
2022-11-03 17:00 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
@ 2022-11-03 17:00 ` James Prestwood
2022-11-03 17:00 ` [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode James Prestwood
2022-11-03 17:00 ` [PATCH 4/4] auto-t: add test for scanning " James Prestwood
2 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2022-11-03 17:00 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
This wasn't being updated meaning the property is missing until a
scan is issued over DBus.
Rather than duplicate all the property changed calls they were all
factored out into a helper function.
---
src/ap.c | 55 +++++++++++++++++++++++++------------------------------
1 file changed, 25 insertions(+), 30 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index 9c82a545..34a47f17 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -3666,6 +3666,28 @@ bool ap_push_button(struct ap_state *ap)
return true;
}
+static void ap_properties_changed(struct ap_if_data *ap_if)
+{
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Started");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Name");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Frequency");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "PairwiseCiphers");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "GroupCipher");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Scanning");
+}
+
struct ap_if_data {
struct netdev *netdev;
struct ap_state *ap;
@@ -3703,21 +3725,8 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
reply = l_dbus_message_new_method_return(ap_if->pending);
dbus_pending_reply(&ap_if->pending, reply);
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Started");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Name");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Frequency");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "PairwiseCiphers");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "GroupCipher");
+
+ ap_properties_changed(ap_if);
l_rtnl_set_linkmode_and_operstate(rtnl,
netdev_get_ifindex(ap_if->netdev),
@@ -3730,21 +3739,7 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
netdev_get_path(ap_if->netdev),
IWD_AP_DIAGNOSTIC_INTERFACE);
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Started");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Name");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "Frequency");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "PairwiseCiphers");
- l_dbus_property_changed(dbus_get_bus(),
- netdev_get_path(ap_if->netdev),
- IWD_AP_INTERFACE, "GroupCipher");
+ ap_properties_changed(ap_if);
l_rtnl_set_linkmode_and_operstate(rtnl,
netdev_get_ifindex(ap_if->netdev),
--
2.34.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] auto-t: iwd.py: allow certain APIs to be used in AP mode
2022-11-03 17:00 [PATCH 1/4] doc: document AP properties PairwiseCiphers/GroupCipher James Prestwood
2022-11-03 17:00 ` [PATCH 2/4] ap: update Scanning property when AP starts James Prestwood
@ 2022-11-03 17:00 ` James Prestwood
2022-11-03 17:00 ` [PATCH 4/4] auto-t: add test for scanning " James Prestwood
2 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2022-11-03 17:00 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
AP mode implements a few DBus methods/properties which are named
the same as station: Scan, Scanning, and GetOrderedNetworks. Allow
the Device object to work with these in AP mode by calling the
correct method if the Mode is 'ap'.
---
autotests/util/iwd.py | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 98b9ea1c..5fa12444 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -521,13 +521,16 @@ class Device(IWDDBusAbstract):
def scanning(self):
'''
Reflects whether the device is currently scanning
- for networks. net.connman.iwd.Network objects are
- updated when this property goes from true to false.
+ for networks. For station devices net.connman.iwd.Network
+ objects are updated when this property goes from true to false
@rtype: boolean
'''
- props = self._station_properties()
- return bool(props['Scanning'])
+ if self._properties['Mode'] == 'station':
+ props = self._station_properties()
+ return bool(props['Scanning'])
+ else:
+ return bool(self._ap.scanning)
@property
def autoconnect(self):
@@ -544,12 +547,14 @@ class Device(IWDDBusAbstract):
Possible exception: BusyEx
FailedEx
'''
- self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
+ if self._properties['Mode'] == 'station':
+ self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
reply_handler=self._success,
error_handler=self._failure)
-
- if wait:
- self._wait_for_async_op()
+ if wait:
+ self._wait_for_async_op()
+ else:
+ self._ap.scan()
def disconnect(self):
'''Disconnect from the network
@@ -576,6 +581,9 @@ class Device(IWDDBusAbstract):
groups the maximum relative signal-strength is the
main sorting factor.
'''
+ if self._properties['Mode'] == 'ap':
+ return self._ap.get_ordered_networks()
+
ordered_networks = []
if not full_scan:
for bus_obj in self._station.GetOrderedNetworks():
--
2.34.3
^ permalink raw reply related [flat|nested] 5+ messages in thread