Jump to content

Fix Sleep/Wake issue on older Macs


44 posts in this topic

Recommended Posts

Guys, I have this part of an iMac SSDT:

Device (EHC1)
        {
            Name (_ADR, 0x001D0007)  // _ADR: Address
            Name (GPRW, Package (0x02)
            {
                0x0D, 
                0x03
            })

And I want to insert: If (_OSI ("Darwin")).............

        0x0D, 
        Zero

Can somebody give me a hand?

SSDT-2.dsl

Link to comment
Share on other sites

1 hour ago, Stefanalmare said:

Guys, I have this part of an iMac SSDT:

Device (EHC1)
        {
            Name (_ADR, 0x001D0007)  // _ADR: Address
            Name (GPRW, Package (0x02)
            {
                0x0D, 
                0x03
            })

And I want to insert: If (_OSI ("Darwin")).............

        0x0D, 
        Zero

Can somebody give me a hand?

SSDT-2.dsl 14.76 kB · 0 downloads

 

In my Dell 530 Hack, I put that in the S3D method and it returns 0x02:

 


            Device (EH01)
            {
                Name (_ADR, 0x001D0007)  // _ADR: Address
                Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        If (LEqual (OSFL, 0x02))
                        {
                            Return (0x02)
                        }

                        Return (0x03)
                    }
                }
                Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                {
                    0x0D, 
                    0x03
                })

 

GPRW is a NAME and not a METHOD.

In my DSDT, it's called _PRW and returns the same as yours (see above code), i.e. 0x0D & 0x03

 

You would need to insert it into Sleep States S3D and S4D:

 



            Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
            {
                If (_OSI ("Darwin"))
                {
                    Return (0x02)
                }
                Else
                {
                    Return (0x03)
                }
            }

            Method (_S4D, 0, NotSerialized)  // _S4D: S4 Device State
            {
                If (_OSI ("Darwin"))
                {
                    Return (0x02)
                }
                Else
                {
                    Return (0x03)
                }
            }

See attached.

SSDT-2.dsl

  • Like 3
Link to comment
Share on other sites

12 hours ago, MacNB said:

 

In my Dell 530 Hack, I put that in the S3D method and it returns 0x02:

 


            Device (EH01)
            {
                Name (_ADR, 0x001D0007)  // _ADR: Address
                Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                {
                    If (_OSI ("Darwin"))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        If (LEqual (OSFL, 0x02))
                        {
                            Return (0x02)
                        }

                        Return (0x03)
                    }
                }
                Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                {
                    0x0D, 
                    0x03
                })

 

GPRW is a NAME and not a METHOD.

In my DSDT, it's called _PRW and returns the same as yours (see above code), i.e. 0x0D & 0x03

 

You would need to insert it into Sleep States S3D and S4D:

 



            Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
            {
                If (_OSI ("Darwin"))
                {
                    Return (0x02)
                }
                Else
                {
                    Return (0x03)
                }
            }

            Method (_S4D, 0, NotSerialized)  // _S4D: S4 Device State
            {
                If (_OSI ("Darwin"))
                {
                    Return (0x02)
                }
                Else
                {
                    Return (0x03)
                }
            }

See attached.

SSDT-2.dsl 15.42 kB · 2 downloads

Thank you! I'll try and report.

 

Update: it doesn't work. I have instant wake, like the original SSDT.

Edited by Stefanalmare
Update
Link to comment
Share on other sites

4 hours ago, Stefanalmare said:

Thank you! I'll try and report.

 

Update: it doesn't work. I have instant wake, like the original SSDT.

 

Check the logs from --last boot to see if your SSDT got injected (you should see UsbNoRmh I believe).

Check the logs for the cause of the wake.

 

Could be many things that cause instant wake (not just USB).

Check the old guide here at Dortania.

 

  • Like 1
Link to comment
Share on other sites

On 11/1/2023 at 7:14 AM, Stefanalmare said:

Thank you! I'll try and report.

 

Update: it doesn't work. I have instant wake, like the original SSDT.

Have you figured this out yet?

Link to comment
Share on other sites

6 hours ago, deeveedee said:

Have you figured this out yet?

Nope. In macOS and windows I need to start from button, after sleep. This is because I added USB 3 card trough Mini PCIe inside iMac 27 2010, and this killed sleep. For that I needed to modify that SSDT. Can't use GPRW method, because _prw is a name not a method.........

https://forums.macrumors.com/threads/usb-3-wifi-ac-bt4-2-for-imac-27-mid-2010.2269396/post-32674180

Link to comment
Share on other sites

1 hour ago, Stefanalmare said:

Can't use GPRW method, because _prw is a name not a method.........

 

Sure?

My working DSDT

                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    Return (GPRW (0x0B, 0x04))
                }

108 occurences.

  • Like 2
Link to comment
Share on other sites

Quote

GPRW is a NAME and not a METHOD.

 

@MacNB

 

If the GPRW method (and it is in fact a METHOD!) is not present in your DSDT, you can create an SSDT that simply changes the values of the _PRW method for the device(s) in question:

 

https://github.com/5T33Z0/OC-Little-Translated/tree/main/04_Fixing_Sleep_and_Wake_Issues/060D_Instant_Wake_Fix#method-2-using-ssdt-prw0aml-no-gprwuprw

 

 

 

Edited by cankiulascmnfye
  • Like 1
Link to comment
Share on other sites

@Stefanalmare it doesn't matter that GPRW is a name - ACPI lets you override a name with a ZERO-ARGUMENT method.

 

rename your EHC1.GPRW and EHC2.GPRW names to ZPRW.

 

Method (GPRW, 0, NotSerialized)
    {
        If (\_OSI ("Darwin"))
        {
           Return (Package (0x02)
           {
               0x0D, 
               Zero
           })
        }

        Return (ZPRW)
    }
}

 

EDIT: If I were doing this on my own rig, I'd use ACPI hot-patches (rename EHC1.GPRW and EHC2.GPRW to ZPRW with an ACPI patch and add SSDT-GPRW that defines Methods EHC1.GPRW and EHC2.GPRW.

 

@Stefanalmare The attached SSDT should be close (check your paths).  You just need to add this and implement the GPRW -> ZPRW rename.

 

@Stefanalmare Feel free to PM me if you want help.  This looks like it could turn into a $#!+ show.

 

 

SSDT-GPRW.aml.zip

Edited by deeveedee
Corrected copy/paste error
Link to comment
Share on other sites

@Stefanalmare I had a copy/paste error (copying from my own Method GPRW).  I modified my post.

 

The important thing to note is that when replacing a name with a method, the new method must take 0 arguments.

Edited by deeveedee
Link to comment
Share on other sites

25 minutes ago, Stefanalmare said:

Hey guys! Thank you for your advices. Here is the ACPI and the SSDT I modified to have sleep. Give me a hand to have normal sleep/wake at lest in Windows.

Thank you!

I gave you the solution here.  Do you not want to use ACPI hot-patches?

 

EDIT: I thought you had a name GPRW?

 

EDIT2: @StefanalmareAttached is the same solution I provided before, but with _PRW instead of GPRW.

 

Note that for this attached solution to work, you need to rename EHC1._PRW -> ZPRW and EHC2._PRW to ZPRW.

 

EDIT3: Your post is a little confusing.  It looks like you have manually edited your SSDT.  The patch I'm proposing will work with the original, unmodified ACPI.

SSDT-PRW.aml.zip

Edited by deeveedee
  • Like 3
Link to comment
Share on other sites

2 hours ago, cankiulascmnfye said:

 

@MacNB

 

If the GPRW method (and it is in fact a METHOD!) is not present in your DSDT, you can create an SSDT that simply changes the values of the _PRW method for the device(s) in question:

 

https://github.com/5T33Z0/OC-Little-Translated/tree/main/04_Fixing_Sleep_and_Wake_Issues/060D_Instant_Wake_Fix#method-2-using-ssdt-prw0aml-no-gprwuprw

 

 

 

 

When I mention that GPRW is a NAME and not a METHOD, I was referring to their actual specific SSDT which clearly stated "Name (GPRW, Package (0x02)".

 

I don't have any problems with my systems with instant wake.

 

Thx for the link...very educational even after 10 years of hacking my DSDT's 😁

  • Like 1
Link to comment
Share on other sites

1 hour ago, MacNB said:

 

When I mention that GPRW is a NAME and not a METHOD, I was referring to their actual specific SSDT which clearly stated "Name (GPRW, Package (0x02)".

 

I don't have any problems with my systems with instant wake.

 

Thx for the link...very educational even after 10 years of hacking my DSDT's 😁

 

I didn't say you had problems with instant wake. I just wanted you to show how to replaces values in _PRW via SSDT – wthout the need for additional renames, btw. It won't get more elegant than this.

Link to comment
Share on other sites

3 hours ago, deeveedee said:

I gave you the solution here.  Do you not want to use ACPI hot-patches?

 

EDIT: I thought you had a name GPRW?

 

EDIT2: @StefanalmareAttached is the same solution I provided before, but with _PRW instead of GPRW.

 

Note that for this attached solution to work, you need to rename EHC1._PRW -> ZPRW and EHC2._PRW to ZPRW.

 

EDIT3: Your post is a little confusing.  It looks like you have manually edited your SSDT.  The patch I'm proposing will work with the original, unmodified ACPI.

SSDT-PRW.aml.zip 764 B · 5 downloads

 

Thank you man! It works, but only with cord keyboard +/or mouse. This iMac is for my wife and she want keyboard/mouse cordless. So, windows doesn't wake from bluetooth and if I wake it from button, bluetooth does not initialise. With my custom SSDT I don't have this problem.
One more time thank you for your time!

Link to comment
Share on other sites

4 minutes ago, Stefanalmare said:

One more time thank you for your time!

 

You're quite welcome.  @cankiulascmnfye 's solution is very cool.  You might want to play with it.  It gave me other ideas that I haven't tried before.  I've stopped thinking there's only one way or that one way is the best way.  We keep proving over and over again that there is more than one way to do this.

  • Like 1
Link to comment
Share on other sites

44 minutes ago, deeveedee said:

 

You're quite welcome.  @cankiulascmnfye 's solution is very cool.  You might want to play with it.  It gave me other ideas that I haven't tried before.  I've stopped thinking there's only one way or that one way is the best way.  We keep proving over and over again that there is more than one way to do this.

 

Yep! After reading, yes it is a nice solution. I'll try it tomorrow.

Link to comment
Share on other sites

1 hour ago, Stefanalmare said:

... windows doesn't wake from bluetooth and if I wake it from button, bluetooth does not initialise. With my custom SSDT I don't have this problem.

 

I didn't review your ACPI carefully enough to look for anything beyond modification of the _PRW names.  Are you saying that if you manually edit the _PRW names in EHC1 and EHC2, wake from Bluetooth works in Windows, but if you use ACPI hot-patches to modify the _PRW names, wake from Bluetooth doesn't work in Windows?  I don't understand exactly what you mean, since the hot-patches only make changes when running macOS.

 

Is it possible that your ACPI renames (in config.plist) are renaming more than just the _PRW names in EHC1 and EHC2?  If so, try cankiulascmnfye's method and see if it produces better results for you.  Note that when you define your renames in config.plist, you need to make sure that they only rename the intended _PRW names in EHC1 and EHC2.  Be very careful with the rename scope.

 

If you still need more help, maybe you can try explaining the last remaining problem that you're still having with Bluetooth.

 

Here's an example of the way I rename GPRW to ZPRW.  Note that I find/replace the specific byte sequence that is unique to the method (I use hexfiend to confirm the unique byte sequence).  Sometimes, I found using the unique byte sequence to be more reliable than using the Base string.  Also note that I use Count to make sure I change only 1 (overkill) and I provide the table signature.  The point is that you need to be very careful that your ACPI rename affects only the intended byte sequence in ACPI.

 

Also, I include Count = 1 in my find/replace, because I guessed that my replaces might be faster if the patching stops searching after it finds an occurrence.  I never tested to see if it is actually faster.

Spoiler

Screenshot2023-11-05at8_55_14PM.png.0baf6b5a88d238c925f6af7708857833.png

 

Edited by deeveedee
  • Like 2
Link to comment
Share on other sites

18 hours ago, MacNB said:

 

When I mention that GPRW is a NAME and not a METHOD, I was referring to their actual specific SSDT which clearly stated "Name (GPRW, Package (0x02)".

 

I don't have any problems with my systems with instant wake.

 

Thx for the link...very educational even after 10 years of hacking my DSDT's 😁

ACPI doesn't differ Name and Method if you want to read the value. If XXXX can be name then it can be a method. The difference is in how to work. The name can be ReadWrite while methods should be one for Read and one for Write or something more complex using arguments. Name is just simpler instance.

 

I also have no problems with Sleep/Wake as it is my modus vivendi.

  • Like 1
  • Haha 1
Link to comment
Share on other sites

4 hours ago, Slice said:

I also have no problems with Sleep/Wake as it is my modus vivendi.

 

That's an underwear/swimwear brand, isn't it?  Possibly a little TMI? 😂

Link to comment
Share on other sites

On 11/5/2023 at 7:10 PM, Stefanalmare said:

 

Thank you man! It works, but only with cord keyboard +/or mouse. This iMac is for my wife and she want keyboard/mouse cordless. So, windows doesn't wake from bluetooth and if I wake it from button, bluetooth does not initialise. With my custom SSDT I don't have this problem.

 

Attached is the find/replace that I would use with your ACPI (assuming that the tables you posted have the correct OEM ID).  If you use the attached find/replace, does this fix your Windows Bluetooth problem?

 

EDIT: My find/replace assumes that the Table ID is 'UsbNoRmh' for the SSDT that defines EHC1._PRW and EHC2.PRW.

 

config.plist.zip

Edited by deeveedee
Link to comment
Share on other sites

8 minutes ago, deeveedee said:

 

Attached is the find/replace that I would use with your ACPI (assuming that the tables you posted have the correct OEM ID).  If you use the attached find/replace, does this fix your Windows Bluetooth problem?

 

EDIT: My find/replace assumes that the Table ID is 'UsbNoRmh' for the SSDT that defines EHC1._PRW and EHC2.PRW.

 

config.plist.zip 1.1 kB · 2 downloads

Thanx! Same like mine.

Link to comment
Share on other sites

4 minutes ago, Stefanalmare said:

Thanx! Same like mine.

 

Were you able to figure out the difference between your manual edits and the ACPI hot-patches?

 

EDIT: Also, are you able to post your original / unpatched ACPI that you extracted from your iMac before applying any patches?

Edited by deeveedee
Link to comment
Share on other sites

1 hour ago, deeveedee said:

 

Were you able to figure out the difference between your manual edits and the ACPI hot-patches?

 

EDIT: Also, are you able to post your original / unpatched ACPI that you extracted from your iMac before applying any patches?

Until now in this configuration: iMac 27 2010 (updates: graphic card metal RX 480, WIFI+BT, SSD 1T, top processor Xeon, 32 GB DDR3 RAM, USB3 A+C) + Magic Mouse + Magic Keyboard, works best with my solution: blocking SSDT-UsbNoRmh and reinserted with 00 instead 03 in _prw and errors repaired. Your solution it works in macOS but BT does'nt start after wake, in Windows. @cankiulascmnfye solution does'nt work in macOS. So, for me with normal sleep and wake from button (macOS and windows), is a decent solution in this condition with BT mouse+keyboard.

ACPI posted above is the original one extracted with hackintool.

Link to comment
Share on other sites

 Share

×
×
  • Create New...