Skip to content

Commit 1e643ca

Browse files
committed
add T2 Chip Check to judge whether modern Audio can be used
1 parent 987bdc8 commit 1e643ca

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

oclp_r/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def __init__(self) -> None:
250250
self.set_vmm_cpuid: bool = False # Set VMM bit inside CPUID
251251
self.disable_mediaanalysisd: bool = False # Set mediaanalysisd to spawn
252252
self.force_quad_thread: bool = False # Force quad thread mode (cpus=4)
253-
self.allow_usb_patch: bool = True # Allow USB patch on macOS 26+
253+
self.allow_usb_patch: bool = False # Allow USB patch on macOS 26+
254254
self.set_alc_usage: bool = True # Set AppleALC usage
255255
self.allow_3rd_party_drives: bool = True # Allow ThridPartyDrives quirk
256256
self.allow_nvme_fixing: bool = True # Allow NVMe Kernel Space Patches

oclp_r/detections/device_probe.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ class Computer:
686686
oclp_sys_signed: Optional[bool] = False
687687
firmware_vendor: Optional[str] = None
688688
rosetta_active: Optional[bool] = False
689+
t2_chip: Optional[bool] = False
689690

690691
@staticmethod
691692
def probe():
@@ -704,6 +705,7 @@ def probe():
704705
computer.bluetooth_probe()
705706
computer.topcase_probe()
706707
computer.t1_probe()
708+
computer.t2_probe()
707709
computer.ambient_light_sensor_probe()
708710
computer.pcie_webcam_probe()
709711
computer.sata_disk_probe()
@@ -1014,7 +1016,27 @@ def t1_probe(self):
10141016
continue
10151017
self.t1_chip = True
10161018
break
1017-
1019+
def t2_probe(self):
1020+
"""Detect Apple T2 controllers by their physical PCI identifiers."""
1021+
matching = {
1022+
"IOProviderClass": "IOPCIDevice",
1023+
"IOPropertyMatch": [
1024+
{
1025+
"vendor-id": (0x106B).to_bytes(4, byteorder="little"),
1026+
"device-id": device_id.to_bytes(4, byteorder="little"),
1027+
}
1028+
for device_id in (0x1801, 0x1802)
1029+
],
1030+
}
1031+
devices = ioreg.ioiterator_to_list(
1032+
ioreg.IOServiceGetMatchingServices(ioreg.kIOMasterPortDefault, matching, None)[1]
1033+
)
1034+
device = next(devices, None)
1035+
if device:
1036+
self.t2_chip = True
1037+
ioreg.IOObjectRelease(device)
1038+
for device in devices:
1039+
ioreg.IOObjectRelease(device)
10181040
def sata_disk_probe(self):
10191041
# Get all SATA Controllers/Disks from 'system_profiler SPSerialATADataType'
10201042
# Determine whether SATA SSD is present and Apple-made

oclp_r/support/translate_language.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,7 @@ def gui_settings(self):
19021902
" - VoodooHDA: VoodooHDA patch ,":" - VoodooHDA: VoodooHDA patch ,",
19031903
" on Monterey and newer.":" on Monterey and newer.",
19041904
" Not recommended.":" Not recommended.",
1905-
"Allow Tahoe Modern USB Patch":"Allow Tahoe Modern USB Patch",
1905+
"Allow Tahoe Modern USB Patch (Deprecated)":"Allow Tahoe Modern USB Patch (Deprecated)",
19061906
"When enabled, this will patch the Old USB":"When enabled, this will patch the Old USB",
19071907
"extensions on Tahoe.":"extensions on Tahoe.",
19081908
"Allow APFS Patch For Non-T2":"Allow APFS Patch For Non-T2",
@@ -2332,7 +2332,7 @@ def gui_settings(self):
23322332
" - VoodooHDA: VoodooHDA patch ,":" - VoodooHDA: VoodooHDA 补丁,",
23332333
" on Monterey and newer.":" 在 Monterey 及更高版本上。",
23342334
" Not recommended.":" 不推荐。",
2335-
"Allow Tahoe Modern USB Patch":"允许 Tahoe 现代 USB 补丁",
2335+
"Allow Tahoe Modern USB Patch (Deprecated)":"允许 Tahoe 现代 USB 补丁(已弃用)",
23362336
"When enabled, this will patch the Old USB":"启用时,这将修补旧 USB",
23372337
"extensions on Tahoe.":"在 Tahoe 上的扩展。",
23382338
"Allow APFS Patch For Non-T2":"允许非 T2 设备的 APFS 补丁",

oclp_r/sys_patch/patchsets/hardware/audio/modern_audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def present(self) -> bool:
3535
"""
3636
AppleHDA was outright removed in macOS 26, so this patch set is always present if OS requires it
3737
"""
38-
return self._constants.audio_type == "AppleHDA"
38+
return self._constants.audio_type == "AppleHDA" and not self._computer.t2_chip
3939

4040
def requires_kernel_debug_kit(self) -> bool:
4141
"""

oclp_r/wx_gui/gui_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def _settings(self) -> dict:
751751
"wrap_around 1": {
752752
"type": "wrap_around",
753753
},
754-
self.trans["Allow Tahoe Modern USB Patch"]: {
754+
self.trans["Allow Tahoe Modern USB Patch (Deprecated)"]: {
755755
"type": "checkbox",
756756
"value": self.constants.allow_usb_patch,
757757
"variable": "allow_usb_patch",

0 commit comments

Comments
 (0)