Jump to content

UPDATED 20.12. GenericBrightness.kext


ivik
 Share

674 posts in this topic

Recommended Posts

Please read post 50.

After you find BAR0, add 0x15f2 to it and open that memory address PhysMem in reggie_se (32 bit).

Try changing those values. Maybe something changes.. if not... i don't hav any other solutions left.

Link to comment
Share on other sites

@ivik

Really thanks for your reply, the app in the second one works, but I can use Fn+Up/Down to control the brightness, and it's more convenient than the app.

When I use "GraphicsEnable=yes" to drive my video card, the sun appears, but it stays the maximum and couldn't be controlled through the Fn+ScrLk/Pause. Could you give me some tips to solve this problem? I really appreciate it.

 

Thanks.

Link to comment
Share on other sites

If menulet applet works, then brightness console app should also work. Try some mapping program for keys (spark, function flip) to run brightness up, brightness down.

 

Plase read whole thread and find info about scancodes, keycodes and mapping.

Link to comment
Share on other sites

Please read post 50.

After you find BAR0, add 0x15f2 to it and open that memory address PhysMem in reggie_se (32 bit).

Try changing those values. Maybe something changes.. if not... i don't hav any other solutions left.

 

Okay...installed developer tools. Using Reggie_SE went to where you suggested (which is at 0xFA0015f2) edited the values there which were all zeros and as soon as I tried to apply those values they always reset immediately to zero.

Looks like we are out of luck.

 

Nevermind, thanks for all the effort from your side. Nothing as yet has altered the brightness values in OSX after the boot screen and it looks like this is not going to happen!

:(

 

Thanks again.

Link to comment
Share on other sites

Please read this page. https://gist.github.com/raw/451904/ecdf2c40...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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

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)
		  }
	  }

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Looking at pommed source code:

      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;

 

It looks like osx read from SMI port brightness for that nvidia models.

So maybe changing injection model could change max brightness...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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.

DSDT.dsl.zip

Link to comment
Share on other sites

 Share

×
×
  • Create New...