Skip to content

Commit

Permalink
Update USB Map
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazzzny committed Mar 2, 2025
1 parent 7938659 commit 8c0e797
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 574 deletions.
7 changes: 1 addition & 6 deletions opencore_legacy_patcher/datasets/model_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,8 @@
# "MacPro6,1",
]

Missing_USB_Map_Legacy = [
# These machines were dropped before El Capitan, and as such, no proper USB maps exist for them.
# Instead, inject a custom USB map that forces all ports on the controller to be enabled.
"MacBook4,1"
]

Missing_USB_Map = [
"MacBook4,1",
"MacBook5,1",
"MacBook5,2",
"MacBook6,1",
Expand Down
2 changes: 1 addition & 1 deletion opencore_legacy_patcher/efi_builder/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def _firmware_compatibility_handling(self) -> None:
# Otherwise some graphics hardware will fail to wake, macOS will misreport hardware as ExpressCard-based,
# prevents MacPro6,1 from both booting unaccelerated and breaks low power states.
if (
self.model in ["MacPro6,1", "MacBookPro4,1"] or
self.model in ["MacPro6,1", "MacBookPro4,1", "MacBook4,1"] or
(
smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.CPUGen.sandy_bridge.value and \
not self.model.startswith("MacBook")
Expand Down
8 changes: 2 additions & 6 deletions opencore_legacy_patcher/efi_builder/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,24 +285,20 @@ def _usb_handling(self) -> None:

# USB Map
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
usb_map_path_legacy = Path(self.constants.plist_folder_path) / Path("AppleUSBMapsLegacy/Info.plist")

if (
usb_map_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.model in model_array.Missing_USB_Map_Legacy)
(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")
Path(self.constants.map_kext_folder).mkdir()
Path(self.constants.map_contents_folder).mkdir()

if self.model in model_array.Missing_USB_Map_Legacy:
shutil.copy(usb_map_path_legacy, self.constants.map_contents_folder)
else:
shutil.copy(usb_map_path, self.constants.map_contents_folder)
shutil.copy(usb_map_path, self.constants.map_contents_folder)
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.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"
Expand Down
140 changes: 138 additions & 2 deletions payloads/Kexts/Plists/AppleUSBMaps/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,145 @@
<key>kUSBSleepPowerSupply</key>
<integer>1500</integer>
<key>kUSBWakePortCurrentLimit</key>
<integer>1200</integer>
<integer>1500</integer>
<key>kUSBWakePowerSupply</key>
<integer>1700</integer>
<integer>2000</integer>
</dict>
<key>model</key>
<string>XacBookNormal4,1</string>
</dict>
<key>MacBook4,1-EHC1</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
<key>IOClass</key>
<string>AppleUSBHostMergeProperties</string>
<key>IONameMatch</key>
<string>EHC1</string>
<key>IOProviderClass</key>
<string>AppleUSBEHCIPCI</string>
<key>IOProviderMergeProperties</key>
<dict>
<key>port-count</key>
<data>
BgAAAA==
</data>
<key>ports</key>
<dict>
<key>PRT1</key>
<dict>
<key>UsbConnector</key>
<integer>0</integer>
<key>port</key>
<data>
AQAAAA==
</data>
</dict>
<key>PRT2</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
AgAAAA==
</data>
</dict>
<key>PRT3</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
AwAAAA==
</data>
</dict>
<key>PRT4</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
BAAAAA==
</data>
</dict>
<key>PRT5</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
BQAAAA==
</data>
</dict>
<key>PRT6</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
BgAAAA==
</data>
</dict>
</dict>
</dict>
<key>model</key>
<string>XacBookNormal4,1</string>
</dict>
<key>MacBook4,1-EHC2</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
<key>IOClass</key>
<string>AppleUSBHostMergeProperties</string>
<key>IONameMatch</key>
<string>EHC2</string>
<key>IOProviderClass</key>
<string>AppleUSBEHCIPCI</string>
<key>IOProviderMergeProperties</key>
<dict>
<key>port-count</key>
<data>
BAAAAA==
</data>
<key>ports</key>
<dict>
<key>PRT1</key>
<dict>
<key>UsbConnector</key>
<integer>255</integer>
<key>port</key>
<data>
AQAAAA==
</data>
</dict>
<key>PRT2</key>
<dict>
<key>UsbConnector</key>
<integer>0</integer>
<key>port</key>
<data>
AgAAAA==
</data>
</dict>
<key>PRT3</key>
<dict>
<key>UsbConnector</key>
<integer>2</integer>
<key>port</key>
<data>
AwAAAA==
</data>
</dict>
<key>PRT4</key>
<dict>
<key>UsbConnector</key>
<integer>0</integer>
<key>port</key>
<data>
BAAAAA==
</data>
</dict>
</dict>
</dict>
<key>model</key>
<string>XacBookNormal4,1</string>
Expand Down
Loading

0 comments on commit 8c0e797

Please sign in to comment.