mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-24 03:50:14 +10:00
Add basic hardware detection
This commit is contained in:
@@ -582,6 +582,21 @@ class BuildOpenCore:
|
||||
|
||||
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
|
||||
|
||||
# Bluetooth Detection
|
||||
if not self.constants.custom_model and self.computer.bluetooth:
|
||||
if self.computer.bluetooth == "BRCM2070 Hub":
|
||||
print("- Enabling Bluetooth BRCM2070 for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2070_path)
|
||||
elif self.computer.bluetooth == "BRCM2046 Hub":
|
||||
print("- Enabling Bluetooth BRCM2046 for macOS Mojave")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2046_path)
|
||||
elif self.model in ModelArray.Bluetooth_BRCM2070:
|
||||
print("- Enabling Bluetooth BRCM2070 for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2070_path)
|
||||
elif self.model in ModelArray.Bluetooth_BRCM2046:
|
||||
print("- Enabling Bluetooth BRCM2046 for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2046_path)
|
||||
|
||||
# Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected
|
||||
# TODO: Fix XhciDxe to work on pre UEFI 2.0 Macs
|
||||
# Ref: https://github.com/acidanthera/bugtracker/issues/1663
|
||||
@@ -693,15 +708,6 @@ class BuildOpenCore:
|
||||
print("- Allowing FileVault on Root Patched systems")
|
||||
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
|
||||
|
||||
if self.model in ModelArray.Bluetooth_BRCM2070:
|
||||
print("- Enabling Bluetooth BRCM2070 for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2070_path)
|
||||
elif self.model in ModelArray.Bluetooth_BRCM2046:
|
||||
print("- Enabling Bluetooth BRCM2046 for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.brcm2046_path)
|
||||
|
||||
|
||||
|
||||
def set_smbios(self):
|
||||
spoofed_model = self.model
|
||||
if self.constants.override_smbios == "Default":
|
||||
@@ -852,7 +858,6 @@ class BuildOpenCore:
|
||||
raise IndexError
|
||||
return efi_binary
|
||||
|
||||
|
||||
def enable_kext(self, kext_name, kext_version, kext_path, check=False):
|
||||
kext = self.get_kext_by_bundle_path(kext_name)
|
||||
|
||||
|
||||
@@ -313,6 +313,7 @@ class Computer:
|
||||
cpu: Optional[CPU] = None
|
||||
oclp_version: Optional[str] = None
|
||||
opencore_version: Optional[str] = None
|
||||
bluetooth_chipset: Optional[str] = None
|
||||
|
||||
@staticmethod
|
||||
def probe():
|
||||
@@ -324,6 +325,7 @@ class Computer:
|
||||
computer.storage_probe()
|
||||
computer.smbios_probe()
|
||||
computer.cpu_probe()
|
||||
computer.bluetooth()
|
||||
return computer
|
||||
|
||||
def gpu_probe(self):
|
||||
@@ -437,3 +439,12 @@ class Computer:
|
||||
subprocess.run("sysctl machdep.cpu.brand_string".split(), stdout=subprocess.PIPE).stdout.decode().partition(": ")[2].strip(),
|
||||
subprocess.run("sysctl machdep.cpu.features".split(), stdout=subprocess.PIPE).stdout.decode().partition(": ")[2].strip().split(" "),
|
||||
)
|
||||
|
||||
def bluetooth(self):
|
||||
usb_data: str = subprocess.run("system_profiler SPUSBDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
if "BRCM2070 Hub" in usb_data:
|
||||
self.bluetooth_chipset = "BRCM2070 Hub"
|
||||
elif "BRCM2046 Hub" in usb_data:
|
||||
self.bluetooth_chipset = "BRCM2046 Hub"
|
||||
elif "Bluetooth":
|
||||
self.bluetooth_chipset = "Generic"
|
||||
Reference in New Issue
Block a user