Jump to content

UPDATED 20.12. GenericBrightness.kext


ivik
 Share

674 posts in this topic

Recommended Posts

Does your hardware have 16 steps? In no, you can't just "invent" them.

That on-screen brightness levels are hardcoded.

 

0x61254 is where apple hardware changes brightness for intel grpahics. Other vendors have other methods. (EC, SMIF..)

Link to comment
Share on other sites

Does your hardware have 16 steps? In no, you can't just "invent" them.

That on-screen brightness levels are hardcoded.

 

0x61254 is where apple hardware changes brightness for intel grpahics. Other vendors have other methods. (EC, SMIF..)

Looking like only 11 steps - I see that in Linux too, but have yet to check Win register stuff and EC. What I was kind of hoping was that the steps (however many) would be "spread equally" over the 16 steps on the "sun". But even when I don't add steps to DSDT, it's not really working out great. Anyway, not so important as the next bit:

 

Main issue now dumping FunctionFlip, in post #21, you reference "NX_KEYTYPE_BRIGHTNESS_UP/DOWN". Well, can't find where to get latest VoodooPS2 source, and version I have from Stig does not include those references. (Same issue for ApplePS2). So tried a few things, got ApplePS2 stuff compiled but doesn't enable use of FN+UP/DOWN for sending the right codes, and actually am breaking various parts of the keyboard like FN-L/R for volume - not got it right yet.

 

So, if you have time to post some "instructions" on that aspect of source code mods, would be much appreciated.

Link to comment
Share on other sites

Hi, can I remap the brightness keys by adding an entry in this section of the voodoo source?

 

// special key definition
	0x0b, // number of special keys
	// ( NX_KEYTYPE,		Virtual ADB code )
	NX_KEYTYPE_CAPS_LOCK,   0x39,
	NX_KEYTYPE_HELP,		0x72,
	NX_POWER_KEY,		   0x7f,
	NX_KEYTYPE_MUTE,		0x4a,
	NX_KEYTYPE_SOUND_UP,	0x48,
	NX_KEYTYPE_SOUND_DOWN,  0x49,
	// remove arrow keys as special keys. They are generating double up/down scroll events
	// in both carbon and coco apps.
	//NX_UP_ARROW_KEY,		0x7e,	   // ADB is 3e raw, 7e virtual (KMAP)
	//NX_DOWN_ARROW_KEY,	  0x7d,	   // ADB is 0x3d raw, 7d virtual
	NX_KEYTYPE_NUM_LOCK,	0x47,	   // ADB combines with CLEAR key for numlock
	NX_KEYTYPE_VIDMIRROR,   0x70,
	NX_KEYTYPE_PLAY,		0x34,
	NX_KEYTYPE_NEXT,		0x42,	   // if this event repeated, act as NX_KEYTYPE_FAST
	NX_KEYTYPE_PREVIOUS,	0x4d		// if this event repeated, act as NX_KEYTYPE_REWIND
};

 

Some FN key in my keyboard doesnt seem to emmit scan codes (brightness keys FN+F7/F8 for example), is that normal?

Link to comment
Share on other sites

You can map all keys that emmit scancodes. They you remap them to ADB keycodes, and that's all.

 

If they don't emmit scancodes... then this is problem. It all depends on how vendors implement it. My acer emmits scancodes for brightness.

But for example, other keys like mail,www,P and e key don't; if i dont first write command 0x59 with argument 0x90 to my keyboard controller: http://www.mail-archive.com/linux-input@vg...g/msg00118.html

Link to comment
Share on other sites

Ivik,

 

Thank you for the link. Got it. Seems pretty much same as already had (in that no NX_KEYTYPE_BRIGHNESS..)

Anyway: Not so sure if my kbd is giving sensible scan codes:

 

UP (= FN+UP arrow)

Nov 19 14:40:33 MacBook kernel[0]: ApplePS2Keyboard: Unknown ADB key for PS2 scancode: 0x8

Nov 19 14:40:33 MacBook kernel[0]: ApplePS2Keyboard: PS/2 scancode 0xe0

Nov 19 14:40:33 MacBook kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x88

Nov 19 14:40:33 MacBook kernel[0]: ApplePS2Keyboard: Unknown ADB key for PS2 scancode: 0x88

 

 

DOWN (=FN+Down arrow)

Nov 19 14:40:56 MacBook kernel[0]: ApplePS2Keyboard: Unknown ADB key for PS2 scancode: 0x9

Nov 19 14:40:56 MacBook kernel[0]: ApplePS2Keyboard: PS/2 scancode 0xe0

Nov 19 14:40:56 MacBook kernel[0]: ApplePS2Keyboard: PS/2 scancode 0x89

Nov 19 14:40:56 MacBook kernel[0]: ApplePS2Keyboard: Unknown ADB key for PS2 scancode: 0x89

 

But note that FuntionFlip app can make brightness on F1, F2. Also note w/o FuncFlip, Volume (FN+Left/Right) works, (meaning OSX widget on screen OK), just those keys disabled when FuncFlip runs.

 

Anyway, the 0x8 and 0x9 stuff worries me as I dont think I'm addressing that issue correctly, but modded code like:

.cpp

 0x0d, // number of special keys
       // ( NX_KEYTYPE,        Virtual ADB code )
       NX_KEYTYPE_CAPS_LOCK,   0x39,
       NX_KEYTYPE_HELP,        0x72,
       NX_POWER_KEY,           0x7f,
       NX_KEYTYPE_MUTE,        0x4a,
       NX_KEYTYPE_SOUND_UP,    0x48,
       NX_KEYTYPE_SOUND_DOWN,  0x49,
	NX_KEYTYPE_BRIGHTNESS_UP,		0x90,
	NX_KEYTYPE_BRIGHTNESS_DOWN,		0x91,

 

and earlier:

 0x00,0xe0,0x88, //90 Main Brightness Up//changed from 0x00 to my code
       0x00,0xe0,0x89, //91 Main Brightness Down

 

plus .h

 DEADKEY,// e0 87 
   0x90,// e0 88 Added
   0x91,// e0 89 Added

But no luck so far.

Link to comment
Share on other sites

You corectly modified VoodooPS2Keyboard.cpp. This is only modification that you need in that file.

 

Next thing to modify is ApplePS2ToADBMap.h

Right column are scancodes, left ADB.

On the right find scancode 0xe0 0x88 and then on left add ADB keycode 0x90. (0x90->adb keycode for brightness up)

Link to comment
Share on other sites

Hi Ivik,

 

On my Vostro 3500 I have tried adding the PNLF device and from that get the SUN menu but fixed at 100%.

 

IOreg backlight portion is as shown in the attached screen shot with all values at zero.

 

Native brightness buttons (fn + up arrow/down arrow) do not work once booted either, but prior to log in the brightness does work and I can observe a message that seems to indicate that the down and up brightness keys equate to "PS2 extended scan function 0x5" and "PS2 extended scan function 0x6". Googling around it looks like maybe the extended codes means a prefix of E0H....and that therefore the codes I am after are E0H5 and E0H6.

 

While the ideal for me would be to find a way to get the OSX brightness working - and I have had reasonable past success with DSDT modding - I'd be happy enough to just get the Dell function keys for it working. I don't have any experience of de-compiling and re-compiling kexts such as the VoodooPS2keyboard.kext.

 

If there is any way you can help out I'd be very grateful.

post-255812-1290189578_thumb.jpg

IOregpic.zip

Link to comment
Share on other sites

You corectly modified VoodooPS2Keyboard.cpp. This is only modification that you need in that file.

 

Next thing to modify is ApplePS2ToADBMap.h

Right column are scancodes, left ADB.

On the right find scancode 0xe0 0x88 and then on left add ADB keycode 0x90. (0x90->adb keycode for brightness up)

Hmmm. Must be missing something, as have done that and nada, not working.

Thanks anyway...will keep trying stuff.

Link to comment
Share on other sites

Nope, no change I'm afraid - the kext plus menulet etc don't change the brightness level for me. Maybe the BCL/BCM methods to be incorporated into the DSDT are the ones in the attached SSDT relating to the LCD....what do you think?

SSDT_2.aml.zip

Hi MiniHack,

have you tried on the zotac?

I can't use the brightness keys on the apple usb keyboard with the integrated GPU, you?

 

Ivik, i'm using a MacMini dsdt patched for my mobo, could you take a look? Or is better if I post you the original one?

dsdtSCRAXfromMACMINI.dsl.zip

Link to comment
Share on other sites

Hi ivik,
reallly thanks for your great job.
I did as your post, but no luck, the Fn+ScrLK/Pause is still no use, and there is no the so-called 'sun' logo.
When I tried the 1st archive in Post #1, I got this log in console

Acpi brightness levels:11, lowest brightness:0, highest brightness:100
We still don't have brightness entry in ioreg... waiting...
Then I used the 3rd archive, and the log is
Acpi brightness levels:11, lowest brightness:0, highest brightness:100
. The 2nd log was gone.But still no luck for me.
I can control the brightness by Fn+Up/Down as zprood,and I've tried the voodoops2controller you provided to zprood, but this kext can't drive my keyboard, so I don't know how to get my scancodes.
My vedio card is NVIDIA GF9300MGS drived by the DSDT.
The attachment is my DSDT&ioreg&ps2 kext.

Thanks.
archive.zip
Link to comment
Share on other sites

Thanks for your efforts Ivik, but unfortunately the latest DSDT does not work to change brightness (using the menu app).

I am wondering if the scan code method might be best in some cases. Maybe a menu app that had + and - keys that generate the scan codes and a preference setting to allow those scan codes to be preset according to the PC....e.g. for me E0H5 for - and E0H6 for +. That might at least work for users who have no way at all of changing brightness.

Anyway, I am of course really happy to continue testing any new developments you come up with!

Link to comment
Share on other sites

 Share

×
×
  • Create New...