Contribute
Register

Sleep by lid close & Wake by lid openening?

Status
Not open for further replies.
Thanks. Anything you learned from building your own kext from between those two sources that explains why the VoodooPS2 kext prevent sleep when closing lid?
Nothing jumps out at me. They're both based on the Apple PS2 source so they are very similar. The spurious keyboard events do happen on both but it seems that it happens only upon waking with the Smart touchpad kext so that may be a place to start. With VoodooPS2, it almost always was the brightness down key on my device and it was as if it were stuck or the key up event was never sent. Random key events don't happen at all with the custom kext I built but it is greatly simplified.
 
Nothing jumps out at me. They're both based on the Apple PS2 source so they are very similar. The spurious keyboard events do happen on both but it seems that it happens only upon waking with the Smart touchpad kext so that may be a place to start. With VoodooPS2, it almost always was the brightness down key on my device and it was as if it were stuck or the key up event was never sent. Random key events don't happen at all with the custom kext I built but it is greatly simplified.

Maybe your EC is sending EC queries (_Qxx) that happen to correspond to what you thought were your brightness controls.
Perhaps you need additional code in the patched method to filter out events that are not brightness related.

Instrument your EC query code with ACPIDebug so you know if that is happening.

Note that the garbage keys after wake was something I fixed long ago: https://github.com/RehabMan/OS-X-Vo...mmit/b33b10c0a6df2e4474d3acc057a6a4f602bf79a1
 
Last edited:
Maybe your EC is sending EC queries (_Qxx) that happen to correspond to what you thought were your brightness controls.
Perhaps you need additional code in the patched method to filter out events that are not brightness related.

Instrument your EC query code with ACPIDebug so you know if that is happening.

Note that the garbage keys after wake was something I fixed long ago: https://github.com/RehabMan/OS-X-Vo...mmit/b33b10c0a6df2e4474d3acc057a6a4f602bf79a1

Nah, my brightness keys do not require any patching on this device and have no corresponding EC code. My unsubstantiated belief is that VoodooPS2 is sending a function key event in repetition or unbroken (which for me happens to correspond to my brightness key). Like perfect clockwork the sequence goes like this -- close lid, brightness goes to zero and sleep is uninitiated (or is interrupted), open lid, hit brightness down and then up (to bring the screen back), close lid again and sleep works just fine. It is that way nearly every time, the only variation is that infrequently, it would be a function key that doesn't correspond to anything and I would hear the system alert repeating over and over until I hit a key on the keyboard to interrupt it. Closing the lid twice in succession without hitting a key in between doesn't work. I'm at a loss as to why it happens on the first attempt, but not the second.

For my part, I'm satisfied with what I have put together since all I need is a keyboard. I only put my .02 into the thread because I recognized the behavior. The Smarttouchpad kext worked fine but I missed your ACPI methods since my volume hard keys are ACPI based but that capability was easily lifted from VoodooPS2, thanks by the way!
 
Nah, my brightness keys do not require any patching on this device and have no corresponding EC code. My unsubstantiated belief is that VoodooPS2 is sending a function key event in repetition or unbroken (which for me happens to correspond to my brightness key).

Your keys require "Breakless PS2" setup?

Someone that can reproduce the problem and has dev skills should look into this deeply (adding debug code as needed, etc). It is called 'contributing'. Hint hint.

The Smarttouchpad kext worked fine but I missed your ACPI methods since my volume hard keys are ACPI based but that capability was easily lifted from VoodooPS2, thanks by the way!

How can you "lift" anything from my kext to the SmartTouchpad kext?
The Smarttouchpad kext is closed-source (and in violation of the APSL).

Another thing to test would be to see if the same happens when using VoodooPS2Mouse.kext instead of VoodooPS2Trackpad.kext.
 
Your keys require "Breakless PS2" setup?

Someone that can reproduce the problem and has dev skills should look into this deeply (adding debug code as needed, etc). It is called 'contributing'. Hint hint.



How can you "lift" anything from my kext to the SmartTouchpad kext?
The Smarttouchpad kext is closed-source (and in violation of the APSL).

Another thing to test would be to see if the same happens when using VoodooPS2Mouse.kext instead of VoodooPS2Trackpad.kext.

I should have been more specific, I meant I added it to the 'Elan' kext (after gutting it of the elan part) which was really not much more than the apple ps2 source. You have a fork of it in your repo if I'm not mistaken.

The 'contributing' part comes off as snarky whether or not you mean it that way. I contribute as much as I am able, though not necessarily here. So I will choose to give you the benefit of the doubt because of how much you give / have given of your time, knowledge and effort freely to this community (and me personally on many occasions) and chalk it up to the hazards of written communication. The bottom line is my programming skills are questionable at best. The last bit of formal training I had was Fortran circa 1990 so I don't think I have anything to offer in this case.
 
I should have been more specific, I meant I added it to the 'Elan' kext (after gutting it of the elan part) which was really not much more than the apple ps2 source. You have a fork of it in your repo if I'm not mistaken.

That ELAN kext is old (current source for SmartTouchpad is not published).

The 'contributing' part comes off as snarky whether or not you mean it that way.

It is meant to be that way just a little bit :)

I contribute as much as I am able, though not necessarily here. So I will choose to give you the benefit of the doubt because of how much you give / have given of your time, knowledge and effort freely to this community (and me personally on many occasions) and chalk it up to the hazards of written communication. The bottom line is my programming skills are questionable at best. The last bit of formal training I had was Fortran circa 1990 so I don't think I have anything to offer in this case.

Any programming skills will probably be helpful in this scenario.
If you can add debug traces and experiment, we can perhaps make progress...
I'll be glad to make suggestions if someone is willing to do the leg work.
 
I should have been more specific, I meant I added it to the 'Elan' kext (after gutting it of the elan part) which was really not much more than the apple ps2 source. You have a fork of it in your repo if I'm not mistaken.

The 'contributing' part comes off as snarky whether or not you mean it that way. I contribute as much as I am able, though not necessarily here. So I will choose to give you the benefit of the doubt because of how much you give / have given of your time, knowledge and effort freely to this community (and me personally on many occasions) and chalk it up to the hazards of written communication. The bottom line is my programming skills are questionable at best. The last bit of formal training I had was Fortran circa 1990 so I don't think I have anything to offer in this case.


In making your own PS2 kext, how did you decide which parts of the Elan and SmartTouchpad kext you needed? I'm wondering if this is something I should attempt. Frankly, I'm only interested in an extremely basic kext where the trackpad and keyboard function on a basic level and sleep works, with similar uptime and reliability as OEM Apple.
 
That ELAN kext is old (current source for SmartTouchpad is not published).



It is meant to be that way just a little bit :)



Any programming skills will probably be helpful in this scenario.
If you can add debug traces and experiment, we can perhaps make progress...
I'll be glad to make suggestions if someone is willing to do the leg work.


Had a little time today to investigate so I enabled the key logging. The sequence goes like so -

**** Close LID
default 10:04:25.060438 -0400 kernel ApplePS2Keyboard: sending key e005=6b down
No sleep occurs

**** Open LID
press any key

**** Close LID
Normal sleep occurs

Upon opening the lid after normal sleep the following is sent by VoodooPS2
default 10:06:40.415583 -0400 kernel ApplePS2Keyboard: sending key e063=80 down

It is the same *every* time.

Attached is an example of the console output. In this case, I pressed the space bar in between LID closes.
 

Attachments

  • VoodooSleepIssue.jpg
    VoodooSleepIssue.jpg
    127 KB · Views: 114
Do we know why ApplePS2keyboard is sending that key? Have we tracked down where in the code of the kext is responsible for sending that keystroke? In other words, is there anything I could remove from the code that would result in the key not being pressed?
 
Do we know why ApplePS2keyboard is sending that key? Have we tracked down where in the code of the kext is responsible for sending that keystroke? In other words, is there anything I could remove from the code that would result in the key not being pressed?

It appears as though it may be something to do with the brightness key fix for Sierra...
 
Status
Not open for further replies.
Back
Top