Retain properties of unsupported devices

This commit is contained in:
Hoang Hong Quan
2024-08-01 07:54:10 +07:00
parent 8cdcfc3e3a
commit 87af6bd2b8
4 changed files with 21 additions and 23 deletions

View File

@@ -116,8 +116,9 @@ class OCPE:
print("{}Min Version: {}".format(" "*4, self.macos_version_data[str(min_verion)]))
if self.compatibility.get("Unsupported Devices"):
print("* Unsupported devices:")
for index, device in enumerate(self.compatibility.get("Unsupported Devices"), start=1):
print("{}{}. {}".format(" "*4, index, device))
for index, device_name in enumerate(self.compatibility.get("Unsupported Devices"), start=1):
device_props = self.compatibility.get("Unsupported Devices").get(device_name)
print("{}{}. {}{}".format(" "*4, index, device_name, "" if not device_props.get("Audio Endpoints") else " ({})".format(", ".join(device_props.get("Audio Endpoints")))))
print("")
self.u.request_input()
return

View File

@@ -815,10 +815,13 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "UsbReset", 0x00001000)
})
def disable_unsupported_device(self, unsupported_devices):
for device in unsupported_devices:
comment = "Disable {}".format(device.split(": ")[-1])
for device_name, device_props in unsupported_devices.items():
if device_props.get("Bus Type").startswith("USB"):
continue
comment = "Disable {}".format(device_name.split(": ")[-1])
ssdt_name = None
if "Storage" in device:
if "Storage" in device_name:
ssdt_name = "SSDT-Disable_NVMe"
ssdt_content = """
// Replace all "_SB.PCI0.RP09.PXSX" with the ACPI path of your SSD NVMe
@@ -851,11 +854,8 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "DNVMe", 0x00000000)
}
}
"""
elif "WiFi" in device or "SD Controller" in device:
if "USB" in device:
continue
ssdt_name = "SSDT-Disable_{}".format("WiFi" if "WiFi" in device else "SD_Card_Reader")
elif "WiFi" in device_name or "SD Controller" in device_name:
ssdt_name = "SSDT-Disable_{}".format("WiFi" if "WiFi" in device_name else "SD_Card_Reader")
ssdt_content = """
// Replace all "_SB.PCI0.RP01" with the ACPI path of your [[DeviceType]]
@@ -891,7 +891,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "[[DeviceType]]", 0)
\\_SB.PCI0.RP01.DDDD = One
}
}
}""".replace("[[DeviceType]]", "DWiFi" if "WiFi" in device else "DSDC")
}""".replace("[[DeviceType]]", "DWiFi" if "WiFi" in device_name else "DSDC")
if ssdt_name:
self.result["Add"].append({

View File

@@ -104,7 +104,7 @@ class CompatibilityChecker:
is_supported_discrete_gpu = is_supported_gpu = False
if not is_supported_gpu:
self.unsupported_devices.append("{}: {}".format(device_type, gpu_name))
self.unsupported_devices["{}: {}".format(device_type, gpu_name)] = gpu_props
else:
supported_gpus[gpu_name] = gpu_props
@@ -112,7 +112,6 @@ class CompatibilityChecker:
def check_audio_compatibility(self, audio_info):
supported_audio = {}
audio_endpoint = None
for audio_device, audio_props in audio_info.items():
codec_id = audio_props.get("Codec ID")
@@ -125,9 +124,7 @@ class CompatibilityChecker:
else:
supported_audio[audio_device] = audio_props
else:
if "Audio Endpoints" in audio_props:
audio_endpoint = ",".join(audio_props.get("Audio Endpoints"))
self.unsupported_devices.append("Audio: {}{}".format(audio_device, "" if not audio_endpoint else " ({})".format(audio_endpoint)))
self.unsupported_devices["Audio: {}".format(audio_device)] = audio_props
return supported_audio
@@ -135,7 +132,7 @@ class CompatibilityChecker:
biometric = hardware.get("Biometric", {})
if biometric:
for biometric_device, biometric_props in biometric.items():
self.unsupported_devices.append("Biometric: {}".format(biometric_device))
self.unsupported_devices["Biometric: {}".format(biometric_device)] = biometric_props
del hardware["Biometric"]
@@ -153,7 +150,7 @@ class CompatibilityChecker:
self.min_supported_macos_version = 19
if not is_device_supported:
self.unsupported_devices.append("{}: {}".format(connection_name, device_name))
self.unsupported_devices["{}: {}".format(connection_name, device_name)] = device_props
else:
supported_network[device_name] = device_props
@@ -166,7 +163,7 @@ class CompatibilityChecker:
if "PCI" in controller_props.get("Bus Type"):
device_id = controller_props.get("Device ID")
if device_id in pci_data.IntelVMDIDs or device_id in pci_data.UnsupportedNVMeSSDIDs:
self.unsupported_devices.append("Storage: {}".format(pci_data.UnsupportedNVMeSSDIDs[device_id]))
self.unsupported_devices["Storage: {}".format(pci_data.UnsupportedNVMeSSDIDs[device_id])] = controller_props
else:
supported_storage[controller_name] = controller_props
@@ -177,13 +174,13 @@ class CompatibilityChecker:
if sd_controller_props:
if sd_controller_props.get("Device ID") not in pci_data.RealtekCardReaderIDs:
self.unsupported_devices.append("SD Controller: {}".format(sd_controller_props.get("Device Description")))
hardware["SD Controller"] = {}
self.unsupported_devices["SD Controller: {}".format(sd_controller_props.get("Device Description"))] = sd_controller_props
del hardware["SD Controller"]
def check_compatibility(self, hardware):
self.max_supported_macos_version = self.latest_macos_version
self.min_supported_macos_version = 17
self.unsupported_devices = []
self.unsupported_devices = {}
self.check_cpu_compatibility(
hardware.get("CPU").get("Processor Name"),

View File

@@ -341,7 +341,7 @@ class ConfigProdigy:
hardware.get("Ethernet (PCI)"),
hardware.get("Codec ID"),
hardware.get("Touchpad Communication"),
hardware.get("Unsupported Devices"),
", ".join(list(hardware.get("Unsupported Devices").keys())),
efi_option.get("Custom CPU Name"),
efi_option.get("macOS Version")
)