• Become a Premium Member for $25/year with no ads to improve your community experience.

GUIDE How to Remap Brightness Hotkeys on Laptops

EliteMacx86

Administrator
Staff member
Joined
Jul 22, 2018
Messages
8,025
Motherboard
Supermicro X11SPA-T
CPU
Intel Xeon W-3275 28 Core
Graphics
2xAMD RX 580 8GB
OS X/macOS
13.x
Bootloader
  1. OpenCore (UEFI)
Mac
  1. Mac mini
  2. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
How to Remap Brightness Hotkeys on Laptops

An EliteMacx86 Exclusive Guide - This guide covers the mapping of Brightness Hotkeys on Laptops

I. Overview


After enabling the backlight which results in adding a slider in SysPrefs->Displays, the brightness hotkeys will not work. This guide will enable the brightness hotkeys on your laptop. By using the hotkeys, you can control the amount of brightness.

Before starting with this guide, make sure you've implemented the Backlight Control on your Laptop

Once you've fixed your backlight control, you can remap your brightness hotkeys.
All the keys on the keyboard have a unique code. The brightness keys can be controlled as Fn+Fx. Some laptops use Arrow Keys too.

II. Available Methods for Mapping


This guide covers remapping the Brightness Hotkeys on Laptops. Both methods are described below. Chose one method. Do not use them together.


MethodNotes
BrightnessKeys
  • Easy to map.
  • No patching is required.
  • Supports ACPI Brightness
  • Minimal patching is required for some old ThinkPad models.
  • Highly Recommended
DSDT Patch
  • Can be difficult to map when compared with BrightnessKeys
  • DSDT Patching required
  • Supports ACPI Brightness
  • Recommended if BrightnessKeys does not work.

III. Preparation


Before you map the brightness hotkeys, you must prepare the system accordingly. To prepare the target system, follow the steps below.

STEP 1: Enable Brightness

The very first step is to enable Brightness to have the Brightness Hotkeys on your Laptop. Follow the guide linked below to enable Brightness on your Laptop.

Method #1: Using BrightnessKeys


Using the BrightnessKeys method, you simply need to add the Brightness.kext. However, a slight modification might be required on some models.

STEP 1: Add OS Check Fix Patch

On some laptop models, it might be necessary to add the OS Check Fix patch. This simulates Windows when running under Darwin (macOS/OS X). This can enable various Windows-only functionality in macOS/OS X. To add the OS Check Fix, follow the steps below.

STEP 2: Add Required Kext

The next step is to add the required kexts to enable the brightness hotkeys. BrightnessKeys doesn't work standalone. Lilu is needed to work in conjunction in order to enable the brightness hotkeys. This step shouldn't be required if you have followed the Installation Guide. However, if not, follow the steps below to add the kexts.

1. Download Lilu and BrightnessKeys from the downloads section of this forum.
2. Mount your ESP.

For Clover:
If you're using Clover, copy both the kexts to EFI/Clover/Kext/Others directory.

For OpenCore:
If you're using OpenCore, copy both the kexts to EFI/OC/Kexts directory. You'll also need to add the kext entries in the Kernel section of your config.plist.

NOTES:
  • Download the latest version for better support.
  • Download only the RELEASE.zip file.
  • If the kext is already present in the directory, replace them with a new version
  • Do not use BrightnessKeys.kext.dSYM and Lilu.kext.dSYM

Method #2: Using Hotpatch


Method #3: Using DSDT Patch


Using the DSDT patch method, you can change the


STEP 1: Finding Keyboard Driver

First, you need to find what Keyboard driver your laptop uses. To find this, you can use IOReg.

1. Download and open IOReg and type "keyboard" in the search bar. You should see something similar to the screenshot attached below.

Screen Shot 2018-08-30 at 8.49.45 PM.png

In this case, ApplePS2Keyboard attaches to ApplePS2KeyboardDevice, which attaches to ps2controller, all of which attach to KBC0, this is the device name we're looking for.

NOTE:
  • Every laptop does not use KBC0, some may use PS2K.

You'll need to know what exact codes or commands are called when the key is pressed. Usually, media keys generate EC queries. A quick way to know is to use ACPIDebug.kext to instrument all EC query methods, then press the keys while monitoring system.log. When you press the keys, the name of the method will be output, which will allow you to patch that method.

NOTES:


STEP 2: Determining the EC query methods


ACPIDebug.kext: https://github.com/RehabMan/OS-X-ACPI-Debug
Download and install the ACPIDebug.kext to S/L/E
Open MaciASL and add the ACPIDebug in Sources
Open your DSDT and apply "Add DSDT Debug Methods"
Also apply "Instrument EC Queries"
Click on Close
Save the DSDT file to any other location.
Copy the patched DSDT to your EFI/ACPI/Patched
Restart
Press your brightness keys and monitor the system.log.

STEP 3: Patching the DSDT for Hotkeys


Once you get the methods that result in the brightness keys, you can patch your DSDT.

Assuming that _Q11 is brightness down, and _Q12 is up, as per the logs.

1. Open your DSDT using MaciASL
2. Click on the Patch button
Code:
#Edit methods _Q11 and _Q12 to interface with KBC0 (or PS2K in some systems),
into method label _Q11 replace_content
begin
// Brightness Down\n
Notify (KBC0, 0x20)\n
end;

into method label _Q12 replace_content
begin
// Brightness Up\n
Notify (KBC0, 0x10)\n
end;
3. Click on Apply
4. Click on Close
5. Click on Compile
6. Go to File
7. Select Save as
8. A dialogue box will appear asking for the location and the file extension to save the file.
9. Select ACPI(ACPI Machine Language)
10. Click on Save

NOTES:
  • Change the value of the Keyboard according to the IOReg found in your laptop. For e.g KBC0.
  • Change the value of corresponding keys according to the system.log. For e.g _Q11 for brightness down and _Q12 for down.

STEP 4: Installing the DSDT and SSDT

The next step is to install the DSDT and SSDT. To install the DSDT and SSDT, follow the steps below.

1. Mount your ESP

For Clover:
If you're using Clover, copy all patched DSDT to EFI/Clover/ACPI/patched

For OpenCore:
If you're using OpenCore, copy patched DSDT to EFI/OC/ACPI. You'll also need to add the ACPI entry in ACPI>Add section of your config.plist

Restart your System


After performing all the above steps, restart your system for the applied changes to take effect.
Now you should be able to get your Brightness Hotkeys working.


Problem Reporting


Details:
  1. macOS version
  2. Copy of IOReg
  3. Kextcache output
Screenshots:
  • DPCIManager/Status
  • About This Mac
  • System Information/Graphics/Displays
  • System Preferences>Displays
Files:
  • For Clover, compress EFI/Clover, exclude the themes folder.
  • For OpenCore, compress EFI/OC.
  • ACPI dump
Notes:
  • Do not include the complete EFI folder.
  • Put all files in a folder with your name, compress files as Zip and attach files using site attachments only.
  • Do not use any external links.


Credits:
RehabMan
Shinzon
EMlyDinEsH
 
Last edited:
Hey, how do you set the keys to adjust the screen brightness on a laptop keyboard ?? Right now it's fn + f12 and fn + key pause. My bootloader is opencore. In my laptop acer v3-371, the shortcut from adjusting the screen brightness on the keyboard is the shortcut fn + left arrow key and fn + arrow right key.
 
Hey, how do you set the keys to adjust the screen brightness on a laptop keyboard ?? Right now it's fn + f12 and fn + key pause. My bootloader is opencore. In my laptop acer v3-371, the shortcut from adjusting the screen brightness on the keyboard is the shortcut fn + left arrow key and fn + arrow right key.
Use the above guide.
 
I don't have a dsdt file, in the opencore tutorial they didn't use the dsdt file and didn't add this file to config.plist. I want to use it but don't act and I don't know what I'm doing wrong. https://github.com/jsassu20/OpenCore-HotPatching-Guide/tree/master/17-Brightness Shortcut Patch
You can use the DSDT in Clover and Open Core. The configuration is same but the patching process is same.

For more information on patching DSDT and SSDT, read here:
 
You can use the DSDT in Clover and Open Core. The configuration is same but the patching process is same.

For more information on patching DSDT and SSDT, read here:
I understand but it's theoretically easier to make an ssdt patch than a dsdt and that's why I insist on it. I don't have a dsdt file and uploaded patches for dsdt.
 
I understand but it's theoretically easier to make an ssdt patch than a dsdt and that's why I insist on it. I don't have a dsdt file and uploaded patches for dsdt.
If you want to fix the issues, you'll have to follow the guides instructed here.
 
Good to know !
I will give a try to see if i can use Fn key on my laptop
 
  • Like
Reactions: EliteMacx86
Download and install the ACPIDebug.kext to S/L/E
i did everything exclude ACPIDebug.kext put in EFI, is it wrong? but on Monterey cant put in SLE
 

Forum statistics

Threads
1,839
Messages
17,151
Members
26,393
Latest member
Thanhnhann