Contribute
Register

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

Joined
Jun 8, 2018
Messages
18
Motherboard
Gigabyte Z370 Aorus Gaming Ultra 2.0 - F11
CPU
i7-8700K
Graphics
RX 580
Mac
MacBook Pro, Mac mini
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?
 
Joined
Apr 11, 2013
Messages
7
Motherboard
Asus Maximus VI Hero Z87- Clover
CPU
i7-4770K
Graphics
GTX 1080 Ti (disabled) + HD 4600
Mac
iMac, MacBook
Mobile Phone
iOS
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:

Feartech

Moderator
Joined
Aug 3, 2013
Messages
16,642
Motherboard
Asus N752VX-OpenCore
CPU
i7-6700HQ / HM170
Graphics
HD 530 1920 x 1080
Mac
iMac
Mobile Phone
iOS
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
 
Joined
Oct 20, 2012
Messages
79
Motherboard
ASUS ROG Strix Z370-G
CPU
i7-8700K
Graphics
Vega 64
Mac
iMac, MacBook Pro
Mobile Phone
iOS
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?
 
Joined
Apr 11, 2013
Messages
7
Motherboard
Asus Maximus VI Hero Z87- Clover
CPU
i7-4770K
Graphics
GTX 1080 Ti (disabled) + HD 4600
Mac
iMac, MacBook
Mobile Phone
iOS
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?
 
Joined
Nov 8, 2016
Messages
70
Motherboard
ASUS PRIME Z390M PLUS (clover)
CPU
i7-9600K
Graphics
UHD 630
Mobile Phone
iOS
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
 
Joined
Sep 2, 2012
Messages
67
Motherboard
Dell Insprison 3543-Clover
CPU
i3-5005U
Graphics
HD 5500, 1366x768
Mac
MacBook Pro
Mobile Phone
Android
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
 
Joined
Apr 11, 2013
Messages
7
Motherboard
Asus Maximus VI Hero Z87- Clover
CPU
i7-4770K
Graphics
GTX 1080 Ti (disabled) + HD 4600
Mac
iMac, MacBook
Mobile Phone
iOS
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.
 

Feartech

Moderator
Joined
Aug 3, 2013
Messages
16,642
Motherboard
Asus N752VX-OpenCore
CPU
i7-6700HQ / HM170
Graphics
HD 530 1920 x 1080
Mac
iMac
Mobile Phone
iOS
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 :)
 
Joined
Jan 28, 2010
Messages
216
Motherboard
ASUS X99-E WS
CPU
E5-2697 V3 14-core
Graphics
GTX 760 2GB
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
 
Top