Code Monkey home page Code Monkey logo

brightnesskeys's Introduction

BrightnessKeys

Build Status

Automatic handling of brightness keys based on ACPI Specification, Appendix B: Video Extensions.

Requires Lilu 1.2.0 or newer.

Special cases

Typically no DSDT patches are required. Please remove old _QXX to XQXX ones.

Spoiler: On some old ThinkPad models, additional handling may be required.
Here is an example for their "brightness up" EC event.
Method (_Q14, 0, NotSerialized)
{
    If (^HKEY.MHKK (0x8000))
    {
        ^HKEY.MHKQ (0x1010)                // Vendor-specific event: TP_HKEY_EV_BRGHT_UP
    }

    If (NBCF) // Whether
    {
        If (VIGD)
        {
            Notify (^^^VID.LCD0, 0x86)     // Send 0x86 "Increase Brightness" to integrated graphics
        }
        Else
        {
            Notify (^^^PEG.VID.LCD0, 0x86) // Send 0x86 "Increase Brightness" to discrete graphics
        }
    }
    Else
    {
        Local0 = BRLV                      // Local variable to store current brightness level
        If ((Local0 != 0x0F))
        {
            Local0++
            BRLV = Local0
        }

        If (VIGD)
        {
            UCMS (0x16)                    // SMI access for integrated graphics
            BRNS ()
        }
        Else
        {
            VBRC (Local0)                  // SMI access for discrete graphics
        }

        ^HKEY.MHKQ (0x6050)                // Vendor-specific event: TP_HKEY_EV_BACKLIGHT_CHANGED
    }
}

When NBCF is set to zero by default, the method will not notify graphics devices and try to adjust brightness directly. To override that, set NBCF = 0x01 in SSDT hotpatch, or just replace its declaration using a simple patch.

  • For DSDT compiled with older iasl:

Replace Name (NBCF, 0x00) to Name (NBCF, 0x01):

Find: 08 4E424346 0A 00 // NameOp "NBCF" BytePrefix "00"

Repl: 08 4E424346 0A 01 // NameOp "NBCF" BytePrefix "01"

  • For DSDT compiled with newer iasl:

Replace Name (NBCF, Zero) to Name (NBCF, One):

Find: 08 4E424346 00 // NameOp "NBCF" ZeroOp

Repl: 08 4E424346 01 // NameOp "NBCF" OneOp

Thanks Sniki for raising this issue.

Credits

brightnesskeys's People

Contributors

vit9696 avatar usr-sse2 avatar zhen-zen avatar vandroiy2013 avatar al3xtjames avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.