diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index d82cd638f..6a6e91afa 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -905,10 +905,11 @@ Interface for performing WPS (Wi-Fi Simple Config) operations.
config_methods | Value type |
---|---|
manufacturer | q | diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 4318bfb5e..fb674d479 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -524,6 +524,44 @@ void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s, #ifdef CONFIG_WPS +/** + * wpas_dbus_signal_wps_event_pbc_overlap - Signals PBC overlap WPS event + * @wpa_s: %wpa_supplicant network interface data + * + * Sends Event dbus signal with name "pbc-overlap" and empty dict as arguments + */ +void wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) +{ + + DBusMessage *msg; + DBusMessageIter iter, dict_iter; + struct wpas_dbus_priv *iface; + char *key = "pbc-overlap"; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_WPS, "Event"); + if (msg == NULL) + return; + + dbus_message_iter_init_append(msg, &iter); + + if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) || + !wpa_dbus_dict_open_write(&iter, &dict_iter) || + !wpa_dbus_dict_close_write(&iter, &dict_iter)) + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + else + dbus_connection_send(iface->con, msg, NULL); + + dbus_message_unref(msg); +} + + /** * wpas_dbus_signal_wps_event_success - Signals Success WPS event * @wpa_s: %wpa_supplicant network interface data diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index 86bcdbfec..7503348cc 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -152,6 +152,7 @@ void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s, void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s, struct wps_event_fail *fail); void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s); +void wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s); int wpas_dbus_register_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid); @@ -297,6 +298,11 @@ static inline void wpas_dbus_signal_wps_event_success( { } +static inline void wpas_dbus_signal_wps_event_pbc_overlap( + struct wpa_supplicant *wpa_s) +{ +} + static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index d086624b2..a1dae30e8 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1179,6 +1179,7 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s, if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) { wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP "PBC session overlap"); + wpas_notify_wps_event_pbc_overlap(wpa_s); #ifdef CONFIG_P2P if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT || wpa_s->p2p_in_provisioning) { diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 5cef64624..c60d40437 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -268,6 +268,16 @@ void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s) #endif /* CONFIG_WPS */ } +void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) +{ + if (wpa_s->p2p_mgmt) + return; + +#ifdef CONFIG_WPS + wpas_dbus_signal_wps_event_pbc_overlap(wpa_s); +#endif /* CONFIG_WPS */ +} + void wpas_notify_network_added(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index b02a44247..1aeec47b0 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -45,6 +45,7 @@ void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s, void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s, struct wps_event_fail *fail); void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s); +void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s); void wpas_notify_network_added(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,