Contribute
Register

[solved] AC Adapter Detection and Sleep Issues on PCSpecialist Lafité II / TopStar U931

Status
Not open for further replies.
Joined
Jul 6, 2011
Messages
111
Motherboard
Slimbook Pro2
CPU
i5-8250U
Graphics
UHD 620, 3200x1800
Mobile Phone
  1. Android
I've recently install Mojave to my PCSpecialist Lafité II / TopStar U931 laptop using RehabMan's excellent laptop and power management guides.

Everything I have tested on the laptop works properly under MacOS with 2 exceptions:

AC Adapter Detection

  • If the AC adapter is attached at boot/when the OS loads, battery status in the menubar continues to show it as attached even if it is disconnected. The battery charge level does not register changes (continues to show the same level of charge as at boot).
  • If the adapter is not attached at boot/when the OS loads, the battery is shown to be discharging and the charge level decreases at a believable (probably accurate rate). If the charger is then plugged in the charge level percentage increases, but the battery status in the menubar does not reflect the fact the charger is plugged in.
Sleep Functionality
  • If the laptop lid is closed or the 'Sleep' option is selected from the Apple menu the display turns off but the system fans are still audible and the computer has clearly not gone into sleep mode (at least not properly). If the lid is then opened/a key is pressed, the lockscreen is presented as expected.
I attach problem reporting files generated with black.dragon74's script.

Any help or advice would be greatly appreciated!

Thank you!
 

Attachments

  • debug_15575.zip
    2.9 MB · Views: 94
Last edited:
I've recently install Mojave to my PCSpecialist Lafité II / TopStar U931 laptop using RehabMan's excellent laptop and power management guides.

Everything I have tested on the laptop works properly under MacOS with 2 exceptions:

AC Adapter Detection

  • If the AC adapter is attached at boot/when the OS loads, battery status in the menubar continues to show it as attached even if it is disconnected. The battery charge level does not register changes (continues to show the same level of charge as at boot).
  • If the adapter is not attached at boot/when the OS loads, the battery is shown to be discharging and the charge level decreases at a believable (probably accurate rate). If the charger is then plugged in the charge level percentage increases, but the battery status in the menubar does not reflect the fact the charger is plugged in.
The problem is your ACPI code has no notifications for when AC adapter status changes.
Typically, GPE or EC queries would be used to notify the system that AC adapter status has changed, which then triggers a call to _PSR.

You can call _PSR from the battery _BST (_BST is polled every 30 seconds), check for a change in status, and if a change is detected, use Notify to notify the ADP1 object.

Or you could use ACPIPoller.kext (to call a method every 1 second) and do the same check.

Sleep Functionality
  • If the laptop lid is closed or the 'Sleep' option is selected from the Apple menu the display turns off but the system fans are still audible and the computer has clearly not gone into sleep mode (at least not properly). If the lid is then opened/a key is pressed, the lockscreen is presented as expected.
I attach problem reporting files generated with black.dragon74's script.

Keep in mind there is a 15-20 second delay before sleep is initiated.
And all assertions must be clear (check with 'pmset -g assertions').
 
The problem is your ACPI code has no notifications for when AC adapter status changes.
Typically, GPE or EC queries would be used to notify the system that AC adapter status has changed, which then triggers a call to _PSR.

You can call _PSR from the battery _BST (_BST is polled every 30 seconds), check for a change in status, and if a change is detected, use Notify to notify the ADP1 object.

Or you could use ACPIPoller.kext (to call a method every 1 second) and do the same check.
Thank you so much for your assistance and for replying so quickly.
I'm not overly confident in making edits to my DSDT and wouldn't be sure how to proceed. I'm also a little unsure about what edits would need to be made to the default info.plist in ACPIPoller.kext to get it working. Would you please be so kind as to help with either patching the DSDT or editing the ACPIPoller's info.plist please?

Thank you again!

Keep in mind there is a 15-20 second delay before sleep is initiated.
And all assertions must be clear (check with 'pmset -g assertions').
I wasn't aware of the delay -- thank you! I can confirm my laptop enters sleep after 20 seconds.
 
Thank you so much for your assistance and for replying so quickly.
I'm not overly confident in making edits to my DSDT and wouldn't be sure how to proceed. I'm also a little unsure about what edits would need to be made to the default info.plist in ACPIPoller.kext to get it working. Would you please be so kind as to help with either patching the DSDT or editing the ACPIPoller's info.plist please?

Thank you again!


I wasn't aware of the delay -- thank you! I can confirm my laptop enters sleep after 20 seconds.

No need to edit ACPIPoller Info.plist. Just code a method that matches (FCPU).
 
Just code a method that matches (FCPU).
Thanks, but I'm not sure how to do that, or where to place it within the DSDT?

Any further assistance would be wonderful!
 
Last edited:
Thanks, but I'm not sure how to do that, or where to place it within the DSDT?

Any further assistance would be wonderful!

There are some examples in the ProBook github if you look (SSDT-FANQ.dsl, for example).
 
There are some examples in the ProBook github if you look (SSDT-FANQ.dsl, for example).
Great. Still new to all this. Can the method I write be put under any device?
 
Great. Still new to all this. Can the method I write be put under any device?

Must be under a device that matches with the correct IOName that ACPIPoller.kext expects.
You will notice this in SSDT-FANQ.dsl:
Code:
        Name (_HID, "FAN00000") // _HID: Hardware ID

And if you look at the Info.plist for ACPIPoller.kext, you will understand why that matters.
 
Must be under a device that matches with the correct IOName that ACPIPoller.kext expects.
You will notice this in SSDT-FANQ.dsl:
Code:
        Name (_HID, "FAN00000") // _HID: Hardware ID

And if you look at the Info.plist for ACPIPoller.kext, you will understand why that matters.

I think I'm a little out of my depth. I've been experimenting and got as far as:
Code:
Device (SMCD)
    {       
        Name (_HID, "FAN00000") // _HID: Hardware ID
     
        // Dummy method for passing _PSR status -- expects to be evaluated 1-per second
        Method(FCPU, 0)
        {
            Store (_PSR, Local0)
                        }
            Return (Local0)  // returns _PSR value
        }

But that creates a DSDT compilation error:
'Object is not available from this scope (_PSR)'

Am I at least on the right track in trying to match the value of FCPU to _PSR? I'm thinking not, as if that were the case, I could alter the kext to accept it directly?
 
I think I'm a little out of my depth. I've been experimenting and got as far as:
Code:
Device (SMCD)
    {    
        Name (_HID, "FAN00000") // _HID: Hardware ID
  
        // Dummy method for passing _PSR status -- expects to be evaluated 1-per second
        Method(FCPU, 0)
        {
            Store (_PSR, Local0)
                        }
            Return (Local0)  // returns _PSR value
        }

But that creates a DSDT compilation error:
'Object is not available from this scope (_PSR)'

Am I at least on the right track in trying to match the value of FCPU to _PSR? I'm thinking not, as if that were the case, I could alter the kext to accept it directly?

You would want something like this:
Code:
// SSDT-ACAP.dsl
//
// Some AC adapter ACPI implementations do not notify the ACPI host
// of changes to AC adapter status.
//
// This SSDT can be used to fix that by pairing with ACPIPoller.kext.
// ACPIPoller.kext will attach to this object, call FCPU each second.
// The FCPU method below, will detect changes in AC adapter status (_PSR),
// and notify the AC adapter object as needed.
//
// Note: Change the ACPI path of the AC adapter as appropriate.
//
DefinitionBlock("", "SSDT", 2, "hack", "_ACAP", 0)
{
    External(_SB.ADP1, DeviceObj)
    External(_SB.ADP1._PSR, MethodObj)
 
    Device(_SB.ADP1.ACAP)
    {
        Name(_HID, "FAN00000") // for matching with ACPIPoller.kext

        // FCPU will be executed each second by ACPIPoller.kext
        Name(LPSR, Ones)
        Method(FCPU)
        {
            Local0 = \_SB.ADP1._PSR()
            If (Local0 != LPSR)
            {
                LPSR = Local0
                Notify(\_SB.ADP1, 0x80) // Notifies _SB.ADP1
            }
        }
    }
}
//EOF
 
Last edited:
Status
Not open for further replies.
Back
Top