Skip to main content

Create an SSDT to fix USB (RehabMan's way)

This is how I made an SSDT for the motherboard of my Hackintosh.

All credit goes to RehabMan and the tonymacx86.com community. Here's the original article with the process.


Disclaimer: I followed these steps for my hardware, after studying a lot about SSDT and how USB ports are recognized in macOS, mostly from RehabMan's articles on tonymacx86.com. 
PLEASE BACKUP YOUR SYSTEM BEFORE ATTEMPTING THIS. I TAKE NO RESPONSIBILITY IF YOU SKIPPED A STEP, OR MISSED A BRACKET ON THE CODE SOMEWHERE. 

Note: If you have different hardware, the process might be a bit different for you. Please follow RehabMan's guide from the link above to make sure you follow all instructions clearly according to your hardware requirements.





Motherboard: AORUS 1151 GIGABYTE Z270X-GAMING-9


What I used


Preparation

  1. In BIOS settings, set the XHCI and/or Legacy USB Devices to Auto or Smart Auto
  2. Install USBInjectAll.kext in your /Library/Extensions folder. You can use the KextBeast software for easy installation (download here). Just place the kext on your Desktop, run KextBeast and select /Library/Extensions as the destination.
  3. Open Clover Configurator. Click on Mount EFI from the left side, and click on Mount Partition of the proper EFI partition.
  4. Open the File menu and click the Open command.
  5. Navigate to the EFI/EFI/Clover folder and open config.plist.
  6. From Sections on the left, navigate to Acpi.
  7. Click on the List of patches context menu, and click on Change EHC1 to EH01. Click also on Change EHC2 to EH02.
  8. Add manually the following patch: Comment: change XHC1 to XHC . Find: 57456844 4D51 . Replace: 57456844 5877 .
  9. Don't forget to Save.

PCI Device ID Discovery

  1. Open the Apple menu and click About this Mac.
  2. From the Overview tab, click on the System Report button.
  3. From the Hardware list on the left, click on USB. I have a USB-C type port on my motherboard, so I had the USB-C dongle connected.
  4. Click on USB 3.0 Bus, and write down for later the PCI Device ID from the information below. Mine is 0xa2af.
  5. Click on USB 3.1 Bus, and write down for later the PCI Device ID from the information below. Mine is 0x15d4.

Port Discovery 

  1. Get your USB devices ready.
  2. Open the IORegistry Explorer app.
  3. Make sure you stay on IOService pane and do NOT use the Search function.
  4. Change from List view to Column view.
  5. Navigate to Root -> iMac 18,3 (you might have a different model there) -> AppleACPIPlatformExpert -> PCI0@0 -> AppleACPIPCI -> XHC@14 -> XHC@14000000. Remember your steps might be different if you have different hardware.
  6. Now within this XHC@14000000 start testing your ports, one by one. First each with the USB 2.0 device, then each with the USB 3.0. You might need to move the USB keyboard & mouse in order to test the occupied ports as well. 
  7. The USB 2.0 devices will occupy HS ports (HS01 etc). As you insert and remove the device, observe the IORegistry Explorer (there should be an arrow next to each port with its assignment when you connect the device to that port, and a red device name when you disconnect it). 
  8. Write down for later only the occupied USB 2.0 devices with a device assignment (HS01, HS02, HS06, etc). Don't forget the one assigned to Bluetooth. (You may have more assigned to a built-in webcam or other devices, especially if you're on a laptop. Write those down too).
  9. My HS ports already reached the 15-port limit, so I have to disable them with a kernel flag in order to test the SS (USB 3.0) ports). In order to do that, upon boot, I have to add the kernel flag  -uia_exclude_hs uia_include=HS01 where "HS01" is the corresponding port(s) that has your keyboard and mouse, so that you can work. Make sure you identify the right HSxx from the IORegistry Explorer. In my case I needed to include HS05 for the mouse.
  10. Now test them with the USB 3.0 device. The ports will be SS (SS01 etc). Again write down for later only those SS ports that have the connected device name under them.
  11. You may or may not have occupied USRx, HPxx PRxx or other types of ports depending on your hardware. Write those down as well if you do. Check RehabMan's guide for more details. 

 Making the custom SSDT

  1. Run the MaciASL app.
  2. Open the MaciASL menu and click on Preferences.
  3. Navigate to the iASL tab and ensure that under the Compiler Options the ACPI 6.2a is selected.
  4. Close the maciASL app.
  5. Now open the SSDT-UIAC-ALL.dsl template. It should open with the MaciASL app.
  6. Now you need to look at the PCI Device IDs you collected before. Mine were a2af and 15d4 from the 8086 family. These are the packages we keep. 
  7. You need to remove the packages that don't match the names of your PCI Device IDs. For instance, I don't need the "8086_1e31", Package() as it doesn't match my hardware. So from that "8086_1e31", Package() until the end of its ports    "port", Buffer() { 8, 0, 0, 0 },
                        },
    (that's right, that extra bracket as well), you need to delete. Repeat, carefully, for each device ID that doesn't match yours. 
  8. Basically I needed to delete everything from "HUB1", Package() till all the way down to the last one before the "8086_a2af", Package() starts. Do NOT delete the code above "HUB1".
  9. Check the brackets at the end, there should be 6 of them. Delete any extra brackets. Compare them with the rest of the code at the beginning to make sure.
  10. Now that only your PCI Device IDs are left, check your list of HS and SS ports. Any HSxx numbers you don't have, you should remove them. For instance, I don't need HS09, H010 etc. Same with SSxx ones. I need only the range from SS01 until SS06 ports. And I don't need the USR ports either. Remember to leave the 6 brackets at the end.
  11. Double-check everything. When you're done, open the File menu and click Save As
  12. From the File Format, select ACPI Machine Language Library. I named it SSDT-UIAC.aml and saved it on my Desktop.

Applying it to EFI

  1. Open Clover Configurator. Mount your EFI partition.
  2. Copy the SSDT-UIAC.aml file in EFI/Clover/ACPI/patched.
  3. Go back to Clover Configurator and load your config.plist file.
  4. Make sure you are in the ACPI section from the left.
  5. On the bottom right, you will see a Sorted Order list box. Click the + sign to add the name of your file (SSDT-UIAC.aml) to Sorted Order.
  6. Remember to save your changes. Restart your computer to take effect.

Disclaimer: The content provided in this article is for informational purposes only. You are solely responsible for verifying the information as being appropriate for your personal use.

Popular posts from this blog

Bullet Journal and Task Management in Obsidian (part 1)- Free Vault for download and Folder Structure

This is the vault in Obsidian that I use daily as a bullet journal and task manager. This is going to be a series of posts on explaining how I use this vault.   Download the full vault .zip file here . Extract it, save the folder to your desired location and then open it from Obsidian. If you just want the snippets, download the snippets .zip file here . Extract and paste the CSS snippets to your .obsidian/snippets folder (show hidden files and folders in your file explorer). For a list of the alternate checkboxes you can use, see here (you don't need the minimal theme, the CSS snippet I have enabled will work on any theme, even the default one):  https://minimal.guide/Block+types/Checklists Folder Structure I have 3 parent folders: inbox - this is where I have Obsidian automatically store any new note I create journal - this is where I have Obsidian automatically store daily notes. I keep the current month in there, then when the month ends, I review and archive by month ...

NVIDIA Web Drivers Mojave Workaround

It is still uncertain when will NVIDIA release any Web Drivers for macOS Mojave, but we can try a workaround.

How to rebuild cache and repair permissions of kexts in a Hackintosh

After installing 3rd-party kexts in /Library/Extensions, or replacing vanilla kexts with patched kexts in System/Library/Extensions, you may want to repair their permissions and rebuild the kext cache to ensure they work as intented. Here's how.