From 0506fb67111d5c5230bf59b826c318ea4251dfc4 Mon Sep 17 00:00:00 2001 From: Hoang Hong Quan Date: Sun, 18 Aug 2024 08:55:41 +0700 Subject: [PATCH] Remove the check for connection name being Ethernet or WiFi --- Scripts/acpi_guru.py | 11 ++++--- Scripts/aida64.py | 8 ++--- Scripts/compatibility_checker.py | 3 +- Scripts/config_prodigy.py | 9 +---- Scripts/efi_builder.py | 18 +++------- Scripts/kext_maestro.py | 56 ++++++++++++++++---------------- 6 files changed, 42 insertions(+), 63 deletions(-) diff --git a/Scripts/acpi_guru.py b/Scripts/acpi_guru.py index fec1a41..b5c3757 100644 --- a/Scripts/acpi_guru.py +++ b/Scripts/acpi_guru.py @@ -1509,9 +1509,10 @@ DefinitionBlock ("", "SSDT", 2, "CORP ", "SsdtEC", 0x00001000) "Replace": "4701700070000102" }) - def add_null_ethernet_device(self, ethernet_pci): - if ethernet_pci: - return + def add_null_ethernet_device(self, network): + for network_name, network_props in network.items(): + if self.utils.contains_any(pci_data.NetworkIDs, network_props.get("Device ID"), start=108, end=219): + return random_mac_address = self.smbios.generate_random_mac() mac_address_byte = ", ".join([f'0x{random_mac_address[i:i+2]}' for i in range(0, len(random_mac_address), 2)]) @@ -2897,7 +2898,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPUSPOOF", 0x00001000) }) self.dropping_the_table("APIC") - def initialize_patches(self, motherboard_name, motherboard_chipset, platform, cpu_manufacturer, cpu_codename, integrated_gpu, discrete_gpu, ethernet_pci, touchpad_communication, smbios, intel_mei, unsupported_devices, macos_version, acpi_directory): + def initialize_patches(self, motherboard_name, motherboard_chipset, platform, cpu_manufacturer, cpu_codename, integrated_gpu, discrete_gpu, network, touchpad_communication, smbios, intel_mei, unsupported_devices, macos_version, acpi_directory): self.acpi_directory = self.check_acpi_directory(acpi_directory) if self.select_dsdt(): @@ -2905,7 +2906,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPUSPOOF", 0x00001000) self.get_low_pin_count_bus_device() self.add_intel_management_engine(cpu_codename, intel_mei) self.add_memory_controller_device(cpu_manufacturer, smbios) - self.add_null_ethernet_device(ethernet_pci) + self.add_null_ethernet_device(network) self.add_system_management_bus_device(cpu_manufacturer, cpu_codename) self.add_usb_power_properties(smbios) self.ambient_light_sensor(motherboard_name, platform, integrated_gpu) diff --git a/Scripts/aida64.py b/Scripts/aida64.py index 9a44464..e5c0288 100644 --- a/Scripts/aida64.py +++ b/Scripts/aida64.py @@ -266,19 +266,15 @@ class AIDA64: network_adapters = self.utils.search_dict_iter(windows_devices, network_adapter) for adapter_name, adapter_props in network_adapters.items(): - device_description = adapter_name + adapter_props.get("PCI Device", "Unknown") - connection_name = "WiFi" if "WiFi" in device_description or "Wi-Fi" in device_description or "Wireless" in device_description else \ - "Ethernet" if "Network" in device_description or "Ethernet" in device_description else None bus_type = adapter_props.get("Bus Type", "Unknown") - if (bus_type.startswith("PCI") or bus_type.startswith("USB")) and connection_name: + if bus_type.startswith("PCI") or bus_type.startswith("USB"): device_key = adapter_props.get("PCI Device") if not " - " in adapter_props.get("PCI Device", " - ") else adapter_name network_info[device_key.split(" [")[0]] = { - "Connection Name": connection_name, "Bus Type": bus_type, "Device ID": adapter_props.get("Device ID", "Unknown") } - return self.utils.sort_dict_by_key(network_info, "Connection Name") + return network_info def sd_controller(self, pci_devices, usb_devices, hardware): combined_devices = pci_devices.copy() diff --git a/Scripts/compatibility_checker.py b/Scripts/compatibility_checker.py index 9e14b6b..9a908f8 100755 --- a/Scripts/compatibility_checker.py +++ b/Scripts/compatibility_checker.py @@ -139,7 +139,6 @@ class CompatibilityChecker: supported_network = {} for device_name, device_props in network_info.items(): - connection_name = device_props.get("Connection Name") bus_type = device_props.get("Bus Type") device_id = device_props.get("Device ID") is_device_supported = device_id in pci_data.NetworkIDs @@ -149,7 +148,7 @@ class CompatibilityChecker: self.min_supported_macos_version = 19 if not is_device_supported: - self.unsupported_devices["{}: {}".format(connection_name, device_name)] = device_props + self.unsupported_devices["Network: {}".format(device_name)] = device_props else: supported_network[device_name] = device_props diff --git a/Scripts/config_prodigy.py b/Scripts/config_prodigy.py index 92c441b..be1f7b4 100755 --- a/Scripts/config_prodigy.py +++ b/Scripts/config_prodigy.py @@ -159,7 +159,7 @@ class ConfigProdigy: return kernel_patch - def boot_args(self, motherboard_name, platform, cpu_manufacturer, cpu_codename, discrete_gpu_codename, discrete_gpu_id, integrated_gpu_name, ethernet_pci, codec_id, touchpad_communication, unsupported_devices, custom_cpu_name, macos_version): + def boot_args(self, motherboard_name, platform, cpu_manufacturer, cpu_codename, discrete_gpu_codename, discrete_gpu_id, integrated_gpu_name, codec_id, touchpad_communication, unsupported_devices, custom_cpu_name, macos_version): boot_args = [ "-v", "debug=0x100", @@ -178,12 +178,6 @@ class ConfigProdigy: if self.utils.contains_any(cpu_data.IntelCPUGenerations, cpu_codename, start=13): boot_args.append("-ctrsmt") - if ethernet_pci in ["8086-15F2", "8086-15F3", "8086-15F8"]: - if macos_version == 20: - boot_args.append("dk.e1000=0") - elif macos_version == 21: - boot_args.append("e1000=0") - if "Intel" in cpu_manufacturer: if "UHD" in integrated_gpu_name and macos_version > 18: boot_args.append("igfxonln=1") @@ -328,7 +322,6 @@ class ConfigProdigy: hardware.get("Discrete GPU").get("GPU Codename", ""), hardware.get("Discrete GPU").get("Device ID", ""), hardware.get("Integrated GPU Name"), - hardware.get("Ethernet (PCI)"), hardware.get("Codec ID"), hardware.get("Touchpad Communication"), ", ".join(list(hardware.get("Unsupported Devices").keys())), diff --git a/Scripts/efi_builder.py b/Scripts/efi_builder.py index 0391ec3..21d041b 100755 --- a/Scripts/efi_builder.py +++ b/Scripts/efi_builder.py @@ -397,16 +397,7 @@ class builder: hardware_shorc["Discrete GPU"] = list(hardware.get("GPU").items())[0][1].copy() if "Discrete GPU" in list(hardware.get("GPU").items())[0][1]["Device Type"] else {} if hardware_shorc["Discrete GPU"]: hardware_shorc["Discrete GPU"]["GPU Name"] = list(hardware.get("GPU").keys())[0] - hardware_shorc["Ethernet (PCI)"] = [] - for network_name, network_props in hardware["Network"].items(): - connection_name = network_props["Connection Name"] - bus_type = network_props["Bus Type"] - - if bus_type.startswith("PCI"): - if connection_name.startswith("WiFi"): - hardware_shorc["Wi-Fi (PCI)"] = network_props.get("Device ID") - elif connection_name.startswith("Ethernet"): - hardware_shorc["Ethernet (PCI)"].append(network_props.get("Device ID")) + hardware_shorc["Network"] = hardware.get("Network") hardware_shorc["Bluetooth"] = [device_props.get("Device ID") for device_name, device_props in hardware.get("Bluetooth", {}).items()] hardware_shorc["Codec ID"] = next((device_props.get("Codec ID") for device_name, device_props in hardware.get("Audio").items()), None) hardware_shorc["SD Controller"] = hardware.get("SD Controller") @@ -450,7 +441,7 @@ class builder: hardware_shorc["CPU Codename"], hardware_shorc["Integrated GPU"], hardware_shorc["Discrete GPU"], - hardware_shorc["Ethernet (PCI)"], + hardware_shorc["Network"], hardware_shorc["Touchpad Communication"], efi_option.get("SMBIOS"), hardware_shorc.get("Intel MEI"), @@ -467,8 +458,7 @@ class builder: hardware_shorc["CPU Codename"], hardware_shorc["Discrete GPU"].get("GPU Codename", ""), hardware_shorc["Integrated GPU"], - hardware_shorc.get("Wi-Fi (PCI)"), - hardware_shorc["Ethernet (PCI)"], + hardware_shorc.get("Network"), hardware_shorc.get("Bluetooth"), hardware_shorc.get("Codec ID"), hardware_shorc["Input"], @@ -478,7 +468,7 @@ class builder: efi_option.get("SMBIOS"), efi_option.get("Custom CPU Name"), efi_option.get("Synchronize the TSC"), - efi_option.get("ACPI").get("Battery Status Patch Needed"), + efi_option.get("ACPI"), efi_option.get("macOS Version") ) diff --git a/Scripts/kext_maestro.py b/Scripts/kext_maestro.py index 43461fb..29e32b9 100755 --- a/Scripts/kext_maestro.py +++ b/Scripts/kext_maestro.py @@ -584,7 +584,7 @@ class KextMaestro: return pci_ids - def gathering_kexts(self, motherboard_name, platform, cpu_configuration, cpu_manufacturer, cpu_codename, discrete_gpu_codename, integrated_gpu, wifi_pci, ethernet_pci, bluetooth, codec_id, input, sd_controller, storage_controllers, usb_controllers, smbios, custom_cpu_name, tsc_sync, battery_status_patch_needed, macos_version): + def gathering_kexts(self, motherboard_name, platform, cpu_configuration, cpu_manufacturer, cpu_codename, discrete_gpu_codename, integrated_gpu, network, bluetooth, codec_id, input, sd_controller, storage_controllers, usb_controllers, smbios, custom_cpu_name, tsc_sync, acpi, macos_version): kexts = [ "Lilu", "VirtualSMC", @@ -614,36 +614,36 @@ class KextMaestro: else: kexts.append("NootRX" if "Navi 2" in discrete_gpu_codename else "WhateverGreen") - if wifi_pci and wifi_pci in pci_data.NetworkIDs: - if wifi_pci.startswith("14E4"): - if wifi_pci in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: + if "SSDT-RMNE" in ", ".join(acpi_table.get("Path") for acpi_table in acpi.get("Add")): + kexts.append("NullEthernet") + + wifi_pci = None + for network_name, network_props in network.items(): + device_id = network_props.get("Device ID") + + if self.utils.contains_any(pci_data.NetworkIDs, device_id, end=21): + wifi_pci = device_id + if device_id in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: if macos_version > 22: kexts.extend(["AirportBrcmFixup", "IOSkywalkFamily", "IO80211FamilyLegacy", "AMFIPass"]) - elif wifi_pci in pci_data.NetworkIDs: + elif device_id in pci_data.NetworkIDs: kexts.append("AirportBrcmFixup") - elif wifi_pci.startswith("8086"): + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=21, end=108): kexts.append("AirportItlwm" if macos_version < 23 else "itlwm") - - if not ethernet_pci or not (ethernet_pci[0] in pci_data.NetworkIDs or ethernet_pci[-1] in pci_data.NetworkIDs): - kexts.append("NullEthernet") - else: - for pci_id in ethernet_pci: - idx = pci_data.NetworkIDs.index(pci_id) - - if 108 <= idx <= 114: - kexts.append("AppleIGC") - elif 115 <= idx <= 121: - kexts.append("AtherosE2200Ethernet") - elif 122 <= idx <= 172: - kexts.append("IntelMausi") - elif 173 <= idx <= 175: - kexts.append("LucyRTL8125Ethernet") - elif idx == 176: - kexts.append("RealtekRTL8100") - elif 177 <= idx <= 180: - kexts.append("RealtekRTL8111") - elif 181 <= idx <= 218: - kexts.append("AppleIGB") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=108, end=115): + kexts.append("AppleIGC") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=115, end=122): + kexts.append("AtherosE2200Ethernet") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=122, end=173): + kexts.append("IntelMausi") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=173, end=176): + kexts.append("LucyRTL8125Ethernet") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=176, end=177): + kexts.append("RealtekRTL8100") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=177, end=181): + kexts.append("RealtekRTL8111") + elif self.utils.contains_any(pci_data.NetworkIDs, device_id, start=181, end=219): + kexts.append("AppleIGB") if bluetooth and macos_version > 20 and not wifi_pci in ["14E4-43A0", "14E4-43A3", "14E4-43BA"]: kexts.append("BlueToolFixup") @@ -689,7 +689,7 @@ class KextMaestro: elif 79 < idx: kexts.append("VoodooRMI") - if "Laptop" in platform and "SURFACE" not in motherboard_name and battery_status_patch_needed: + if "Laptop" in platform and "SURFACE" not in motherboard_name and acpi.get("Battery Status Patch Needed"): kexts.append("ECEnabler") if sd_controller and sd_controller.get("Device ID") in pci_data.RealtekCardReaderIDs: