Jump to content

UPDATED 20.12. GenericBrightness.kext


  • Please log in to reply
671 replies to this topic

#181
MiniHack

MiniHack

    InsanelyMac Legend

  • Donators
  • 616 posts
  • Gender:Male

Please read this page. https://gist.github....bf8/nvidia_bl.c

reg_offset = NV5X_PDISPLAY_OFFSET + NV5X_PDISPLAY_BRIGHTNESS_OFFSET
where:
NV5X_PDISPLAY_OFFSET=0x00610000
NV5X_PDISPLAY_BRIGHTNESS_OFFSET=0x0000c084

Maybe these values could work...


Thanks for your research. I see my model is listed and think that if I could understand the page it might help!

I have checked the addresses in Reggie_SE - both with the BAR0 value added (FA000000) and without and altered the values within the addresses to see if there was variation in the brightness, but saw no result. I am not sure if this was the correct way to check.

I will do some more reading and also check values in the registers again after changing pre-boot brightness and see how this progresses. In the meantime, again, thank you.

#182
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
try 0x00610000+0x0000c084+bar0... and some other permutations
also i think that RW-Everything has ability to read memory space..
try changing your brightness and read that spaces under windows... maybe osx is messing with brightness registers

#183
weizh126

weizh126

    InsanelyMac Protégé

  • Members
  • PipPip
  • 64 posts
@ivik
I'm really sorry, I mean we are not in the same time zone, so I couldn't reply to you immediately. I've already read this whole topic several times. My English is poor,and I'm not good at express myself. Thanks for your advices and your research, and my video card is listed in, too.
BTW, how to use the brightness console app?

#184
sw170

sw170

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 212 posts
  • Gender:Male
  • Location:UK
Hi ivik,

your little, cute Brightness Menulet works on my system with new BRGT method and I like it a lot !

I kept PNLF method as without it for some reason I`m loosing clamshell sleep, I know I can add to Device (LID) this:
Notify (SLPB, 0x80)
and I have it back but, but, but now I cant decide myself which method is better..

anyway! thank you for your work and inspiration mate !

Best Regards
swavek

EDIT:

just used your console utility to assign hotkeys for brightness control to F5-down, F6-up F4-brightness set.
works great !

#185
weizh126

weizh126

    InsanelyMac Protégé

  • Members
  • PipPip
  • 64 posts
I think the code should be added under the device(lid).

#186
Razorbackeve

Razorbackeve

    InsanelyMac Protégé

  • Members
  • PipPip
  • 55 posts
Success report on Sony vaio CR11-Z/R with Ati x2300. :)
Added to dsdt _BCL,_BCM and _BCQ methods from inside Device (LCD) to Device (BRGT) (This is the sony propietary controller chipset wich includes a lot of acpi functions for the Vaio laptops).

I do use Dong RadeonHD driver for video and now brightness change works.
The little applet is very nice and convenient also.
Thanks.

Here is my dsdt code addon replacing Device (PNLF):
 Device (BRGT)
		  {
			  Name (_HID, EisaId ("APP0321"))
			  Name (_CID, "brightness")
			  Name (_UID, 0x0A)
			  Name (_STA, 0x0B)
			  Method (_BCL, 0, NotSerialized)
			  {
				  Return (Package (0x0B)
				  {
					  0x64, 
					  0x64, 
					  0x04, 
					  0x10, 
					  0x1C, 
					  0x28, 
					  0x34, 
					  0x40, 
					  0x4C, 
					  0x58, 
					  0x64
				  })
			  }
  
			  Method (_BCM, 1, NotSerialized)
			  {
				  While (One)
				  {
					  Name (T_0, Zero)
					  Store (ToInteger (Arg0), T_0)
					  If (LEqual (T_0, 0x04))
					  {
						  Store (Zero, Local0)
					  }
					  Else
					  {
						  If (LEqual (T_0, 0x10))
						  {
							  Store (One, Local0)
						  }
						  Else
						  {
							  If (LEqual (T_0, 0x1C))
							  {
								  Store (0x02, Local0)
							  }
							  Else
							  {
								  If (LEqual (T_0, 0x28))
								  {
									  Store (0x03, Local0)
								  }
								  Else
								  {
									  If (LEqual (T_0, 0x34))
									  {
										  Store (0x04, Local0)
									  }
									  Else
									  {
										  If (LEqual (T_0, 0x40))
										  {
											  Store (0x05, Local0)
										  }
										  Else
										  {
											  If (LEqual (T_0, 0x4C))
											  {
												  Store (0x06, Local0)
											  }
											  Else
											  {
												  If (LEqual (T_0, 0x58))
												  {
													  Store (0x07, Local0)
												  }
												  Else
												  {
													  If (LEqual (T_0, 0x64))
													  {
														  Store (0x08, Local0)
													  }
													  Else
													  {
														  Store (0x08, Local0)
													  }
												  }
											  }
										  }
									  }
								  }
							  }
						  }
					  }
  
					  Break
				  }
  
				  ^^PCI0.LPCB.SNC.SBRT (Local0)
			  }
  
			  Method (_BQC, 0, NotSerialized)
			  {
				  Store (^^PCI0.LPCB.SNC.GBRT (), Local0)
				  While (One)
				  {
					  Name (T_0, Zero)
					  Store (ToInteger (Local0), T_0)
					  If (LEqual (T_0, 0x08))
					  {
						  Store (0x64, Local1)
					  }
					  Else
					  {
						  If (LEqual (T_0, 0x07))
						  {
							  Store (0x58, Local1)
						  }
						  Else
						  {
							  If (LEqual (T_0, 0x06))
							  {
								  Store (0x4C, Local1)
							  }
							  Else
							  {
								  If (LEqual (T_0, 0x05))
								  {
									  Store (0x40, Local1)
								  }
								  Else
								  {
									  If (LEqual (T_0, 0x04))
									  {
										  Store (0x34, Local1)
									  }
									  Else
									  {
										  If (LEqual (T_0, 0x03))
										  {
											  Store (0x28, Local1)
										  }
										  Else
										  {
											  If (LEqual (T_0, 0x02))
											  {
												  Store (0x1C, Local1)
											  }
											  Else
											  {
												  If (LEqual (T_0, One))
												  {
													  Store (0x10, Local1)
												  }
												  Else
												  {
													  If (LEqual (T_0, Zero))
													  {
														  Store (0x04, Local1)
													  }
													  Else
													  {
														  Store (0x64, Local1)
													  }
												  }
											  }
										  }
									  }
								  }
							  }
						  }
					  }
				  }
  
				  Return (Local1)
			  }
		  }


#187
MiniHack

MiniHack

    InsanelyMac Legend

  • Donators
  • 616 posts
  • Gender:Male
Ivik,

You were right. For the Nvidia cards listed in that document the control register is at BAR0 + 61c084. For me this is 0xFA61c084.

There are sixteen brightness steps as follows from max to min.:


4001DF68, 4001C335, 4001A520, 4001870C, 400168F7, 40014AE2, 40012CCE, 40010EB9, 4000F0A5, 4000D290, 4000B47B, 40009667, 40007852, 40005A3E, 40003C29, 40001E15.

That was the good news. The bad news is this register is only seemingly read at startup, so while it may let you change a value in it from inside OSX, it ignores that value...........it also does not keep the value at next boot that you put into it whilst in OSX. In other words, it only remembers the value from the last pre-boot period.

The values above were obtained by a tedious restarting regime of using fn + up/down arrow by one step at each boot screen.

Any ideas on a dynamic solution?

#188
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
So... you can write to it, but brightness doesn't change?
Maybe is just status register...

#189
weizh126

weizh126

    InsanelyMac Protégé

  • Members
  • PipPip
  • 64 posts
Still no luck.
The app you mentioned cannot get the scancodes.

#190
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
It needs keycodes. Scancodes must be mapped to keycodes by keyboard driver.

#191
Bungo

Bungo

    InsanelyMac Sage

  • Coders
  • 296 posts
  • Gender:Male
Hi ivik,

What's about with LCD panel support? Maybe it's needed too. I noticed that no brightness control if used non Apple display with Mac Pro.

#192
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
Don't know about that...

#193
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

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?

bump :P

#194
MiniHack

MiniHack

    InsanelyMac Legend

  • Donators
  • 616 posts
  • Gender:Male

bump ;)


Hi Scrax,

Actually no, I haven't given this one a go on the Zotac as I am lazy! I plug the Zotac into the TV and have no need for a brightness control. To be honest I hadn't even checked until you bumped and sure enough brightness on there is not out of the box. There may be a chance that the pnlf approach or iviks ideas work on there so try them out! Brightness control on the laptop though is a bit more important... so I'll keep looking at that now that Ivik has pointed me a direction.

With a little regret though I can let you know that I am shortly leaving insanelymac as a regular place to hang out and will now use some of the other forums more often. This is because I chose to speak freely on a matter in support of a developer on another thread and had my post silently removed. So thanks for all the banter and I'll catch up with you again elsewhere. :)

@ Ivik. Thanks for all your assistance in trying to work out solutions for all of us and good luck.

#195
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
Looking at pommed source code:
[codebox] logdebug("Failed to detect nVidia GeForce 8600M GT/9400M/9600M GT, aborting...\n");
return -1;
}

/* Determine backlight I/O port */
switch (mops->type)
{
case MACHINE_MACBOOKPRO_3:
case MACHINE_MACBOOKPRO_4:
bl_port = 0xb2; /* 0xb2 - 0xb3 */
break;

case MACHINE_MACBOOKPRO_5:
case MACHINE_MACBOOK_5:
case MACHINE_MACBOOKAIR_2:
bl_port = 0x52e; /* 0x52e - 0x52f */
break;
[/codebox]

It looks like osx read from SMI port brightness for that nvidia models.
So maybe changing injection model could change max brightness...

#196
sw170

sw170

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 212 posts
  • Gender:Male
  • Location:UK

I think the code should be added under the device(lid).

Hi 'weizh126'
interesting, why do you think that ?
..
and here is how you can assign hot keys to ivik's brightness utility:

1. Copy brightness utility to /usr/brightness
2. Create three scripts with AppleScript Editor:
for brightness up
do shell script "/usr/brightness up"
for brightness down
do shell script "/usr/brightness down"
for brightness set
do shell script "/usr/brightness set 50"
3. Save them in your Scripts folder (or anywhere you want, applications folder?)
4. Use any program that can assign hot keys for apps, scripts (I used DragThing) to run your scripts (I did F4-brightness set, F5-bup, F6-bdown)

hope that will help
Regards
s

#197
weizh126

weizh126

    InsanelyMac Protégé

  • Members
  • PipPip
  • 64 posts
@swavek

In DSDTSE, it provides some DSDT hacks, and the LID Sleep is listed. And here is the code
LID Sleep.
Code to fix sleep when closing the lid of the laptop:

Device (LID)
{
Name (_HID, EisaId ("PNP0C0D"))	  //LID device
Name (LIDS, One)
Method (_LID, 0, NotSerialized)
{
Store (^^PCI0.SBRG.EC0.SF13, LIDS) //LID register
XOr (LIDS, One, Local0)
IF (Local0)									 //if LID is closed 
{ 
Notify (SLPB, 0x80)						 //Set system to sleep
} 
Return (LIDS)
}

And in ACPI Specification, I find this
9.4   Control Method Lid Device
Platforms containing lids convey lid status (open / closed) to OSPM using a Control Method Lid Device.
To implement a control method lid device, AML code should issue a Notify(lid_device, 0x80) for the device whenever the lid status has changed. The _LID control method for the lid device must be implemented to report the current state of the lid as either opened or closed.
The lid device can support _PRW and _PSW methods to select the wake functions for the lid when the lid transitions from closed to opened.
The Plug and Play ID of an ACPI control method lid device is PNP0C0D.
Table 9-3   Control Method Lid Device
Object	Description
_LID			Returns the current status of the lid.
9.4.1   _LID
Evaluates to the current status of the lid. 
Arguments:
None
Return Value:
An Integer containing the current lid status
	0 –				The lid is closed
	Non-zero –	The lid is open
So I think it should be better to add Notify (SLPB, 0x80) under the Device(LID).And I have tested this method on several laptops, it works very well. Maybe you can try this.

And really thanks for your so detailed tutorial, I'll try it.God bless me ;)

It works! And I use the spark, I assign the F6 and F7 to the up and down. But what confuses me is when I press the Pause or use Fn+ Delete (the combination key represents ScrLk) , nothing happens, and it seems the app cannot get it,but when I press Insert, the app shows the hotkey was "help", then I use the Fn+Insert(representing NmLk), it shows a icon that I don't know. I can use the Fn+Up/Down( representing the brightness up/down on the keyboard) to control the brightness, so the Fn is ok. I know very little about the keyboard, maybe it is just because the ps2 kexts don't fit my keyboard.

#198
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
@minihack
According to this: http://www.projectos...?...post&p=4601

event 0x86 is brightness up, 0x87 is brightness down.

And in your dsdt these events exists.. Maybe trigering them inside BCM method could change brightness.

Try this dsdt

Attached Files



#199
kidalive

kidalive

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 263 posts
  • Gender:Male
Hello, ivik. I`ve added what u mentioned but still not working. I can adjust my laptop brightness without editing DSDT and have the brightness bar showed up with Fn+Del and Fn+PauseBreak but no brightness changes. Interestingly my brightness adjusting button are FN+F7(UP) FN+F8(DOWN), it works great but no Sun symbol shows up and the Brightness Slider in the Displays are the maximum. Below is what I added.
Device (PNLF)
					{
						Name (_HID, EisaId ("APP0002"))
						Name (_CID, "backlight")
						Name (_UID, 0x0C)
						Name (_STA, 0x0B)
						Method (_BCL, 0, NotSerialized)
						{
							Return (Package (0x0A)
							{
								0x4B, 
								0x0D, 
								0x0D, 
								0x19, 
								0x26, 
								0x32, 
								0x3F, 
								0x4B, 
								0x58, 
								0x64
							})
						}

						Name (BTBL, Package (0x08)
						{
							0x0D, 
							0x19, 
							0x26, 
							0x32, 
							0x3F, 
							0x4B, 
							0x58, 
							0x64
						})
						Method (_BCM, 1, NotSerialized)
						{
							Store (Match (BTBL, MEQ, Arg0, MTR, Zero, Zero), Local0)
							Store (Local0, ^^^LPCB.EC.BKLG)
							Store (Local0, BRTL)
							Store (Local0, LCDL)
						}

						Method (_BQC, 0, NotSerialized)
						{
							Return (Index (BTBL, ^^^LPCB.EC.BKLG))
						}
					}

dmesg log said so.
display: Not usable
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM
GenericBrightness: No object of method _BCM

Please have a check of my DSDT.

Attached Files



#200
ivik

ivik

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 280 posts
Which package? Second or third?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy