MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / process_card

Method process_card

OpenHD/ohd_interface/src/wifi_card_discovery.cpp:209–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209std::optional<WiFiCard> DWifiCards::process_card(
210 const std::string& interface_name) {
211 auto card_opt = fill_linux_wifi_card_identifiers(interface_name);
212 if (!card_opt.has_value()) {
213 return std::nullopt;
214 }
215 WiFiCard card = card_opt.value();
216
217 // This reported value is right in most cases
218 /*const auto supported_freq=
219 wifi::commandhelper::iw_get_supported_frequency_bands(card.device_name);
220 card.xx_supports_2ghz=supported_freq.supports_any_2G;
221 card.xx_supports_5ghz=supported_freq.supports_any_5G;*/
222 // but we now also have a method to figure out all the supported channels
223 // RTL8812AU - since the openhd driver change, it reliably supports all wifi
224 // frequencies, no matter what CRDA has to say
225 if (card.type == WiFiCardType::OPENHD_RTL_88X2AU ||
226 card.type == WiFiCardType::OPENHD_RTL_88X2BU ||
227 card.type == WiFiCardType::OPENHD_RTL_88X2CU ||
228 card.type == WiFiCardType::OPENHD_RTL_88X2EU ||
229 card.type == WiFiCardType::OPENHD_RTL_8852BU) {
230 card.supported_frequencies_2G = openhd::get_all_channel_frequencies(
231 openhd::get_channels_2G_legal_at_least_one_country());
232 card.supported_frequencies_5G = openhd::get_all_channel_frequencies(
233 openhd::get_channels_5G_legal_at_least_one_country());
234 } else {
235 // Ask CRDA
236 card.supported_frequencies_2G =
237 supported_frequencies(card.phy80211_index, true);
238 card.supported_frequencies_5G =
239 supported_frequencies(card.phy80211_index, false);
240 }
241 // Note that this does not necessarily mean this info is right/complete
242 // a card might report a specific channel but then since monitor mode is so
243 // hack not support the channel in monitor mode
244 /*card.supports_monitor_mode =
245 wifi::commandhelper::iw_supports_monitor_mode(card.phy80211_index);
246 card.is_openhd_supported = is_openhd_supported(card.type);*/
247 /*openhd::log::get_default()->debug("Card {} reports driver:{}
248 supports_2GHz:{} supports_5GHz:{} supports_monitor_mode:{}
249 openhd_supported:{}",
250 card.device_name,card.driver_name,card.supports_2GHz(),card.supports_5GHz(),
251 card.supports_monitor_mode,card.is_openhd_supported);*/
252
253 // temporary,hacky, only hotspot on rpi integrated wifi
254 /*if (card.type == WiFiCardType::BROADCOM || card.type == WiFiCardType::AIC) {
255 card.supports_hotspot = true;
256 }*/
257 return card;
258}
259
260int DWifiCards::n_cards_openhd_wifibroadcast_supported(
261 const std::vector<WiFiCard>& cards) {

Callers

nothing calls this directly

Tested by

no test coverage detected