Contribute
Register

USB port limit patch for 14.1, 14.2, 14.3, 14.5,14.6

@ydeng
This saved the day for me! All USB2 & 3 ports visible and working. Thank you
Do you still need USBInjectAll.kext together with the 3 patches?
Reading your last implies that EH01/02/EHC can be removed from port definitions?
 
Only applies to XHCI controllers. Removing explicit port definitions in DSDT and naming controllers to XHC (or anything not XHC1) so that AppleUSBXHCIPCI Info.plist do not provide default port definitions causes AppleUSBXHCI to enumerate all ports from controller capability registers. If you route EHCI controller ports to XHC by defining

<key>IOProviderMergeProperties</key>
<dict>
<key>kUSBMuxEnabled</key>
<true/>
</dict>

in AppleUSBEHCIPCI.kext/Contents/Info.plist or a separate AppleUSBMergeNub kext, it might work.
 
Confirmed this is working ! I used all three patches. Not sure if its a culmination of all previous patches but I currently have this patch, USBinjector, Custom USB Kext made from another guide with FB patcher/Hackintool
 
@ydeng you made my day! thanks a LOT for this one i was struggeling on USB3 for weeks.
I applied the 3 patches + the @edisonleenan one you mentioned and USB3 works perfectly at full speed.
Thanks you guys!
Romain
 
Can these patches be made directly/literally as in the first post to config.plist via a text editor under Linux? After the upgrade to Mojave on one of my machines, my USB keyboard and mouse don't work so I can't get past the login screen and therefore can't do it in Clover Configurator. It seems that the values are given as hashes rather than hex values:

<string>USB Port limit patch 10.14 (credits FredWst)</string>
<key>MatchOS</key>
<string>10.14.x</string>
<key>Name</key>
<string>com.apple.driver.usb.AppleUSBXHCI</string>
<key>Find</key>
<data>g32UDw+DlwQAAA==</data>
<key>Replace</key>
<data>g32UD5CQkJCQkA==</data>

This apparently should work, but doesn't. Should I change the data values as in the first post?

I can do the edits under Linux after mounting the MacOS EFI partition.

Thanks!
 
Thanks @ydeng! You rock! :headbang:
After adding the patches mentioned in post1 I created a SSDT-UIAC.aml file using the USBMap script.
The patch allowed to run the script without disabling the SS_ or HS_ ports to perform the scan.
Actually, the USBMap guide should be made sticky.

After adding the SSDT to EFI/CLOVER/ACPI/patched and specifying the file name in the SortedOrder list I disabled the kext patches.

USB 3 works on all the blue ports. USB 2 works on all the black ports and the internal bluetooth module is working.

Attached the SSDT-UIAC.aml and USBMap.kext files for the Asrock H370m-ITX/ac with 6 USB2 ports: 5 internal ports and 2 at the back of MLB and 9 USB3 ports: 2 front panel and all the 3.1 ports on the MLB but the 3.2 ports (light blue).
 

Attachments

  • USBMap.zip
    3.8 KB · Views: 148
Last edited:
Some people say there might be memory error by allowing port number to go above 15. That is not true because AppleUSBXHCI actually read hardware registers to allocate memory, for example activeDeviceSet is constructed from Max Device Slots value in HCSPARAMS1. Port limit checks can be safely removed. People might wonder why the first place to limit ports is in AppleUSBXHCI not AppleUSBXHCIPCI. Well, AppleUSBXHCIPCI constructs ports property and calls super class (AppleUSBXHCI) method to enumerate ports. If ports property is defined, only ports listed will be constructed. If no such property exists, AppleUSBXHCI goes through all capabilities defined in the controller. That means by deleting all ACPI USB port definitions, all ports will be enumerated!

Just to be clear, are you saying that removing the port limit allows OSX to automatically enumerate all the ports safely? If that's the case, why would we even need an SSDT?
 
Last edited:
This following patch allows root hub port limit over 0xf to 0x3f.

Patch 1
Comment: USB port limit patch 10.14.1 10.14.2 (credit ydeng)
Name: IOUSBHostFamily
Find: 00e0 83fb 0f0f 8716 0400
Replace: 00e0 83fb 3f0f 8716 0400

This need to be used together with AppleUSBXHCI patch published elsewhere (https://www.tonymacx86.com/threads/solved-mojave-10-14-1-update-lost-usb-3-0.264125/).

Patch 2
Comment: USB Port limit patch 10.14.1, 10.14.2
Name: com.apple.driver.usb.AppleUSBXHCI
Find: 00 00 83 FB 0F 0F 83 8F 04 00 00
Replace: 00 00 83 FB 3F 0F 83 8F 04 00 00

Mojave 14.1 has an additional check in AppleUSBHostPort::setPortLocation to limit maximum number of ports to 0xf.

__text:0000000000015CC6 test ebx, ebx; port number passed in the argument, zero for root hub ports
__text:0000000000015CC8 jnz short loc_15CD2
__text:0000000000015CCA mov ebx, [r12+0D0h] ; port id from port property
__text:0000000000015CD2 loc_15CD2:
__text:0000000000015CD2 mov r14d, 0E00002C2h
__text:0000000000015CD8 cmp ebx, 0Fh ; check port id is not above 0xf
__text:0000000000015CDB ja loc_160F7

Patch 3
One more to fix port names: https://www.tonymacx86.com/threads/usb-port-limit-patch-for-14-1-14-2-14-3.268893/#post-1888473

Hello @ydeng - You are doing some great work here, thank you, but please complete your PROFILE as outlined in the Official site Rules.

There seem to be limitations to these patches as they don't work on all hardware. It would be useful to know which motherboards/chipsets they work with :thumbup:
 
Hello @ydeng - You are doing some great work here, thank you, but please complete your PROFILE as outlined in the Official site Rules.

There seem to be limitations to these patches as they don't work on all hardware. It would be useful to know which motherboards/chipsets they work with :thumbup:
it's already in the signature :)
 
Back
Top