bugtracker icon indicating copy to clipboard operation
bugtracker copied to clipboard

Changes in Catalina's USB IOClass

Open Mushmuch opened this issue 5 years ago • 15 comments

Hi, I had Sleep issues with USB on my MSI B450i board until I compared the USB mapping kext with the actual kext it is supposed to patch in macOS 10.15.5

In the current AMD-USB-Map.kext, the CFBundleIdentifier and IOClass parameters do not match the values found in /System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns/AppleUSBHostPlatformProperties.kext/Contents/Info.plist

Currrent USB-MAP Catalina 10 15 5

Mushmuch avatar Jun 04 '20 20:06 Mushmuch

MergeNub is still supported in Catalina, and there's actually IOService issues with HostMergeProperties that USBMap faced in the past where an existing map would actually merge with your new map. So MergeNub is still the desired property to use, though newer SMBIOS without an existing map could use either.

If your USB map wasn't applying then there would be some concern, but none of my machine have issues with MergeNub. I may look down the line to use HostMergeProperties if the previous issues were resolved recently though last time I checked was a bit after Catalina's launch

khronokernel avatar Jun 04 '20 20:06 khronokernel

Actually, the USB Map was not working. One port was missing (PO12) even if it was clearly defined in the DSDT. So I used a SSDT renaming PTXH to SHC1 and pasting the 7 ports from the DSDT. I was still having issues with sleep as long as the XHC0 controller was present so I had to remove XHC0 with as SSDT as well. Something was not right.

Today I changed USBMergeNub for USBHostMergeProperties and the PO12 port on PTXH is now mapped correctly without using the SSDT. The hack sleeps with XHC0 also. The only issue left is the hack won't sleep with a USB hub connected.

Info.plist.zip I'm no expert but it is working and It seems right as the format is matching Apple's kext.

Config: B450, 3900x, MacPro7,1, OC 0.5.9, 10.15.5

Mushmuch avatar Jun 04 '20 21:06 Mushmuch

Hmm quite interesting, gonna reopen this issue and look into it a bit more. Thank you for bringing this to me

khronokernel avatar Jun 04 '20 21:06 khronokernel

Many many thanks to you! Just to clarify. The sleep crash I was getting is exactly as described in the Troubleshooting section. It still hangs and crashes to sleep when connecting a USB 3 hub to one of the XHC0 ports. PTXH is ok. I wonder how to correctly determine the appropriate USBX current values for the 1022:149c controller.

Mushmuch avatar Jun 04 '20 23:06 Mushmuch

I wonder how to correctly determine the appropriate USBX current values for the 1022:149c controller.

How it's done for Intel controllers back in the day was incrementing up by 100 until you got instability with iPad charging. So one thing to try is actually go down by 100 though I do worry the underlying issue is Apple no supporting AMD's brand of controllers all too well and USBX values may be a waste. I also don't own any AMD hardware so testing is much more difficult, I suppose my only other idea is look into power states(Method (_PS0, 3, etc) in ACPI and see if there's anything off with them

khronokernel avatar Jun 04 '20 23:06 khronokernel

Thanks! So to give you an update, I tried to determine which values were actually changing the USB power properties: USBX or the AppleUSBHostMergeProperties method in the USB-MAP kext. I tried different values for kUSBWakePowerSupply to see which one would appear in IOReg. The result was surprising: it stays at 0x834 regardless of what I enter in USBX or the Kext... So I disabled SSDT-USBX-EC.aml altogether and guess what? It boots, sleeps and the USB ports are powered. The USB devices disconnect during sleep as before. So my conclusion is that the current USBX method is not working on my MacPro7,1 AMD B450 config.

Mushmuch avatar Jun 05 '20 17:06 Mushmuch

That's quite interesting, I'm curious if it's actually AppleBusPowerController that doesn't like AMD. Can you try removing the USBX portion out of the SSDT and see if that makes a difference?

khronokernel avatar Jun 05 '20 17:06 khronokernel

So I did the following testing: No SSDT-EC, no SSDT-USBX, no AppleBusPowerController properties (kext):

  • It boots
  • it sleeps
  • the iPad charges
  • there is no kUSBWakePortCurrentLimit value in IOReg
  • the USB Devices are disconnected and reconnected on wake

No SSDT-EC, no SSDT-USBX, AppleBusPowerController properties for MacPro7,1 with kUSBWakePortCurrentLimit set to 2000mA (0x7D0):

  • It boots
  • it sleeps
  • the iPad charges
  • The kUSBWakePortCurrentLimit value in IOReg is 0x7D0
  • the USB Devices are disconnected and reconnected on wake

SSDT-EC, no SSDT-USBX, AppleBusPowerController properties for MacPro7,1 with kUSBWakePortCurrentLimit set to 2000mA (0x7D0):

  • It boots
  • it sleeps
  • the iPad charges
  • The kUSBWakePortCurrentLimit value in IOReg is 0x7D0
  • the USB Devices are disconnected and reconnected on wake

SSDT-EC, SSDT-USBX (kUSBWakePortCurrentLimit=0x834) , AppleBusPowerController properties for MacPro7,1 kUSBWakePortCurrentLimit set to 2000mA (0x7D0):

  • It boots
  • it sleeps
  • the iPad charges
  • The kUSBWakePortCurrentLimit value in IOReg is 0x7D0
  • the USB Devices are disconnected and reconnected on wake

So I can conclude that the AppleBusPowerController value in the kext overrides the USBX value. Also, the presence of the USBX and EC SSDTs have little impact on the power management of the MacPro7,1 SMBIOS on AMD B450 and Ryzen 3.

Note: if I remove the AppleUSBHostMergeProperties method for PTHX in the kext, I loose one port (PO12) and the hack won't sleep.

I guess that the T2 chip is handling all of the power matters the MacPro7,1, so EC and USBX might not be relevant. Looking at a MacPro7,1 DSDT would help.

USB-SSDTs_and_Kext.zip

Mushmuch avatar Jun 05 '20 18:06 Mushmuch

IOReg, DSDT, etc, from the MacPro7,1 https://github.com/khronokernel/DawinDumped/tree/master/MacPro/MacPro7%2C1

averycblack avatar Jun 05 '20 18:06 averycblack

@Mushmuch would you mind re-uploading your USB-SSDTs_and_Kext.zip zip file? Github seems have to removed it.

kprinssu avatar Jul 25 '20 22:07 kprinssu

I can confirm I was also having sleep issues and deleting my SSDT EC USBX solved it, I also have done a proper mapping of my USB Ports, now it works even having a USB2 connected to a XHC0 USB3 port. I have a b450 tomahawk and ryzen 3 series. Running Catalina also

felipejfc avatar Aug 05 '20 20:08 felipejfc

@felipejfc Do you mind uploading your SSDT and USB mapping kext?

kprinssu avatar Aug 07 '20 20:08 kprinssu

I have same problem but I didn't disable XHC0 completely, I just mapped the USB3.1 properties of my ports. PRT1-PRT4 were used for USB2.0, now when I connect a usb 2.0 device it doesn't work but sleep works with the device connected, usb3.x devices work fine and it also sleeps fine. Screen Shot 2020-08-27 at 12 43 32

lucyr03 avatar Aug 27 '20 09:08 lucyr03

Are you guys actually seeing "extra operating current" and "sleep current" fields displaying under System Information > USB? I have stable use of all my ports at usb 2 and 3 speeds with any of these variations, but none of them get the full power as would be reported in system info. I'm on the amd/matisse usb controller and imacpro smbios too.

johncolby avatar Dec 18 '20 09:12 johncolby

NB, for my case it was an issue/bug(?) with the USBmap.py name matching. See here for my final working example:

https://github.com/corpnewt/USBMap/issues/20

johncolby avatar Dec 19 '20 00:12 johncolby