Contribute
Register

[Guide] Patching DSDT/SSDT for LAPTOP backlight control

As I wrote in my last reply, hotpatch is not used to instrument the EC query methods.
Although possible, it would be a silly waste of time.
Use static patch as per post #1.
ok, i got it.

i will try staic patch on my.
thank you!
 
into method label _Q10 replace_content
begin
// Brightness Down\n
Notify(\_SB.PCI0.LPCB.PS2K, 0x0405)\n
end;
into method label _Q11 replace_content
begin
// Brightness Up\n
Notify(\_SB.PCI0.LPCB.PS2K, 0x0406)\n
end;

As far as I understand, 0x0405 & 0x0406 refers to the keys(arrow up and down) for brightness control.
Mine is like this:
img_56b8119482110.jpg

With ACPIDebug, I determined that _Q11 is for brightness down and _Q12 is for brightness up.

Can someone help me write the patch, I can't identify the keys id for my pc's brightness control.
 
Last edited:
Can anybody tell me where to find the those codes like 0x0406, 0x0365 for a particular laptop? I found only 0x0365 set work with my T410s.
I have no issue with Rehab's ACPIDebug when figuring out EC inquiry in my computer but I don't know what code should be used in the method.
 
Can anybody tell me where to find the those codes like 0x0406, 0x0365 for a particular laptop? I found only 0x0365 set work with my T410s.
I have no issue with Rehab's ACPIDebug when figuring out EC inquiry in my computer but I don't know what code should be used in the method.

The codes are related to PS2 codes and how they map to ADB codes.
It is driven off PS2->ADB mapping within the PS2 kext.
Read ApplePS2ToADBMap.h, and in VoodooPS2Keyboard.cpp... ApplePS2Keyboard::DefaultKeyMapOfLength, ApplePS2Keyboard::message, ApplePS2Keyboard::dispatchKeyboardEventWithPacket for complete information.

0x0365 is PS2 code 65 which is PS2 F14. It maps to F14 ADB (0x6b).
0x0406 is PS2 code e0 06 which is PS2 for Dell Brightness up. In my PS2 kext, it maps to F15 ADB (0x71).
 
Ok, for 0x0365, so now pressing F14 in my hackin actually decreases screen brightness when the keyboard generates a AT scan code of 65 which is mapping to an ADB code of 0x6b as declared in ApplePS2ToADBMap.h. The ADB code 0x6b stands for F14 in a real Mac according to VoodooPS2Controller.cpp. Before I install VoodooPS2Controller and patched DSDT, when I press F14 probably it means some other key stroke in a hackintosh, your program just maps my keyboard scan codes to correct Mac keyboard codes. I might be wrong but this is my understanding.

"65" means F14, what about the "03" in "0x0365"? Can I use any other values like 00 or 01 instead of 03?


The codes are related to PS2 codes and how they map to ADB codes.
It is driven off PS2->ADB mapping within the PS2 kext.
Read ApplePS2ToADBMap.h, and in VoodooPS2Keyboard.cpp... ApplePS2Keyboard::DefaultKeyMapOfLength, ApplePS2Keyboard::message, ApplePS2Keyboard::dispatchKeyboardEventWithPacket for complete information.

0x0365 is PS2 code 65 which is PS2 F14. It maps to F14 ADB (0x6b).
0x0406 is PS2 code e0 06 which is PS2 for Dell Brightness up. In my PS2 kext, it maps to F15 ADB (0x71).
 
Ok, for 0x0365, so now pressing F14 in my hackin actually decreases screen brightness when the keyboard generates a AT scan code of 65 which is mapping to an ADB code of 0x6b as declared in ApplePS2ToADBMap.h. The ADB code 0x6b stands for F14 in a real Mac according to VoodooPS2Controller.cpp. Before I install VoodooPS2Controller and patched DSDT, when I press F14 probably it means some other key stroke in a hackintosh, your program just maps my keyboard scan codes to correct Mac keyboard codes. I might be wrong but this is my understanding.

"65" means F14, what about the "03" in "0x0365"? Can I use any other values like 00 or 01 instead of 03?

Most laptop keyboards don't actually have an F14 key... But that doesn't mean we can't generate such a code via the mechanism I coded into VoodooPS2Keyboard.

You will need to understand the PS2 keyboard protocol in order to truly understand what follows:
The 0x03xx codes are used to send (from ACPI) normal PS2 codes (non-extended, eg. without e0 prefix) with make and break.
The 0x04xx codes are used to send (from ACPI) extended PS2 codes (extended codes are prefixed with e0) with make and break.
The 0x01xx codes are used to send normal PS2 codes (make and break must be specified separately).
The 0x02xx codes are used to send extended PS2 codes (make and break must be specified separately).

Since most of the time you want to send both make and break, the 0x01xx and 0x02xx codes are rarely used and not encouraged. They are left in as that was what I coded first, and therefore retained for backward compatibility for those that have not updated their ACPI code to current guidelines.

FYI: 0x00xx does nothing, as you will see if you read the code in ApplePS2Keyboard::message.
 
I got it. Thanks for detailed explanation.
I always assume Fn+Home equals F14 though there is actually no such key. Little off topic, the newest ver1.8.29 voodoops2controller has an issue in my T410s but the older 1.8.15 works fine. Probably 50% of chance when I restart my laptop the upper two buttons of trackpad with red bar won't function while the lower two buttons always work. It seems the happening of malfunction is just random or maybe after I use clover configurator, I am not quite sure. I am curious why Lenovo wants two sets of button for same purpose.




Most laptop keyboards don't actually have an F14 key... But that doesn't mean we can't generate such a code via the mechanism I coded into VoodooPS2Keyboard.

You will need to understand the PS2 keyboard protocol in order to truly understand what follows:
The 0x03xx codes are used to send (from ACPI) normal PS2 codes (non-extended, eg. without e0 prefix) with make and break.
The 0x04xx codes are used to send (from ACPI) extended PS2 codes (extended codes are prefixed with e0) with make and break.
The 0x01xx codes are used to send normal PS2 codes (make and break must be specified separately).
The 0x02xx codes are used to send extended PS2 codes (make and break must be specified separately).

Since most of the time you want to send both make and break, the 0x01xx and 0x02xx codes are rarely used and not encouraged. They are left in as that was what I coded first, and therefore retained for backward compatibility for those that have not updated their ACPI code to current guidelines.

FYI: 0x00xx does nothing, as you will see if you read the code in ApplePS2Keyboard::message.
 
I got it. Thanks for detailed explanation.
I always assume Fn+Home equals F14 though there is actually no such key. Little off topic, the newest ver1.8.29 voodoops2controller has an issue in my T410s but the older 1.8.15 works fine. Probably 50% of chance when I restart my laptop the upper two buttons of trackpad with red bar won't function while the lower two buttons always work. It seems the happening of malfunction is just random or maybe after I use clover configurator, I am not quite sure.

For Thinkpads, you should probably be using tluck's fork.
I don't recommend Clover Configurator (it is a good way to ruin a perfectly fine config.plist).

I am curious why Lenovo wants two sets of button for same purpose.

I'm not sure what you're referring to.
 
There are 5 buttons in Lenovo Thinkpads. 3 buttons are on top of trackpad and 2 buttons in bottom of trackpad. 2 of the 3 buttons (red ones) on the top do the same thing that mouse left and right buttons do. The 2 buttons below also do the same thing that mouse left and right buttons will do. The red buttons wont work with ver1.8.29.
Ksffb.jpg


For Thinkpads, you should probably be using tluck's fork.
I don't recommend Clover Configurator (it is a good way to ruin a perfectly fine config.plist).
I'm not sure what you're referring to.
 
There are 5 buttons in Lenovo Thinkpads. 3 buttons are on top of trackpad and 2 buttons in bottom of trackpad. 2 of the 3 buttons (red ones) on the top do the same thing that mouse left and right buttons do. The 2 buttons below also do the same thing that mouse left and right buttons will do. The red buttons wont work with ver1.8.29.
Ksffb.jpg

Read post #1395.
 
Back
Top