Contribute
Register

USB Devices ejected after Sleep

Status
Not open for further replies.
I have now attached the Problem Reporting Files. For the instant Wake I had used in the past were I had patched directly my DSDT with these patches usb_prw_0x6d_xhc_skl.txt and usb_prw_0x0d_xhc_skl.txt and then I had no instant wake anymore. Maybe there is a possiblity to implement these patches with an Hotpatch? I have also moved the Kext from the Clover Folder to /Library/Extensions and edit the SSDT-IGPU.dsl with only one Patch that will disable may DGPU. I have modified the SSDT-PRW and removed the Part with UPRW since it never gets patched by Clover and now only the Part with GPRW is in it and Sleep works with that without instant wake.
 

Attachments

  • Problem_Reporting.zip
    2.2 MB · Views: 98
Last edited:
I have now attached the Problem Reporting Files. For the instant Wake I had used in the past were I had patched directly my DSDT with these patches usb_prw_0x6d_xhc_skl.txt and usb_prw_0x0d_xhc_skl.txt and then I had no instant wake anymore. Maybe there is a possiblity to implement these patches with an Hotpatch? I have also moved the Kext from the Clover Folder to /Library/Extensions and edit the SSDT-IGPU.dsl with only one Patch that will disable may DGPU.

You should not apply multiple _PRW patches.
Apply only the patch that corresponds to the value your native DSDT uses (it is obvious when looking at the preview in MaciASL).
Your DSDT uses 0x6d. Look at _PRW in XHC for example:
Code:
            Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
            {
                Return (GPRW (0x6D, 0x04))
            }

You could patch GPRW and UPRW in order to solve instant wake (essentially disabling USB wake).
There are patches in the hotpatch repo that do this... (for GPRW), but the UPRW you will need to write custom code as it is different from other UPRW methods I've seen.
I would either patch _PRW in XHC directly (eg. create a targeted rename patch for it, and provide new XHC._PRW in an SSDT), or rename the UPRW method, to provide a replacement for it in an SSDT.

Or you might take the approach I just did with the Intel ComputeStick. I found that it suffered from "instant wake", but I did not want to disable wake on USB (it is a desktop, and the power button is very small and likely hard to reach).

I found that two things were causing instant wake... by checking "Wake reason" after an instant wake event:
Code:
log show --predicate processID==0 --info --debug|grep -y "Wake reason"

Showed that GLAN and XDCI were causing the wake...
Then I looked in ioreg and found that GLAN and XDCI were not present in IOService. GLAN I could have predicted as this device has WiFi only. XDCI I would have to read up on it in the 100-series chipset data sheet to understand why it is not present...

But no matter, the problem is these two devices declare a _PRW, return "present" from _STA, but are not present on the PCIe bus... The fix (which I tested first with static patch), is to return 0 from _STA, or patch _PRW as normal... Either worked. But _STA turned out easier to patch with hotpatch, so I went that route.

Your first task is to determine which device is causing the instant wake (run the "log show" I mention above after an instant wake event). From there you can decide how to address it.

Just looking at the ioreg, I can see that you don't have any Ethernet, and you do have a GLAN device... and a XDCI device... and both are not present in IOService. In fact, your DSDT with regard to these two objects is identical to the code for my Intel ComputeStick... If it turns out this is the cause, you can probably use the same solution already checked into my NUC repo.
 
Yes you have right that it looks like that it is the GLAN and XDCI Device. When I run your command after the instant Wake then I get these Outputs. I only have an USB Ethernet Adapter but no built in LAN. I have no multiple Patches applied for wake this was only an hint what I had made before.

Code:
2017-05-27 15:06:09.777224+0200 0x73       Default     0x0                  0      kernel: (AppleACPIPlatform) Wake reason: GLAN XDCI
2017-05-27 15:06:09.777225+0200 0x73       Default     0x0                  0      kernel: (AppleACPIPlatform) Wake reason: GLAN XDCI

I have found in your NUC Repo this .dsl File SSDT-STCK6.dsl which has two Entries for GLAN and XDCI can I only copy the part of Name(_SB.PCI0.XDCI._STA, 0) and Name(_SB.PCI0.GLAN._STA, 0) into an new SSDT File or is there more work needed?
 
Yes you have right that it looks like that it is the GLAN and XDCI Device. When I run your command after the instant Wake then I get these Outputs. I only have an USB Ethernet Adapter but no built in LAN. I have no multiple Patches applied for wake this was only an hint what I had made before.

Code:
2017-05-27 15:06:09.777224+0200 0x73       Default     0x0                  0      kernel: (AppleACPIPlatform) Wake reason: GLAN XDCI
2017-05-27 15:06:09.777225+0200 0x73       Default     0x0                  0      kernel: (AppleACPIPlatform) Wake reason: GLAN XDCI

I have found in your NUC Repo this .dsl File SSDT-STCK6.dsl which has two Entries for GLAN and XDCI can I only copy the part of Name(_SB.PCI0.XDCI._STA, 0) and Name(_SB.PCI0.GLAN._STA, 0) into an new SSDT File or is there more work needed?

You also need the patch that renames XDCI._STA to XSTA. Look at config_stick6.plist.
 
I have now applied the Rename of XDCI._STA to XSTA and created the SSDT that GLAN and XDCI are set to 0 and the Laptop has no instant wake anymore but the Eject of the USB Device is still there. I don't know if this is maybe related to the USB Hub or maybe that it get not enough power when the Laptop does the WakeUp. I have attached the Problem Reporting Files.
 

Attachments

  • Problem_Reporting.zip
    2.2 MB · Views: 92
I have now applied the Rename of XDCI._STA to XSTA and created the SSDT that GLAN and XDCI are set to 0 and the Laptop has no instant wake anymore but the Eject of the USB Device is still there. I don't know if this is maybe related to the USB Hub or maybe that it get not enough power when the Laptop does the WakeUp. I have attached the Problem Reporting Files.

No clean solution exists for the eject over sleep issue...
I have this in my notes...

premature sleep eject

https://www.tonymacx86.com/threads/...another-solution-but-this-one-is-free.164938/
 
I tried the Github Solution in this Thread but id didn't solved the Problem with the USB Eject. This is only happening when the USB Stick is in the USB Hub. When it is directly attached to an USB Port without an USB Hub then everything is fine after the Sleep. I also noticed when my Laptop comes back from Sleep that I have to press an Key that I get an Picture again or is this an normal behaviour of OS X? If you don't have anymore tip how to fix the USB Ejection with an USB Hub then I have to life with it.
 
I tried the Github Solution in this Thread but id didn't solved the Problem with the USB Eject. This is only happening when the USB Stick is in the USB Hub. When it is directly attached to an USB Port without an USB Hub then everything is fine after the Sleep.
...
If you don't have anymore tip how to fix the USB Ejection with an USB Hub then I have to life with it.

I have not tried that solution, but obviously you should check the script to see if it is ejecting all your external devices.
And if it works by putting it in a regular port, perhaps that's what you should do.
I tend to not have devices plugged in across sleep, as for the most part I use USB devices as backup or for temporary use. My feeling is that a backup drive should not be constantly connected/powered, but rather only plugged in when performing a backup and stored to a safe place when not actively creating a backup.

I also noticed when my Laptop comes back from Sleep that I have to press an Key that I get an Picture again or is this an normal behaviour of OS X?

Not normal. I don't have the same issue here on any of my systems...
Perhaps it depends on how you wake the laptop. You provided no details.
You might try without Skiki.kext. I don't use it as I have no need to playback DRM content.

Note: You still have ForceKextsToLoad in your config.plist, which is clearly documented in my guide as a pre-install thing only...
 
I have started USB Eject Scripts via Terminal and the Sleep Scripts works and eject the USB Stick correctly. When I start the Wake Script then it says it can find the Disk which was ejected before. Then I think it can't work when the whole Device will be ejected maybe it is better only the Mounted Partition will be ejected and not the whole device itself. I did also some tests with some commands and the USB Stick is always completly ejected that it is no re-mountable only when it it plugged in again.

I had this also before Chiki.kext that I had no picture after Sleep. I only click on the Apple Icon and select Sleep. If it is in Sleep Mode then I only press on the AC Button to bring it back from Sleep and then I have to press and Key that I get the picture back. Maybe this is also related to the NVRAM issue of my Dell Laptop.
 
Last edited:
I have started USB Eject Scripts via Terminal and the Sleep Scripts works and eject the USB Stick correctly. When I start the Wake Script then it says it can find the Disk which was ejected before. Then I think it can't work when the whole Device will be ejected maybe it is better only the Mounted Partition will be ejected and not the whole device itself.

You should check in ioreg to see if the USB device is detected.

I had this also before Chiki.kext that I had no picture after Sleep. I only click on the Apple Icon and select Sleep. If it is in Sleep Mode then I only press on the AC Button to bring it back from Sleep and then I have to press and Key that I get the picture back. Maybe this is also related to the NVRAM issue of my Dell Laptop.

No further ideas on that one...
 
Status
Not open for further replies.
Back
Top