The ACPI specification
provides (in appendix B) a standard for exposing information about the video hardware. One of the features it provides is getting and setting the screen brightness on laptops.
Let's look at how we can interact with the screen brightness on laptops:
Asus: Depending on the machine, call the BLVL, BRIT or GPLV ACPI methods. This will return the brightness as an integer.
Dell: Parse the SMBios tables looking for an entry with a specific (currently unpublished) token. This will provide an SMI number. Call it. Doing this requires a 200K library.
HP: Access the nvram-like area located at ioports 0x72 and 0x73. The AC brightness appears to be at 0x97, and the DC brightness at 0x99. Both are in the lower 5 bits of the byte.
IBM: For the lack of a better solution, read byte 0x31 of the embedded controller address space. The lower 3 bits contain the brightness.
Panasonic: Call the SSET ACPI method with an integer representing which value you want to read.
Sony: Call the GBRT ACPI method. The brightness is returned as an integer. Some newer machines have these functions, but they do nothing.
Toshiba: Call an HCI (on most machines, this can be done with the VALD.GHCI or VALZ.GHCI ACPI methods, but some newer machines are missing those) with 0x2a as the argument. The top 3 bits of the result are the brightness.
Any other vendors: Not a fucking clue.
Score out of 10 for laptop manufacturers: -100000000000000000000000000000000000000
000000000000000000. See me (for brutal murder with axes)