Jump to content

GUIDE: How to Fix Brightness hotkeys in DSDT / SSDT-hotpatch


soumaxetuirk
 Share

110 posts in this topic

Recommended Posts

So call me lazy or just plain stupid but I couldn't get the right codes for me to modify either my DSDT/SSDT or my VoodooPS2Controller.kext so I just used the El Capitan HID kexts (install/repair/rebuild) and that restored my function keys for brightness up and down, as well as all other function keys and OS X keyboard shortcuts.  Here's the kexts I replaced:

 

IOHIDFamily.kext

AppleHIDKeyboard.kext

AppleHIDMouse.kext

 

I made sure to save 10.12.1 version of those kexts before installing the El Cap version.  I feel like a cheater but I'll take it for now and try again when time and my willingness permits.

 

For those who do not have the El Cap version of the HID kexts, here they are:

 

El Cap HID.zip

Link to comment
Share on other sites

It turns out that the only kext needed to restore F key functions is the El Cap version of IOHIDFamily.kext.  However, while function keys are restored, I lost lid and power button functions.  Closing the lid does not put the laptop to sleep, although selecting sleep from the shutdown options in the menu does.  Likewise, pressing the power button does not make the video sleep nor does it call up the shutdown/restart/sleep window.  I don't really think that using the El Cap HID kext is a good solution.

Link to comment
Share on other sites

  • 2 weeks later...

It is best to change the keyboard driver such that it generates F14/F15 instead of the real brightness ADB codes.

In my driver, can be done in ACPI. Not sure about other drivers.

 

I understand your suggestion but I am determined to find the code that changes brightness down for my laptop.  Again, my F2 key (brightness down) is HKNO 7 and my F3 key (brightness up) is HKNO 8 (both in H_EC/_Q13).  Brightness up is now 0x0205 and 0x0285 (not 0x0206 and 0x0286).  It sends the key e005=91 up and down.  The code 0x0405 produces the same result.

 

Brightness down does not work.  If anyone running a pre-Sierra OS on a HP Envy 17 can post what key is sent using brightness down when it works, I can mess with the numbers to try to get that code to be sent when I press my F2 key.  Alternatively, the key that is called in Sierra may not be the key that was called in previous versions of OS X.  

 

Might there be another way to get to the same result?

Link to comment
Share on other sites

OK, I was able to get my brightness keys to work correctly.  I borrowed code from RehabMan's proposed use of F14/F15 but applied it to my brightness keys - F2/F3.  Here's the code that I have in my DSDT under _SB.PCI0.LPCB.H_EC:

                    Method (_Q13, 0, NotSerialized)
                    {
                        Store (HKNO, Local0)
                        If (LEqual (Local0, 0x07))
                        {
                            Notify (PS2K, 0x0365)
                        }

                        If (LEqual (Local0, 0x08))
                        {
                            Notify (PS2K, 0x0366)
                        }
                    }

When I press F2 (brightness down), it sends key 65=6b up and down.  When I press F3 (brightness up), it sends key 66=71 up and down.

Link to comment
Share on other sites

I understand your suggestion but I am determined to find the code that changes brightness down for my laptop.  Again, my F2 key (brightness down) is HKNO 7 and my F3 key (brightness up) is HKNO 8 (both in H_EC/_Q13).  Brightness up is now 0x0205 and 0x0285 (not 0x0206 and 0x0286).  It sends the key e005=91 up and down.  The code 0x0405 produces the same result.

 

Brightness down does not work.  If anyone running a pre-Sierra OS on a HP Envy 17 can post what key is sent using brightness down when it works, I can mess with the numbers to try to get that code to be sent when I press my F2 key.  Alternatively, the key that is called in Sierra may not be the key that was called in previous versions of OS X.  

 

Might there be another way to get to the same result?

Don't use PS2 codes that correspond to actual brightness up/down ADB. Use PS2 codes that correspond to ADB for F14/F15.

Link to comment
Share on other sites

So I guess my only contribution, if any, was mapping these to my F2/F3 keys by way of a DSDT patch.

DSDT patch maps your brightness keys (presumably Fn+F2/Fn+F3). F2/F3 use standard scan codes that map to standard ADB codes.

 

Note: Some BIOS/EC will reverse the function of Fn+F1-F12 with F1-F12. But it PS2/ACPI-wise, you're still pressing Fn+F2/Fn+F3...

Link to comment
Share on other sites

DSDT patch maps your brightness keys (presumably Fn+F2/Fn+F3). F2/F3 use standard scan codes that map to standard ADB codes.

 

Note: Some BIOS/EC will reverse the function of Fn+F1-F12 with F1-F12. But it PS2/ACPI-wise, you're still pressing Fn+F2/Fn+F3...

 

That's correct.  HP has a feature in BIOS to allow switching that is enabled by default.  It allows you to use the function keys without pressing the Fn key.

 

BTW, on a somewhat related matter, I don't know if you are aware of this but, if I press F5, which is the on/off switch for keyboard backlighting, and hold it down while pressing the arrow up/down keys, it will change the brightness of the keyboard backlighting.  

Link to comment
Share on other sites

BTW, on a somewhat related matter, I don't know if you are aware of this but, if I press F5, which is the on/off switch for keyboard backlighting, and hold it down while pressing the arrow up/down keys, it will change the brightness of the keyboard backlighting.

I don't have any HP laptops with a keyboard backlight, so this matters very little to me...

But it seems like a reasonable key assignment.

Link to comment
Share on other sites

So i patched my DSDT for ec queries etc and have found that my brightness up is _Q0F and brightness down is _QOE but when i apply those changes to 

into method label _Q1D replace_content
begin
// Brightness Down\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0205)\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0285)\n
end;
into method label _Q1C replace_content
begin
// Brightness Up\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0206)\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0286)\n
end;

like this

into method label _Q0E replace_content
begin
// Brightness Down\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0205)\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0285)\n
end;
into method label _Q0F replace_content
begin
// Brightness Up\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0206)\n
Notify(\_SB.PCI0.LPCB.PS2M, 0x0286)\n
end;

brightness down doesnt do anything except bring up the brightness splash and brightness up does the same but also flashes the sound mute as well. So no brightness control.

Brightness slider works etc as i was using asusnbfnkeys but want to steer away from that.

Brightness up is f6 and down is f5

 

Volume control works with fn+f11 + f12 f10 for mute.

 

What have i missed for brightness control via fn + f5 & f6?

 

DSDT attached

DSDT.aml.zip

Link to comment
Share on other sites

brightness down doesnt do anything except bring up the brightness splash and brightness up does the same but also flashes the sound mute as well. So no brightness control.

Sounds like 10.12.1.

You should generate keys for F14/F15 instead of brightness key codes.

Link to comment
Share on other sites

Thanks @RehabMan i ended up using

into method label _Q0E replace_content
begin
// Brightness Down\n
    Notify(\_SB.PCI0.LPCB.PS2K, 0x0365) //F14\n
end;
into method label _Q0F replace_content
begin
// Brightness Up\n
    Notify(\_SB.PCI0.LPCB.PS2K, 0x0366) //F15\n
end;

And all is well.

  • Like 1
Link to comment
Share on other sites

Thanks @RehabMan i ended up using

into method label _Q0E replace_content
begin
// Brightness Down\n
    Notify(\_SB.PCI0.LPCB.PS2K, 0x0365) //F14\n
end;
into method label _Q0F replace_content
begin
// Brightness Up\n
    Notify(\_SB.PCI0.LPCB.PS2K, 0x0366) //F15\n
end;
And all is well.

 

Yes... as per my guide :-)

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 5 months later...

Hi,

 

I'm trying to fix ASUS UX430UA keyboard backlighting.

 

- brightness works on FN+F5/6(16 levels)
- keyboard backlight does not working

backlight
FN+F3 down -> ACPIDebug: "EC _Q0C enter" and "exit"
FN+F4 up -> ACPIDebug: "EC _Q0D enter" and "exit"

brightness
FN+F5 down -> ACPIDebug: "EC _Q0E enter" and "exit"
FN+F6 up -> ACPIDebug: "EC _Q0F enter" and "exit"

FN press:
default 14:03:37.805566 +0200 kernel ACPIDebug: "EC _QD3 enter"
default 14:03:37.805780 +0200 kernel ACPIDebug: "EC _QD3 exit"
default 14:03:37.944475 +0200 kernel ACPIDebug: "EC _QD4 enter"
default 14:03:37.944693 +0200 kernel ACPIDebug: "EC _QD4 exit"

 

any ideas how to fix keyboard backlight ?

 

 

from console:

default    22:58:47.421968 +0200    kernel    AsusNBFnKeys: Failed to set Keyboard backlight to level 0xe.
default    22:58:48.122215 +0200    kernel    AsusNBFnKeys: Failed to set Keyboard backlight to level 0xf.
default    22:58:48.448304 +0200    kernel    AsusNBFnKeys: Failed to set Keyboard backlight to level 0xe.
default    22:58:48.759530 +0200    kernel    AsusNBFnKeys: Failed to set Keyboard backlight to level 0xf.
default    22:58:49.079320 +0200    kernel    AsusNBFnKeys: Failed to set Keyboard backlight to level 0xe.

Thank you

 

 

EDIT:

 

keyboard backlights works fine now with patch from EMlyDinEsH

 

 

# Patch by EMlyDinEsH (www.osxlatitude.com)
 
#
# Enables 4 keyboard backlight levels control to work using my kexts AsusNBFnKeys and Smart Touchpad
# This patch meant for Kabylake notebooks and may work for others.
#
 
# Insert backlight auto off control sync field for Smart Touchpad and Asus Fn Keys driver
into device label ATKD code_regex Name\s\(BOFF,\sZero\) remove_matched;
into device label ATKD insert begin Name (BOFF, Zero) end;
 
# Insert method SKBL for setting keyboard backlight level
into method label SKBL parent_label ATKD remove_entry;
into Device label ATKD insert begin
Method (SKBL, 1, NotSerialized)\n
            {\n
                If (Or (LEqual (Arg0, 0xED), LEqual (Arg0, 0xFD)))\n
                {\n
                    If (And (LEqual (Arg0, 0xED), LEqual (BOFF, 0xEA)))\n
                    {\n
                        Store (Zero, Local0)\n
                        Store (Arg0, BOFF)\n
                    }\n
                    Else\n
                    {\n
                        If (And (LEqual (Arg0, 0xFD), LEqual (BOFF, 0xFA)))\n
                        {\n
                            Store (Zero, Local0)\n
                            Store (Arg0, BOFF)\n
                        }\n
                        Else\n
                        {\n
                            Return (BOFF)\n
                        }\n
                    }\n
                }\n
                Else\n
                {\n
                    If (Or (LEqual (Arg0, 0xEA), LEqual (Arg0, 0xFA)))\n
                    {\n
                        Store (Arg0, BOFF)\n
                    }\n
                    Else\n
                    {\n
Store (And (Arg0, 0x7F), KBLV)\n
                    }\n
                }\n
Store (0x0900, Local0)\n
          Add (Local0, 0xF0, Local0)\n
          \_SB.PCI0.LPCB.EC0.WRAM (Local0, KBLV)\n
         Store (DerefOf (Index (PWKB, KBLV)), Local0)\n
            \_SB.PCI0.LPCB.EC0.ST9E (0x1F, 0xFF, Local0)\n
                Return (Local0)\n
            }\n
end;
 
# Remove existing 16 backlight levels list if exist
into device label ATKD code_regex Name\s\(KBPW,\sBuffer\s\(0x10\)\s*\n\s*\{\s*\/\*\s0000\s\*\/\s*0x00,\s0x11,\s0x22,\s0x33,\s0x44,\s0x55,\s0x66,\s0x77,\s*\/\*\s0008\s\*\/\s*\s0x88,\s0x99,\s0xAA,\s0xBB,\s0xCC,\s0xDD,\s0xEE,\s0xFF\s*\}\) remove_matched;
# Remove existing 4 backlight levels list if exist
into device label ATKD code_regex Name\s\(PWKB,\sBuffer\s\(0x04\)\s*\n\s*\{\s*0x00,\s0x55,\s0xAA,\s0xFF\s*\}\) remove_matched;
 
# Insert 4 backlight levels
into Device label ATKD insert begin
Name (PWKB, Buffer (0x04)\n
            {\n
               0x00, 0x55, 0xAA, 0xFF\n
            })\n
end;
 
 
# Insert method GKBL for reading keyboard backlight level
into method label GKBL parent_label ATKD remove_entry;
into Device label ATKD insert begin
Method (GKBL, 1, NotSerialized)\n
            {\n
               If (LEqual (Arg0, 0xFF))\n
                {\n
                    Return (BOFF)\n
                }\n
 
                Return (KBLV)\n
            }\n
end;

Gulios-UX430UA-latest.zip

Link to comment
Share on other sites

  • 10 months later...
  • 3 months later...

Hi there,

Could someone help me with trying to remap my brightness control keys on my Dell Latitude E5430 Non v-Pro running Sierra 10.12.6? They are currently mapped to Fn + F3 (darken) and Fn + Insert (brighten) and would like to get them mapped to Fn + Cursor Down and Fn + Cursor Up respectively.

I have tried to get ACPIDebug to work but just don't seem to get any kind of key codes to appear in system.log, despite ACPIDebug being loaded via /S/L/E (confirmed by Kext Wizard) and having patched my DSDT with these patched from RehabMan...

 

Add DSDT Debug Method

Instrument EC Queries
Instrument GPE Events

I've also tried VoodooPS2Control-R6 and another VoodooPS2Controller kext (which both get my trackpad working) inconjunction with the debugger but to no avail.

I've attached my current DSDT and the two kexts I've tried in case I have missed something or those kexts are no good for the debugger. If you need any further info about my config please let me know.

 

Cheers,



  

VoodooPS2 Kexts.zip

DSDT_amox.dsl.zip

Link to comment
Share on other sites

Further to my last post, not sure why but by turning on the legacy boot option in the BIOS so that I could boot off the DVD drive seems to have activated the Fn + Cursor Up / Down brightness control keys when OSX has booted, albeit it doesn't show the brightness graphic (but Fn + F3 and Fn + Insert still work and show the graphic bar), so it's like I now have two brightness controls that are independent of each other!?

Still haven't been able to generate the key codes, but thought I would add this development in case it has some significance.

Edited by amoxitine
Link to comment
Share on other sites

 Share

×
×
  • Create New...