Add USB mappings for macOS 26

This commit is contained in:
Jazzzny
2025-06-30 09:10:40 -04:00
parent 9be3dc8d58
commit feca197ade
5 changed files with 10711 additions and 19 deletions

View File

@@ -689,10 +689,18 @@ class Constants:
def map_kext_folder(self):
return self.kexts_path / Path("USB-Map.kext")
@property
def map_kext_folder_tahoe(self):
return self.kexts_path / Path("USB-Map-Tahoe.kext")
@property
def map_contents_folder(self):
return self.map_kext_folder / Path("Contents")
@property
def map_contents_folder_tahoe(self):
return self.map_kext_folder_tahoe / Path("Contents")
@property
def pp_kext_folder(self):
return self.kexts_path / Path("CPUFriendDataProvider.kext")

View File

@@ -285,19 +285,26 @@ xw
# USB Map
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
usb_map_tahoe_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info-Tahoe.plist")
if (
usb_map_path.exists()
and usb_map_tahoe_path.exists()
and (self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True)
and self.model not in ["Xserve2,1", "Dortania1,1"]
and (
(self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura)
or self.constants.serial_settings in ["Moderate", "Advanced"])
):
logging.info("- Adding USB-Map.kext")
logging.info("- Adding USB-Map.kext and USB-Map-Tahoe.kext")
Path(self.constants.map_kext_folder).mkdir()
Path(self.constants.map_kext_folder_tahoe).mkdir()
Path(self.constants.map_contents_folder).mkdir()
Path(self.constants.map_contents_folder_tahoe).mkdir()
shutil.copy(usb_map_path, self.constants.map_contents_folder)
# for the tahoe, need to copy but rename to Info.plist
shutil.copy(usb_map_tahoe_path, self.constants.map_contents_folder_tahoe / Path("Info.plist"))
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map-Tahoe.kext")["Enabled"] = True
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"

View File

@@ -67,6 +67,24 @@ class BuildSMBIOS:
logging.info("- Adding -no_compat_check")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
def _strip_usb_map(self, map_path, model, spoofed_model, serial_settings):
config = plistlib.load(Path(map_path).open("rb"))
for entry in list(config["IOKitPersonalities_x86_64"]):
if not entry.startswith(model):
config["IOKitPersonalities_x86_64"].pop(entry)
else:
try:
config["IOKitPersonalities_x86_64"][entry]["model"] = spoofed_model
if serial_settings in ["Minimal", "None"]:
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH01":
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC1"
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH02":
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC2"
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "SHC1":
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "XHC1"
except KeyError:
continue
plistlib.dump(config, Path(map_path).open("wb"), sort_keys=True)
def set_smbios(self) -> None:
"""
@@ -142,24 +160,10 @@ class BuildSMBIOS:
and ((self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura) or self.constants.serial_settings in ["Moderate", "Advanced"])
):
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
map_config = plistlib.load(Path(new_map_ls).open("rb"))
# Strip unused USB maps
for entry in list(map_config["IOKitPersonalities_x86_64"]):
if not entry.startswith(self.model):
map_config["IOKitPersonalities_x86_64"].pop(entry)
else:
try:
map_config["IOKitPersonalities_x86_64"][entry]["model"] = self.spoofed_model
if self.constants.serial_settings in ["Minimal", "None"]:
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH01":
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC1"
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH02":
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC2"
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "SHC1":
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "XHC1"
except KeyError:
continue
plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True)
new_map_ls_tahoe = Path(self.constants.map_contents_folder_tahoe) / Path("Info.plist")
self._strip_usb_map(new_map_ls, self.model, self.spoofed_model, self.constants.serial_settings)
self._strip_usb_map(new_map_ls_tahoe, self.model, self.spoofed_model, self.constants.serial_settings)
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
# Adjust CPU Friend Data to correct SMBIOS
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")

View File

@@ -763,6 +763,24 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>USB Map for Tahoe</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>25.0.0</string>
<key>BundlePath</key>
<string>USB-Map-Tahoe.kext</string>
<key>ExecutablePath</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>

File diff suppressed because it is too large Load Diff