From a06c7d50f91c17dd05f0173aa09f34a9e95f2022 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Tue, 4 May 2021 12:44:20 +0530 Subject: [PATCH] P2P: Helper functions to check for WFD capability of a P2P device P2P operation on the 6 GHz band is supported in the WFD use case. Introduce helper functions to check for Wi-Fi Display capability of the local device and a peer device. Signed-off-by: Sreeramya Soratkal --- src/p2p/p2p.c | 23 +++++++++++++++++++++++ src/p2p/p2p.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index a5a04e377..3148aeb3d 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -5605,3 +5605,26 @@ bool is_p2p_6ghz_capable(struct p2p_data *p2p) { return p2p->p2p_6ghz_capable; } + + +bool p2p_wfd_enabled(struct p2p_data *p2p) +{ +#ifdef CONFIG_WIFI_DISPLAY + return p2p->wfd_ie_probe_req != NULL; +#else /* CONFIG_WIFI_DISPLAY */ + return false; +#endif /* CONFIG_WIFI_DISPLAY */ +} + + +bool p2p_peer_wfd_enabled(struct p2p_data *p2p, const u8 *peer_addr) +{ +#ifdef CONFIG_WIFI_DISPLAY + struct p2p_device *dev; + + dev = p2p_get_device(p2p, peer_addr); + return dev && dev->info.wfd_subelems != NULL; +#else /* CONFIG_WIFI_DISPLAY */ + return false; +#endif /* CONFIG_WIFI_DISPLAY */ +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 0bc2e606f..24b0677e7 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -2414,5 +2414,7 @@ struct wpabuf * p2p_build_probe_resp_template(struct p2p_data *p2p, void p2p_set_6ghz_dev_capab(struct p2p_data *p2p, bool allow_6ghz); bool is_p2p_6ghz_capable(struct p2p_data *p2p); bool p2p_is_peer_6ghz_capab(struct p2p_data *p2p, const u8 *addr); +bool p2p_peer_wfd_enabled(struct p2p_data *p2p, const u8 *peer_addr); +bool p2p_wfd_enabled(struct p2p_data *p2p); #endif /* P2P_H */