mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 14:10:51 +10:00
Add 3rd Party SATA SSD detection
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/741
This commit is contained in:
+11
-3
@@ -704,9 +704,17 @@ class BuildOpenCore:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# ThirdPartDrives Check
|
# ThirdPartDrives Check
|
||||||
if self.model in model_array.SATAPatch and self.constants.allow_oc_everywhere is False:
|
for drive in ["SATA 2.5", "SATA 3.5", "mSATA"]:
|
||||||
print("- Adding SATA Hibernation Patch")
|
if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
|
||||||
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
|
if not self.constants.custom_model:
|
||||||
|
if self.computer.third_party_sata_ssd is True:
|
||||||
|
print("- Adding SATA Hibernation Patch")
|
||||||
|
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print("- Adding SATA Hibernation Patch")
|
||||||
|
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
|
||||||
|
break
|
||||||
|
|
||||||
# DEBUG Settings
|
# DEBUG Settings
|
||||||
if self.constants.verbose_debug is True:
|
if self.constants.verbose_debug is True:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import binascii
|
|||||||
import enum
|
import enum
|
||||||
import itertools
|
import itertools
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import plistlib
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, ClassVar, Optional, Type, Union
|
from typing import Any, ClassVar, Optional, Type, Union
|
||||||
|
|
||||||
@@ -339,6 +340,7 @@ class Computer:
|
|||||||
oclp_version: Optional[str] = None
|
oclp_version: Optional[str] = None
|
||||||
opencore_version: Optional[str] = None
|
opencore_version: Optional[str] = None
|
||||||
bluetooth_chipset: Optional[str] = None
|
bluetooth_chipset: Optional[str] = None
|
||||||
|
third_party_sata_ssd: Optional[bool] = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def probe():
|
def probe():
|
||||||
@@ -351,6 +353,7 @@ class Computer:
|
|||||||
computer.smbios_probe()
|
computer.smbios_probe()
|
||||||
computer.cpu_probe()
|
computer.cpu_probe()
|
||||||
computer.bluetooth_probe()
|
computer.bluetooth_probe()
|
||||||
|
computer.sata_disk_probe()
|
||||||
return computer
|
return computer
|
||||||
|
|
||||||
def gpu_probe(self):
|
def gpu_probe(self):
|
||||||
@@ -475,3 +478,26 @@ class Computer:
|
|||||||
self.bluetooth_chipset = "BRCM20702 Hub"
|
self.bluetooth_chipset = "BRCM20702 Hub"
|
||||||
elif "Bluetooth":
|
elif "Bluetooth":
|
||||||
self.bluetooth_chipset = "Generic"
|
self.bluetooth_chipset = "Generic"
|
||||||
|
|
||||||
|
def sata_disk_probe(self):
|
||||||
|
# Get all SATA Controllers/Disks from 'system_profiler SPSerialATADataType'
|
||||||
|
# Determine whether SATA SSD is present and Apple-made
|
||||||
|
sp_sata_data = plistlib.loads(subprocess.run(f"system_profiler SPSerialATADataType -xml".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||||
|
for root in sp_sata_data:
|
||||||
|
for ahci_controller in root["_items"]:
|
||||||
|
# Each AHCI controller will have its own entry
|
||||||
|
# Skip entries that are AHCI PCIe controllers
|
||||||
|
# Apple's AHCI PCIe controller will report 'PCI' interconnect
|
||||||
|
if ahci_controller["spsata_physical_interconnect"] == "SATA":
|
||||||
|
# Note: 'spsata_physical_interconnect' was not introduced till 10.9
|
||||||
|
for port in ahci_controller["_items"]:
|
||||||
|
try:
|
||||||
|
if port["spsata_medium_type"] == "Solid State" and "apple" not in port["device_model"].lower():
|
||||||
|
self.third_party_sata_ssd = True
|
||||||
|
# Bail out of loop as we only need to know if there are any third-party SSDs present
|
||||||
|
break
|
||||||
|
except KeyError:
|
||||||
|
# SATA Optical Disk Drives don't report 'spsata_medium_type'
|
||||||
|
continue
|
||||||
|
print(f"SATA 3rd Party: {self.third_party_sata_ssd}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user