mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 14:10:51 +10:00
Fix Country Code detection
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/184
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- Deprecates Apple-Binaries-OCLP
|
- Deprecates Apple-Binaries-OCLP
|
||||||
- Fix full screen and Airplay to Mac support for Intel HD4000 iGPUs
|
- Fix full screen and Airplay to Mac support for Intel HD4000 iGPUs
|
||||||
- Automatically set `CMIO_Unit_Input_ASC.DoNotUseOpenCL` on TeraScale 2 GPUs
|
- Automatically set `CMIO_Unit_Input_ASC.DoNotUseOpenCL` on TeraScale 2 GPUs
|
||||||
|
- Fix Country Code detection on Wireless Cards
|
||||||
|
|
||||||
## 0.1.9
|
## 0.1.9
|
||||||
- Fix incorrect AMFI and SIP detection
|
- Fix incorrect AMFI and SIP detection
|
||||||
|
|||||||
+14
-5
@@ -239,8 +239,8 @@ class BuildOpenCore:
|
|||||||
# iMac11,x-12,x also apply
|
# iMac11,x-12,x also apply
|
||||||
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
|
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
|
||||||
print(f"- Using known DevicePath {arpt_path}")
|
print(f"- Using known DevicePath {arpt_path}")
|
||||||
print("- Applying fake ID for WiFi")
|
print(f"- Applying fake ID for WiFi, setting Country Code: {self.computer.wifi.country_code}")
|
||||||
self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba"}
|
self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba", "brcmfx-country": self.computer.wifi.country_code}
|
||||||
|
|
||||||
# WiFi patches
|
# WiFi patches
|
||||||
# TODO: -a is not supported in Lion and older, need to add proper fix
|
# TODO: -a is not supported in Lion and older, need to add proper fix
|
||||||
@@ -258,6 +258,13 @@ class BuildOpenCore:
|
|||||||
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
|
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
|
||||||
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC:
|
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC:
|
||||||
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||||
|
print(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
||||||
|
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.pci_path:
|
||||||
|
arpt_path = self.computer.wifi.pci_path
|
||||||
|
print(f"- Found ARPT device at {arpt_path}")
|
||||||
|
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.wifi.country_code}
|
||||||
|
else:
|
||||||
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
|
||||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||||
wifi_fake_id(self)
|
wifi_fake_id(self)
|
||||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
||||||
@@ -271,9 +278,7 @@ class BuildOpenCore:
|
|||||||
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
|
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
|
||||||
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
||||||
else:
|
else:
|
||||||
if self.model in ["iMac14,1", "iMac14,2", "iMac14,3"]:
|
if self.model in ModelArray.WifiBCM94331:
|
||||||
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
|
||||||
elif self.model in ModelArray.WifiBCM94331:
|
|
||||||
wifi_fake_id(self)
|
wifi_fake_id(self)
|
||||||
elif self.model in ModelArray.WifiBCM94322:
|
elif self.model in ModelArray.WifiBCM94322:
|
||||||
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
|
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
|
||||||
@@ -285,6 +290,10 @@ class BuildOpenCore:
|
|||||||
elif self.model in ModelArray.WifiAtheros:
|
elif self.model in ModelArray.WifiAtheros:
|
||||||
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
|
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
|
||||||
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
||||||
|
else:
|
||||||
|
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||||
|
print(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
||||||
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
|
||||||
|
|
||||||
# CPUFriend
|
# CPUFriend
|
||||||
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
|
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import binascii
|
import binascii
|
||||||
import enum
|
import enum
|
||||||
import itertools
|
import itertools
|
||||||
|
import plistlib
|
||||||
import subprocess
|
import subprocess
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, ClassVar, Optional, Type
|
from typing import Any, ClassVar, Optional, Type
|
||||||
@@ -104,7 +105,7 @@ class WirelessCard(PCIDevice):
|
|||||||
chipset: enum.Enum = field(init=False)
|
chipset: enum.Enum = field(init=False)
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
system_profiler = plistlib.loads(subprocess.run("system_profiler -xml SPAirPortDataType", stdout=subprocess.PIPE).stdout)
|
system_profiler = plistlib.loads(subprocess.run("system_profiler -xml SPAirPortDataType".split(), stdout=subprocess.PIPE).stdout)
|
||||||
self.country_code = system_profiler[0]["_items"][0]["spairport_airport_interfaces"][0]["spairport_wireless_country_code"]
|
self.country_code = system_profiler[0]["_items"][0]["spairport_airport_interfaces"][0]["spairport_wireless_country_code"]
|
||||||
self.detect_chipset()
|
self.detect_chipset()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user