Contribute
Register

[Guide] USB power property injection for Sierra (and later)

Hi all, can I completely disable power of a specific USB port (only one though) during sleep? I use USBPorts.kext injection (Hackintool generated) with SSDT-EC.aml and SSDT-USBX.aml. Maybe the power values in SSDT-USBX.aml - kUSBSleepPortCurrentLimit and kUSBSleepPowerSupply - could be set to 0 for a specific USB port only? But where?

Background: My EIZO screen is connected via USB. If I turn it off during sleep, the computer wakes up (as I removed a USB hub which is in the screen).

In addition, I noted that when the system is shut down, USB ports are still charging. MacOS overrides my Bios ERP setting. If I turn ERP off and on again, boot Windows and shut down, USB ports are not charging. Starting macOS once, they charge again. Any idea how macOS could be stopped from changing the behavior set in BIOS?
 
I had originally posted this in the Catalina Desktop Support forum, but I think it should probably be here (Mods, feel free to delete the other post). I just finished a clean Catalina install with Clover and am getting the "USB Accessory Needs Power" message when plugging flash drives, iPhones, or iPads into any USB port aside from my powered hub. I'm using USBInjectAll and the same SSDT-UIAC that worked perfectly in my Sierra install, and my ports seem to be injecting properly. Note that this is a different config.plist from what I was using in Sierra, as I had to disable my Nvidia dGPU and use my iGPU with Catalina. I've followed the simplified version of this guide (renamed EC0 to EC, no SSDT-USBX.aml as I'm using the iMac 14,1 system definition), but still no luck. I'm not sure where to go from here.

Debug files are attached. Thanks in advance for any advice.

[EDIT: Removed debug files]
 
Last edited:
I had originally posted this in the Catalina Desktop Support forum, but I think it should probably be here (Mods, feel free to delete the other post). I just finished a clean Catalina install with Clover and am getting the "USB Accessory Needs Power" message when plugging flash drives, iPhones, or iPads into any USB port aside from my powered hub. I'm using USBInjectAll and the same SSDT-UIAC that worked perfectly in my Sierra install, and my ports seem to be injecting properly. Note that this is a different config.plist from what I was using in Sierra, as I had to disable my Nvidia dGPU and use my iGPU with Catalina. I've followed the simplified version of this guide (renamed EC0 to EC, no SSDT-USBX.aml as I'm using the iMac 14,1 system definition), but still no luck. I'm not sure where to go from here.

Debug files are attached. Thanks in advance for any advice.
try a different smbios, 14,2 for example
 
my DSDT have two devices with "PNP0C09":

FIRST
Device (H_EC)
{
Name (_HID, EisaId ("PNP0C09")) // _HID: Hardware ID
Name (_UID, One) // _UID: Unique ID
Method (_STA, 0, NotSerialized) // _STA: Status
{
Store (0x03, ^^^GFX0.CLID)
Return (Zero)
}
...

SECOND
Device (EC0)
{
Name (_HID, EisaId ("PNP0C09")) // _HID: Hardware ID
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
IO (Decode16,
0x0062, // Range Minimum
0x0062, // Range Maximum
0x00, // Alignment
0x01, // Length
)
IO (Decode16,
0x0066, // Range Minimum
0x0066, // Range Maximum
0x00, // Alignment
0x01, // Length
)
})
Name (_GPE, 0x16) // _GPE: General Purpose Events
Name (REGC, Zero)
Method (_REG, 2, NotSerialized) // _REG: Region Availability
{
If (LEqual (Arg0, 0x03))
{
Store (Arg1, REGC)
}
}

Method (_Q01, 0, NotSerialized) // _Qxx: EC Query
{
\AMW0.AMWN (0xA0040001)
}

Method (_Q02, 0, NotSerialized) // _Qxx: EC Query
{
\AMW0.AMWN (0xA0040002)
}

Method (_Q03, 0, NotSerialized) // _Qxx: EC Query
{
\AMW0.AMWN (0xA0040003)
}

Method (_Q0B, 0, NotSerialized) // _Qxx: EC Query
{
\AMW0.AMWN (0xA002000B)
}

Method (_Q87, 0, NotSerialized) // _Qxx: EC Query
{
Store (0x77, DBG8)
\AMW0.AMWN (0xA0040087)
}

Method (_Q88, 0, NotSerialized) // _Qxx: EC Query
{
\AMW0.AMWN (0xA0040088)
}

Method (_Q0C, 0, Serialized) // _Qxx: EC Query
{
Store (0x73, DPB2)
}
}
...

So I need to rename only the EC0 > EC, because the H_EC is returning zero from _STA, right?
 
try a different smbios, 14,2 for example

No luck. Switching to 14,2 resolved my laggy mouse and keyboard issue on initial boot, but didn't fix the "USB Accessory Needs Power" problem. However, what does work is removing USBInjectAll.kext and installing FakePCIID.kext + FakePCIID_XHCIMux.kext. All of my ports seem to work perfectly with USB2 split between EH01 and EH02 and USB3 on XHC.

Any reason why I shouldn't continue to use these kexts rather than USBInjectAll?
 
Thank you for the findings and for writing this guide RehabMan, I could make it work on my build! :clap:

I wrote a shorter guide for beginners not familiar with Hackintosh topics and the common inspector tools we use:
  • 1.) You can read "ioreg" several places but I cannot find a link or description at post #1 what ioreg actually is... So if you're wondering how you can view ioreg, there is an application called IORegistryExplorer (version 2.1 !), which you can download from here: https://www.tonymacx86.com/threads/guide-how-to-make-a-copy-of-ioreg.58368/ If you open it up it will show you a list in alphabetical order.. Look for the name "EC" (Embedded Controller), it will be before the FAN labels... If you can find the element called "EC" in there, continue with step 5.)

  • 2.) If the "EC" element is not there in the IORegistryExplorer, you need to check if you have EC0 or the H_EC name (or neither) under the hood in so called ACPI. There is another application to check that: MaciASL. It's also not mentioned in post #1, you can download it from here: RehabMan / OS-X-MaciASL-patchmatic / Downloads — Bitbucket. Open it up, press Command + F, and search for these terms: "Device (H_EC)" and "Device (EC0)". You will hopefully find the H_EC or the EC0 code block (not both). Don't bother with the meaning of the code you see, you don't have to understand it. There will be a code block in a few lines down, starting with "Method (_STA, ....". If you see a "Return (Zero)" in this {} block, then it means it's ignored as per post #1.
    So what we done in this step: You have to check if you have EC0 or H_EC device or neither in MaciASL. If you find EC0 or H_EC you need to check if it's ignored: "Return (Zero)" or not. Remember your findings...

  • 3.) Now you know what you have under the hood...
    • If you didn't have EC0 or H_EC device or it's returning Zero in method _STA, then you need to copy the file SSDT-EC.aml (attached to this post) to your main macOS drive's EFI partition, under EFI/CLOVER/ACPI/patched.
    • If you have found the EC0 or H_EC device in IORegistryExplorer and it's not returning Zero in method _STA, then you need to add a Clover config patch in EFI/CLOVER/config.plist to rename "EC0 to EC" or "H_EC to EC". Choose which one you have. The patch can be seen in post #1, under the title: "Insuring AppleBusPowerControllerUSB loads". In the picture, the config.plist file was opened in an application called Xcode, available free from the Mac App Store.

  • 4.) Restart you PC. Once macOS is loaded, open IORegistryExplorer again and check weather you see EC in the list. If "EC" shows up, everything is fine, continue with step 5.) If the name "EC" is still not there in IORegistryExplorer, start it over from 1.), more carefully.

  • 5.) Check your system definition in a built in macOS app called "System Information". Under the "Hardware Overview" section, you can find your system definition at "Model identifier", for example: iMac 18,3
    • If you have newer system definition than Macbook8,1 or MacBookAir7,2 or MacBookPro12,1 or MacPro6,1 or MacMini7,1 or iMac15,2 THEN copy the file SSDT-USBX.aml (attached to this post) to your main macOS drive's EFI partition, under EFI/CLOVER/ACPI/patched.
    • If you use one of the system def listed above or older, then you have nothing to do, continue with step 6.)

  • 6.) Restart your PC. Once macOS is loaded, plug in an iPhone or iPad to your Hackintosh with a USB cable. Open System Information app and choose the "USB" section from the left sidebar. Click on the iPhone or iPad in the list. If you can see all 4 lines you're won! ;)
    • Current Available (mA):
    • Current Required (mA):
    • Extra Operating Current (mA):
    • Sleep current (mA):
If all 4 lines are there, it's the obvious indicator of working USB power under macOS.​
Hope this post will help others to understand the process described in post #1.
THAT was easy. :D
 
hi all, this guide will be fix Disk not ejected properly issue after wake-up from sleep state, right?
Screen Shot 2019-11-21 at 22.38.13.png
 
No luck. Switching to 14,2 resolved my laggy mouse and keyboard issue on initial boot, but didn't fix the "USB Accessory Needs Power" problem. However, what does work is removing USBInjectAll.kext and installing FakePCIID.kext + FakePCIID_XHCIMux.kext. All of my ports seem to work perfectly with USB2 split between EH01 and EH02 and USB3 on XHC.

Any reason why I shouldn't continue to use these kexts rather than USBInjectAll?

I take that back @Feartech, you might have been right. I decided to do another clean Catalina install using the 14,2 smBIOS with my old serial number and smUUID from Sierra. Unfortunately, when I booted up the reinstall using FakePCIID.kext and FakePCIID_XHCIMux.kext, all of my USB2 wound up on EH01 with some ports failing to inject. I removed those kexts and went back to USBInjectAll with my old SSDT-UIAC and everything seems to work perfectly. All ports inject, and I don't get the "USB Accessory Needs Power" error. Not sure why things changed with the reinstall, but I thought I would post this in case someone runs into the same issue.
 
I take that back @Feartech, you might have been right. I decided to do another clean Catalina install using the 14,2 smBIOS with my old serial number and smUUID from Sierra. Unfortunately, when I booted up the reinstall using FakePCIID.kext and FakePCIID_XHCIMux.kext, all of my USB2 wound up on EH01 with some ports failing to inject. I removed those kexts and went back to USBInjectAll with my old SSDT-UIAC and everything seems to work perfectly. All ports inject, and I don't get the "USB Accessory Needs Power" error. Not sure why things changed with the reinstall, but I thought I would post this in case someone runs into the same issue.
yay! glad you have it working :)
 
You might want to update the OP.
In Catalina the list of support SMBIOS'es has been moved to IOUSBHostFamily/Contents/Info.plist no longer contains supported boardIDs.

@RehabMan
 
Back
Top