@@ -71,6 +71,7 @@ struct WifiTxPowerOverride {
7171struct WifiCardProfile {
7272 std::string vendor_id;
7373 std::string device_id;
74+ std::string chipset;
7475 std::string name;
7576 std::string power_mode;
7677 int min_mw = 0 ;
@@ -399,6 +400,10 @@ std::string to_string_if(int value) {
399400
400401std::string normalize_id (std::string value);
401402
403+ std::string normalize_chipset (std::string value) {
404+ return to_upper (trim_copy (value));
405+ }
406+
402407std::vector<WifiCardProfile> load_wifi_card_profiles () {
403408 std::vector<WifiCardProfile> profiles;
404409 auto content = read_file (kWifiCardsPath );
@@ -419,6 +424,8 @@ std::vector<WifiCardProfile> load_wifi_card_profiles() {
419424 WifiCardProfile profile{};
420425 profile.vendor_id = normalize_id (*vendor);
421426 profile.device_id = normalize_id (*device);
427+ profile.chipset =
428+ normalize_chipset (extract_string_field (object, " chipset" ).value_or (" " ));
422429 profile.name = extract_string_field (object, " name" ).value_or (" " );
423430 profile.power_mode = to_upper (extract_string_field (object, " power_mode" ).value_or (" mw" ));
424431 if (profile.power_mode == " FIXED" ) {
@@ -453,10 +460,15 @@ std::vector<WifiCardProfile> load_wifi_card_profiles() {
453460const WifiCardProfile* find_wifi_profile (
454461 const std::vector<WifiCardProfile>& profiles,
455462 const std::string& vendor_id,
456- const std::string& device_id) {
463+ const std::string& device_id,
464+ const std::string& chipset) {
457465 for (const auto & profile : profiles) {
458466 if (equal_after_uppercase (profile.vendor_id , vendor_id) &&
459467 equal_after_uppercase (profile.device_id , device_id)) {
468+ if (!profile.chipset .empty () &&
469+ !equal_after_uppercase (profile.chipset , chipset)) {
470+ continue ;
471+ }
460472 return &profile;
461473 }
462474 }
@@ -801,8 +813,8 @@ WifiCardInfo build_wifi_card(
801813 card.effective_type = card.detected_type ;
802814 }
803815
804- const auto * profile =
805- find_wifi_profile ( profiles, card.vendor_id , card.device_id );
816+ const auto * profile = find_wifi_profile (
817+ profiles, card.vendor_id , card.device_id , card. detected_type );
806818 const bool profile_fixed =
807819 profile && to_upper (profile->power_mode ) == " FIXED" ;
808820 if (profile) {
0 commit comments