From f6db03c60f1cdea64c909ae85eab2b0601232d25 Mon Sep 17 00:00:00 2001 From: Bruin06 <419738327@qq.com> Date: Wed, 2 Apr 2025 19:15:46 +0800 Subject: [PATCH] =?UTF-8?q?rk=E5=8D=95=E6=9D=BFmac=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bruin06 <419738327@qq.com> --- .../wpa_supplicant/events.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wpa_supplicant-2.9_standard/wpa_supplicant/events.c b/wpa_supplicant-2.9_standard/wpa_supplicant/events.c index bd12a96..49167f2 100644 --- a/wpa_supplicant-2.9_standard/wpa_supplicant/events.c +++ b/wpa_supplicant-2.9_standard/wpa_supplicant/events.c @@ -6478,6 +6478,29 @@ void set_running_wpa() run_mode = 0; } +static void restart_p2p_device(struct wpa_supplicant *wpa_s) +{ + struct wpa_global *global = wpa_s->global; + struct wpa_supplicant *iface, *prev; + + if (strncmp(wpa_s->ifname, "wlan0", strlen("wlan0")) != 0) { + return; + } + if (global == NULL) { + return; + } + iface = global->ifaces; + while(iface) { + if (strncmp(iface->ifname, "p2p-dev-wlan0", strlen("p2p-dev-wlan0")) == 0) { + wpa_supplicant_remove_iface(global, iface, 1); + wpas_p2p_add_p2pdev_interface(wpa_s, wpa_s->global->params.conf_p2p_dev); + break; + } + prev = iface; + iface = iface->next; + } +} + void wpa_supplicant_event_hapd(void *ctx, enum wpa_event_type event, union wpa_event_data *data); void wpa_supplicant_event(void *ctx, enum wpa_event_type event, @@ -7224,6 +7247,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, */ p2p_stop_find(wpa_s->global->p2p); } + restart_p2p_device(wpa_s); #endif /* CONFIG_P2P */ if (wpa_s->wpa_state >= WPA_AUTHENTICATING) { -- Gitee