commit cd2dd4e2dc47f5058d75a6d14fd41eaee3ad2628
parent b705a579ad552e31cf68cd35d9a0be0befbf99fb
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 13 Aug 2021 12:47:08 -0700
station: Add generic Event signal
This is meant to be used as a generic notification to autotests. For
now 'no-roam-candidates' is the only event being sent. The idea
is to extend these events to signal conditions that are otherwise
undiscoverable in autotesting.
Diffstat:
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/station.c b/src/station.c
@@ -153,6 +153,24 @@ static bool station_is_autoconnecting(struct station *station)
station->state == STATION_STATE_AUTOCONNECT_QUICK;
}
+static bool station_debug_event(struct station *station, const char *name)
+{
+ struct l_dbus_message *signal;
+
+ if (!iwd_is_developer_mode())
+ return true;
+
+ l_debug("StationDebug.Event(%s)", name);
+
+ signal = l_dbus_message_new_signal(dbus_get_bus(),
+ netdev_get_path(station->netdev),
+ IWD_STATION_DEBUG_INTERFACE, "Event");
+
+ l_dbus_message_set_arguments(signal, "sav", name, 0);
+
+ return l_dbus_send(dbus_get_bus(), signal) != 0;
+}
+
static void station_property_set_scanning(struct station *station,
bool scanning)
{
@@ -1938,8 +1956,10 @@ next:
goto fail_free_bss;
/* See if we have anywhere to roam to */
- if (!best_bss || scan_bss_addr_eq(best_bss, station->connected_bss))
+ if (!best_bss || scan_bss_addr_eq(best_bss, station->connected_bss)) {
+ station_debug_event(station, "no-roam-candidates");
goto fail_free_bss;
+ }
bss = network_bss_find_by_addr(network, best_bss->addr);
if (bss) {
@@ -3991,6 +4011,8 @@ static void station_setup_debug_interface(
station_debug_scan, "", "aq",
"frequencies");
+ l_dbus_interface_signal(interface, "Event", 0, "sav", "name", "data");
+
l_dbus_interface_property(interface, "AutoConnect", 0, "b",
station_property_get_autoconnect,
station_property_set_autoconnect);