Jump to content

HP DVx ACPI 3.x/4.x Battery Driver (10.6/10.7)


  • Please log in to reply
227 replies to this topic

#41
Komano

Komano

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 175 posts
Interesting. I've applied your DSDT fixes for Lion. But it wasn't working so i switched to the debug version and apparently there isn't anything either.

My kext is in S/L/E and not E/E

Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Version 2011.0802 starting
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager::setPowerState: which = 0x1
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.

That's all i get. Ideas?

Also, I'm on a HP Envy 15 1150-nr. F2B. A Bios.

DSDT Attached incase you want to look at it.

Attached File  dsdtmod2lxbat.zip   59.9KB   28 downloads

#42
Cyrus the Great

Cyrus the Great

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 276 posts
  • Gender:Male
  • Location:tehran
thanks gsly work perfect for me .just rename ECON to ECOK.(my system default)

#43
dantesieg

dantesieg

    InsanelyMac Protégé

  • Members
  • Pip
  • 16 posts
  • Gender:Male
It works perfect, thank you gsly.

#44
gsly

gsly

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 143 posts
  • Gender:Male
  • Location:The Great White North

thanks gsly work perfect for me .just rename ECON to ECOK.(my system default)

Thanks for the feedback. What HP model and BIOS version is this?


It works perfect, thank you gsly.

Thanks for the feedback.

#45
gsly

gsly

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 143 posts
  • Gender:Male
  • Location:The Great White North

Interesting. I've applied your DSDT fixes for Lion. But it wasn't working so i switched to the debug version and apparently there isn't anything either.

My kext is in S/L/E and not E/E

Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Version 2011.0802 starting
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager::setPowerState: which = 0x1
Sep 22 16:38:38 localhost kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.

That's all i get. Ideas?

Also, I'm on a HP Envy 15 1150-nr. F2B. A Bios.

DSDT Attached incase you want to look at it.

Attached File  dsdtmod2lxbat.zip   59.9KB   28 downloads

Ah! You are the tester I've been looking for! Your system claims it supports two batteries and the original code didn't really handle this case (well). Try putting the battery in the other bay and see if it works.

Your other option is to remove either BAT0 or BAT1 depending on which one corresponds to your preferred battery bay :(

I think I could add the code to support multiple batteries, but I don't have a test platform nor do I know how prevalent 2+ battery bays are to warrant the time (I've got other ideas and issues to tackle first)



More important for me would be if your kext could have ability to put computer to sleep on low battery: for example on 5% battery level while is on battery power would tell to system (terminal command):

osascript -e 'tell application "System Events" to sleep'
possible ?
Thanks again

As I posted previously, the function of the driver is to provide power details to the power management system and its that system that determines when to initiate a system sleep. The problem is that when the power management system issues a sleep request, older kexts/applications that do not respond to the request prevent the sleep from completing. I suspect some of the older "core" kexts we use like VoodooPS2/etc are the actual problem. Now that I have Lion working, I'm going to do some testing related to this...

However, I've also been thinking that we *could* deviate from Apple's way and and have the battery driver initiate the forced sleep (not idle sleep like PM as that can be cancelled) when it calculates its at the low/critical values.

See http://developer.app...340/_index.html
See http://support.apple.com/kb/ht1776

#46
Komano

Komano

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 175 posts

Ah! You are the tester I've been looking for! Your system claims it supports two batteries and the original code didn't really handle this case (well). Try putting the battery in the other bay and see if it works.

Your other option is to remove either BAT0 or BAT1 depending on which one corresponds to your preferred battery bay :)

I think I could add the code to support multiple batteries, but I don't have a test platform nor do I know how prevalent 2+ battery bays are to warrant the time (I've got other ideas and issues to tackle first)



Unfortunately as much as i would like to test for you, I do not have the other battery. I bought this laptop without the Extra "Slice" Battery. It weighs like 1.75kg for just a battery. :( I did however managed to get an output from the debug kext. I think Lion was using the cache so i had to delete the kext, reboot then install the kext and reboot again. This is the output i have.

Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager: Version 2011.0802 starting
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::setPowerState: which = 0x1
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery: Using ACPI extended battery information method _BIX
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery: Using ACPI extra battery information method BBIX
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::clearBatteryState: do_update = false
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::pollBatteryState: path = 0x2
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::pollBatteryState: path = 0x1
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatterySTA called
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatterySTA: battery_status = 0x1f
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBIX called
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager: Version 2011.0802 starting
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager: Battery Supported Count(s) 2.
Sep 22 22:11:12 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::setPowerState: which = 0x1
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBIX: acpibat_bix size = 20
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBBIX called
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: acpibat_bbix size = 16
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fManufacturerAccess	= 0x0
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fBatteryMode		   = 0x6001
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAtRateTimeToFull	  = 0xffff (min)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAtRateTimeToEmpty	 = 0xffff (min)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fTemperature		   = 0xc0f (0.1K)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fVoltage			   = 0x3043 (mV)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fCurrent			   = 0x3 (mA)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAverageCurrent		= 0x1 (mA)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fRelativeStateOfCharge = 0x60 (%)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAbsoluteStateOfCharge = 0x4d (%)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fRemainingCapacity	 = 0xe5b (mAh)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fRunTimeToEmpty		= 0xffff (min)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAverageTimeToEmpty	= 0xffff (min)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fAverageTimeToFull	 = 0x2d3c (min)
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fManufactureDate	   = 0x3b9b
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBBIX: fManufacturerData size = 0xf
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::unpackDate: packedDate = 0x3b9b
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBatteryManager::getBatteryBST called
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: acpibat_bst size = 4
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fPowerUnit	   = 0x1
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: currentStatus	= 0x0
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentRate	 = 0x3
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentCapacity = 0xe5b
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fCurrentVoltage  = 0x3043
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::setBatteryBST: fAverageRate = 0x3
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery: Battery is charged.
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::constructAppleSerialNumber called
Sep 22 22:11:13 Zanes-MacBook-Pro kernel[0]: AppleSmartBattery::rebuildLegacyIOBatteryInfo called

So i'm assuming my battery is actually BAT1?

#47
gsly

gsly

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 143 posts
  • Gender:Male
  • Location:The Great White North

Hi gsly;

Here is the debug output with your new kext. I run both with true and false set none seems to do the trick.
I am also including my dsdt as it is today.

On Battery, it show 20:00 to discharge time left but 0% if I change time left to percentage

Once again thanks for your help
g53

Sorry for the delay on this. Your DSDT does some different calculations based on what it detects so you are going to have to work through this yourself. I added some comments to your DSDT on what I could figure out without actual hardware. Basically, you just need to determine what units/values the battery hardware is returning to the DSDT methods and then make sure they match the ACPI specification.

Attached File  DSDTG53SW.zip   43.05KB   34 downloads

Unfortunately as much as i would like to test for you, I do not have the other battery. I bought this laptop without the Extra "Slice" Battery. It weighs like 1.75kg for just a battery. :( I did however managed to get an output from the debug kext. I think Lion was using the cache so i had to delete the kext, reboot then install the kext and reboot again.
...
So i'm assuming my battery is actually BAT1?

I'd say it's BAT0 as that is the lowest _UID value and first in the DSDT (it depends on how the Apple function enumerates the devices). Easy way to find out, make _STA for one of the devices return 0x00 (no battery present) in that device and see which one the driver doesn't see :) Then rip out all the code for the battery you don't have...

#48
Cyrus the Great

Cyrus the Great

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 276 posts
  • Gender:Male
  • Location:tehran

Thanks for the feedback. What HP model and BIOS version is this?



Thanks for the feedback.

hi;
hp dv6-1125ee c2d with this bios :3623f44 insyde efi bios.

#49
Komano

Komano

    InsanelyMac Geek

  • Members
  • PipPipPipPip
  • 175 posts

I'd say it's BAT0 as that is the lowest _UID value and first in the DSDT (it depends on how the Apple function enumerates the devices). Easy way to find out, make _STA for one of the devices return 0x00 (no battery present) in that device and see which one the driver doesn't see :D Then rip out all the code for the battery you don't have...


Done. I returned 0x00 for BAT1 and true enough the driver detected my battery. So i believe BAT0 is the internal battery. Everything else works great! :P

Sorry i couldn't test the dual battery solution for you though, But lets hope we get another HP Envy 15 user with the Slice battery. I'm going to make a guide so that people can get OS X their Envy's too. Thanks for helping with the battery solution! :)

#50
ugokind

ugokind

    InsanelyMac Deity

  • Donators
  • 1,713 posts
  • Gender:Male
  • Location:10100
  • Interests:Apicoltura
    Mac
    Linux
    Homebrew
    Australia
    Spremermilcervello
HP DV6 sandybridge :
cannot apply your mods.. because the EC.MBST and other object never exist in the dsdt!

#51
JBraddock

JBraddock

    Ph.D (Can) in Human Rights

  • Members
  • PipPipPipPipPipPipPip
  • 549 posts
  • Location:UK
Hello Gsly,

Thank you for the update. It works great on my HDX 16 (insyde bios F.32). I applied Step 1, Step 2a, Step 2c, Step 2d. I changed ECON to ECOK and LPBC to LPB. I changed UseExtendedBatteryInformationMethod to no. BatteryPollingPeriodOverride is set to 5. Here is the battery information in system profiler. Dim on battery is also working.

[codebox]Battery Information:

Model Information:
Serial Number: ** Removed **
Manufacturer: CPT-U26C
Device Name: EV06055
Pack Lot Code: 306c
PCB Lot Code: 8600
Firmware Version: 80ff
Hardware Revision: ffff
Cell Revision: 0
Charge Information:
Charge Remaining (mAh): 4290
Fully Charged: Yes
Charging: No
Full Charge Capacity (mAh): 4290
Health Information:
Cycle Count: 0
Condition: Normal
Battery Installed: Yes
Amperage (mA): 0
Voltage (mV): 12315

System Power Settings:

AC Power:
System Sleep Timer (Minutes): 20
Disk Sleep Timer (Minutes): 10
Display Sleep Timer (Minutes): 10
Wake on AC Change: No
Wake on LAN: Yes
Current Power Source: Yes
Display Sleep Uses Dim: Yes
PrioritizeNetworkReachabilityOverSleep: 0
RestartAfterKernelPanic: 15
Battery Power:
System Sleep Timer (Minutes): 20
Disk Sleep Timer (Minutes): 10
Display Sleep Timer (Minutes): 2
Wake on AC Change: No
Display Sleep Uses Dim: Yes
Reduce Brightness: Yes
RestartAfterKernelPanic: 15

Hardware Configuration:

UPS Installed: No

AC Charger Information:

Connected: Yes
ID: 0x0000
Wattage (W): 0
Revision: 0x0000
Family: 0x0000
Serial Number: 0x00000000
Charging: No
[/codebox]
I have only one question. There is already a kext in S/L/E called AppleSmartBatteryManager.kext. I am using kernel cache on Lion, so I had to move all my kexts to S/L/E . Is there a way to install this kext without removing the vanilla one? Not that it is a big deal, but since it is a vanilla driver, it might be overridden by future updates.

Thank you again.

#52
NIXin

NIXin

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 114 posts
  • Gender:Male
  • Location:Krakow, Poland
Hey gsly!

I will test it now ;), attaching the updated patcher file (to use, get DSDT Auto Patcher first).

Thanks!

Attached Files



#53
mindlessmissy

mindlessmissy

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 100 posts
  • Gender:Male
The dsdt edits (especially the latest updated ones) have enabled the battery status display on my Asus n81v in Lion, but I am guessing the kexts in this thread are only for HP systems since they only give me a 0% status on all 4 (both debug and release).

However using an AppleACPIBatteryManager.kext I got elsewhere I managed to get the menubar status displaying correct info, BUT my system profiler gave me an "Error reading information" ... (funny thing is ioregistry had every info available on the battery)

Then I used a VoodooBattery.kext also found elsewhere and I got both the menubar status and system profiler working (BUT the profiler gave very limited info ..)

I probably added too many unneeded edits to the dsdt so I will see if I can tweak it to make profiler work with AppleACPIBatteryManager.kext

Thanks for all the info ...

Posted Image

#54
Jingu

Jingu

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 124 posts

You should be able to use the 3.x method. Look at the ACPI 2.x documents on the site referenced in the original post to see if the _BIF and _BST were defined in that revision of the standard. (I'm sure they were but I haven't looked)

SMRD is a method in the EC device. If you don't have an SMBus/SBS, you'll have to determine what registers in your EC are wired directly to the battery controller and modify your _BIF and _BST methods to return the data outlined in the ACPI specification.


Thanks for the tip, but my Device (EC0) doesn't seem to be making much use of the battery control method registers. It's quite small. A lot seems to be missing.

I also realize this thread is more geared towards HP laptop users. I'm on an Asus M60J notebook. However, just for the fun of it, without doing any battery dsdt edits, I tried your kext with UseExtendedBatteryInformationMethod set to false for ACPI 3.x. Interestingly, all the battery information displays including battery voltage and amps. Expectedly, some of the values are off and it can't compute remaining percentages and time, but amazing that I have this much showing without doing any battery dsdt adaptations for Asus.

Posted Image

Attached File  dsdt.aml.zip   22.03KB   19 downloads

#55
gsly

gsly

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 143 posts
  • Gender:Male
  • Location:The Great White North

...
I have only one question. There is already a kext in S/L/E called AppleSmartBatteryManager.kext. I am using kernel cache on Lion, so I had to move all my kexts to S/L/E . Is there a way to install this kext without removing the vanilla one? Not that it is a big deal, but since it is a vanilla driver, it might be overridden by future updates.

Thank you again.

Maybe :(

If you can do without iStat and similar tools that are hard coded to the class name in the IORegistery, just use the legacy named kext that will not collide, otherwise its a similar problem to the good old DLL HELL issue on Windows ;)



I also realize this thread is more geared towards HP laptop users. I'm on an Asus M60J notebook. However, just for the fun of it, without doing any battery dsdt edits, I tried your kext with UseExtendedBatteryInformationMethod set to false for ACPI 3.x. Interestingly, all the battery information displays including battery voltage and amps. Expectedly, some of the values are off and it can't compute remaining percentages and time, but amazing that I have this much showing without doing any battery dsdt adaptations for Asus.

That's the great thing about standards... when everyone codes to the standard from the hardware up though to the OS level, stuff just magically works together :D

My guess is that with a little DSDT work, you can get it all working.

The dsdt edits (especially the latest updated ones) have enabled the battery status display on my Asus n81v in Lion, but I am guessing the kexts in this thread are only for HP systems since they only give me a 0% status on all 4 (both debug and release).

This driver will work with any ACPI 3/4 compliant system that returns the data structures as defined in the specification for _BIF (of _BIX) and _BST. The only HP specific stuff in this thread is the DSDT code that implements the ACPI _BIF, _BIX and _BST methods.

*You* have to figure out what your Asus provides from the battery and get your methods to return this data in your DSDT methods. Once you do, the driver will correctly pass it to the OS.

#56
dgrx

dgrx

    InsanelyMac Protégé

  • Donators
  • 75 posts
  • Gender:Not Telling
Great job gsly :)

Both AppleACPIBatteryManager.kext and AppleSmartBatteryManager.kext are working as expected :)

Thanks for all the work you put into this, it's very much appreciated ;)


@NIXin
Tried your auto-patch and got a lot of compile errors. Doing it the long way with gsly's instructions work great. :D

#57
macq

macq

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 126 posts

Hey gsly!

I will test it now :) , attaching the updated patcher file (to use, get DSDT Auto Patcher first).

Thanks!


Hi,Nixin,
tried your new patch and same as dgrx ,it gives me more than 200 compile errors.

Please look into it.
Thanks for all your work.

@gsly


GREAT JOB MAN.

#58
NIXin

NIXin

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 114 posts
  • Gender:Male
  • Location:Krakow, Poland
Works great gsly, good job! :)
To people that say they have compile errors - it must be that your DSDT is not compatibile with mine. Also, are you patching under Windows or Linux? Because if you patch on Mac, you are actually patching an already patched DSDT (so, no good!).
If you like send me your raw, untouched DSDT file (extracted in Windows or Linux), and I can look into where the patcher is failing for your machines.

Cheers,
NIXin

#59
dgrx

dgrx

    InsanelyMac Protégé

  • Donators
  • 75 posts
  • Gender:Not Telling

Works great gsly, good job! :D
To people that say they have compile errors - it must be that your DSDT is not compatibile with mine. Also, are you patching under Windows or Linux? Because if you patch on Mac, you are actually patching an already patched DSDT (so, no good!).
If you like send me your raw, untouched DSDT file (extracted in Windows or Linux), and I can look into where the patcher is failing for your machines.

Cheers,
NIXin


Hi NIXin,
Tried to compile from Windows (untouched extracted DSDT). Your DV6-i7-bleeding-NIXon patch compiles fine for me. A text compare with the new patch... shows only Gsly's Lion patch to be the diff. As stated by macq " over 200 errors ". Thanks for the offer, but I'll try to work it out myself (That way I learn something :() It may just be a slight difference in BIOS, and I don't want Gsly's thread to get hijacked. Just giving some feedback. :P

Once again Gsly, Great work ;) Thanks :D

#60
NIXin

NIXin

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 114 posts
  • Gender:Male
  • Location:Krakow, Poland
dgrx, It's possible there's a typo in my latest patcher, as I didn't have time to test it properly yet. I'll do that and will let you guys know.





1 user(s) are reading this topic

0 members, 1 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