New VoodooPS2Controller, Keyboard, Trackpad
Hey, @RehabMan,
Currently using
IOWMIFamily (see readme on git for details) to process WMI notifications coming from two EC queries that control display brightness. These WMI codes are the same as normal PS2 scancodes would be 0xE005 and 0xE006 for Dell, but they are sent as a WMI packet to WMI device... and as I've mentioned the time to process those is really slow, though it works.
Yes, I have the same thing going on with this Lenovo U430. I looked at IOWMIFamily but found it unnecessarily complex. There is no reason to use all the WMI 'gunk' when the EC queries provide everything necessary.
Also, I wanted it to go through my mechanism for PS2 mapping so I can properly implement SysPrefs->Keyboard->"Use all F1, F2..." option. So I added some support for ACPI notifications into the PS2 driver.
Seeing that as of 10.8.11 there's now a way to parse ACPI notification from EC queries how would I go about making VoodooPS2 recognize the queries coming from ACPI? (I'm quite aware of clover changing OEM to Apple, so I always patch your sources to read data from Clover instead of patching my PS2K device in ACPI).
Note: It is easier to simply do the DSDT patch for RM,oem-id. To each his own, I guess...
P.S. I can see with Lenovo U410 brightness control is also handled as EC queries
Code:
Method (_Q90, 0, NotSerialized) // _Qxx: EC Query
{
Store (0x90, P80H)
If (LGreaterEqual (OSYS, 0x07D6))
{
Notify (^^^IGPU.DD02, 0x86)
}
Store (BRNS, ECLV)
Notify (VPC0, 0x80)
}
Method (_Q91, 0, NotSerialized) // _Qxx: EC Query
{
Store (0x91, P80H)
If (LGreaterEqual (OSYS, 0x07D6))
{
Notify (^^^IGPU.DD02, 0x87)
}
Store (BRNS, ECLV)
Notify (VPC0, 0x80)
}
Very similar (same method names, slightly different code in the methods). I used ACPIDebug to determine what query methods were called when the keys were pressed.
Then I used some DSDT patches to rewrite them such that they notify the keyboard device instead:
Code:
# Make EC-based brightness up/down work with RehabMan VoodooPS2 ACPI keyboard mechanism
into method label _Q90 parent_label EC0 replace_content
begin
// Dell code for brightness up\n
Notify (PS2K, 0x0206)\n
Notify (PS2K, 0x0286)\n
end;
into method label _Q91 parent_label EC0 replace_content
begin
// Dell code for brightness down\n
Notify (PS2K, 0x0205)\n
Notify (PS2K, 0x0285)\n
end;
The parameter corresponds exactly to a PS2 packet as gathered by ApplePS2Keyboard::interruptOccurred. The high-byte is either 1 or 2 (1 is normal scan code, 2 is extended 'e0' scan code). The low-bye is the scan code. You must send both down and up. These correspond to sending down & up for e006 and e005.
I was going to use the high-16 bits of the 32-bits possible for other purposes, but it turns out OS X gets it wrong and truncates the high 16-bits, so all values passed via Notify must be in the low-order 16 bits.
Which I only presume is the same method for U430 that has been referred to in the last commit. So at any rate .. if display panel (IGPU.DD02) gets notified with 0x86 it means brightness up event is requested, if notify is 0x87 - brightness down. It seems common for all laptops then.. my Dell has the same kind of ACPI notifications for brightness.
All that gunk is unnecessary, including the entire WMI device (I remove it in my u430 patches). We can just send the notification directly to PS2K and forget about the original code.
I can see boolean flag to receive ACPI notifications is set:
Yes, because Notify(PS2K, x) causes the ACPIPS2Nub::message to be called (Notify causes ::message on the object which is attached directly to the ACPI node), the nub has to send these notifications down the chain (recursively) to objects that are interested (such as ApplePS2Keyboard). This is how ApplePS2Keyboard advertises it wants these notifications.