bluetooth.py: Refactor

This commit is contained in:
Mykola Grymalyuk
2022-11-13 16:31:08 -07:00
parent b448a4b6dd
commit 1d2a7e080b
+17 -3
View File
@@ -11,8 +11,14 @@ class build_bluetooth:
self.computer = self.constants.computer self.computer = self.constants.computer
def build(self): def build(self):
# Bluetooth Detection # Bluetooth patches
if not self.constants.custom_model and self.computer.bluetooth_chipset: if not self.constants.custom_model and self.computer.bluetooth_chipset:
self.on_model()
else:
self.prebuilt_assumption()
def on_model(self):
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]: if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
print("- Fixing Legacy Bluetooth for macOS Monterey") print("- Fixing Legacy Bluetooth for macOS Monterey")
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path) support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
@@ -27,11 +33,19 @@ class build_bluetooth:
print("- Fixing Legacy Bluetooth for macOS Monterey") print("- Fixing Legacy Bluetooth for macOS Monterey")
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path) support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
elif self.computer.bluetooth_chipset == "3rd Party Bluetooth 4.0 Hub": elif self.computer.bluetooth_chipset == "3rd Party Bluetooth 4.0 Hub":
print("- Detected 3rd Party Chipset") print("- Detected 3rd Party Bluetooth Chipset")
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path) support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
print("- Enabling Bluetooth FeatureFlags") print("- Enabling Bluetooth FeatureFlags")
self.config["Kernel"]["Quirks"]["ExtendBTFeatureFlags"] = True self.config["Kernel"]["Quirks"]["ExtendBTFeatureFlags"] = True
elif smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
def prebuilt_assumption(self):
if not self.model in smbios_data.smbios_dictionary:
return
if not "Bluetooth Model" in smbios_data.smbios_dictionary[self.model]:
return
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
print("- Fixing Legacy Bluetooth for macOS Monterey") print("- Fixing Legacy Bluetooth for macOS Monterey")
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path) support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value: if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value: