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

#81
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique

Hello I tried to get your stuff into my dsdt.
But I do not know to put the things together.
May I ask you to help me?

Just in case I attached my dsdt.

Thanks in advance



Hi.

Your laptop supports 2 batteries.
Here is your DSDT modified, i have renamed a few devices and methods.
Maybe you can try it and make a report with IORegistryExplorer, then post it here ?
Do you own the second battery (named "Travel" in DSDT) ?

Attached File  dsdt_6510b.dsl.zip   60.47KB   12 downloads

#82
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique

please can someone post the fix dsdt for dv 6 i have a dv 6543 with 10.6.8 and i dont have dsdt and i dont know hot to produce it



You can extract it from system with DSDT Editor, available here; http://www.insanelym...howtopic=223205
Direct link: http://www.insanelym...p...t&id=102945

Start DSDT Editor, then in File menu select Extract.

Do not use somebody's else DSDT, just build your own.

Edit:

According to HP website, your laptop uses same bios as mine (Phoenix F.5A, for Quanta motherboard).
I recommend that you extract your own, some addresses depends on installed memory size.
Once extracted, it is quite simple, just follow instructions in glsy's first post, apply all patches, use AppleSmartBatteryManager.kext in /S/L/E (backup existing one first) and enjoy.
On my lappy i need "UseExtraBatteryInformationMethod" set to true, otherwise no power info in System Profiler.
You can also find a modded bios (no whitelist) on http://forums.mydigitallife.info

#83
oldnapalm

oldnapalm

    InsanelyMac V.I.P.

  • Moderators
  • 6,836 posts
  • Gender:Male
  • Location:Brazil

The parser does fail on the decompiled DV6 DSL, that's why that nasty hack is needed.

Actually not on the decompiled, but after these patches
into device name_adr 0x001C0004 code_regex If\s\(IGDS\)\n\s*\{ remove_matched;
_linenums:0'>into device name_adr 0x001C0004 code_regex \}\n\s*Else\n\s*\{ remove_matched;#into device name_adr 0x001C0004 code_regex PMSX,\s*1\n\s*}\n\s*If\s\(IGDS\)\n\s*\{ replace_matchedbeginPMSX, 1\n}end;# in the second you could have used this with same effect# <strong class='bbc'>into device name_adr 0x001C0004 code_regex If\s\(IGDS\)\n\s*\{ remove_matched;</strong>
They remove
If (IGDS)
				{
				}
				Else
				{
and leave this without pair
}
which is removed by
into method label _RMV parent_type device parent_label J384 code_regex Return\s\(One\)\n\s*\} replace_matched
begin
Return (One)\n
end;
J384 is the last device inside that Else.

Return (PR08)\n here?
end;
_linenums:0'>into method label PR08 parent_type device parent_label J384 code_regex Return\s\(PR08\)\n\s*\} replace_matchedbeginReturn (One)\n // shouldn't be <strong class='bbc'>Return (PR08)\n</strong> here?end;

Sorry for the OT. Should I move this discussion to the DSDT Editor topic?

#84
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male

Hi.

Your laptop supports 2 batteries.
Here is your DSDT modified, i have renamed a few devices and methods.
Maybe you can try it and make a report with IORegistryExplorer, then post it here ?
Do you own the second battery (named "Travel" in DSDT) ?


Yes, I have one.
Using only the internal it looks pretty good.
The icon shows time and percentage
There is an error in collecting Sys information for power supply

If travel bat is connected the icon states not loading

Attached Files



#85
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
Sorry, but I recognized that the 2 kext from 10.6.7 were in place.
With the lion ones I got a X no battery

Attached File  nc6510_bat.ioreg.zip   351.21KB   1 downloads

#86
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique

Yes, I have one.
Using only the internal it looks pretty good.
The icon shows time and percentage
There is an error in collecting Sys information for power supply

If travel bat is connected the icon states not loading


You are the tester glsy was looking for in this post

I'm still looking why System Profiler hangs with AppleSmartBatteryManager.kext as i got same problem.

#87
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male

Sorry, but I recognized that the 2 kext from 10.6.7 were in place.
With the lion ones I got a X no battery

Attached File  nc6510_bat.ioreg.zip   351.21KB   1 downloads


Yragael, did you saw that?

#88
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique

Yragael, did you saw that?


Sorry, i had no access to insanelymac since yersterday.
Do you mean you had AppleACPIPlatform.kext from 10.6.7 ?
The modifications i have made in DSDT are only cosmetic, just renamed a few devices and functions, then i have seen two batteries so i told you about glsy looking for tester with 2 batteries computer.
I have found a thread about dv6x20s with interesting informations, you can find it here.
I'm gonna look if i can help you, but i'm far from being an ACPI guru :-(

Edit:

Can you try this dsdt ? rewrote some parts of UPBS and UPBI to get 8 bits values from EC0.
Also added ARPT and FRWR devices, reorganized code so it is more readable in DSDT Editor.

let me know how it works please.

Attached File  dsdt_6510b.zip   93.34KB   5 downloads

Another thing, can you check with AppleSmartBatteryManager, then with AppleACPIBatteryManager ?

#89
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male

Can you try this dsdt ? rewrote some parts of UPBS and UPBI to get 8 bits values from EC0.
Also added ARPT and FRWR devices, reorganized code so it is more readable in DSDT Editor.

let me know how it works please.

Attached File  dsdt_6510b.zip   93.34KB   5 downloads

Another thing, can you check with AppleSmartBatteryManager, then with AppleACPIBatteryManager ?


Thank you very much.
It looks pretty good now. (Correct kext from Lion loaded)
The behavior is the same. System profiler did not work on both.
What to look for in detail?

#90
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique

Thank you very much.
It looks pretty good now. (Correct kext from Lion loaded)
The behavior is the same. System profiler did not work on both.
What to look for in detail?


As far as i can see, the problem with System Profiler comes from a null pointer, but i do not know nothing about debugging on Mac OS (trying to learn).
Launching /usr/sbin/system_profiler in gdb with parameter SPPowerDataType returns bad access memory at address 0x00000000
As i got same problem, i'll let you know as soon as i have found what is wrong.
Please send me IoregistryExplorer report for each kext.
What about battery icon or iStat/CoconutBattery ?
Do they report correctly ?

Forgot to mention, your DSDT includes a lot of windows specific stuff, that you can safely remove.

#91
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
Please send me IoregistryExplorer report for each next.
All ioreg are taken with travel bat attached
Attached File  nc6510_apple_acpi_bat_mgmt.ioreg.zip   346.59KB   2 downloads
Attached File  nc6510_apple_smart_bat_mgmt.ioreg.zip   349.04KB   4 downloads

What about battery icon or iStat/CoconutBattery ?
iStat craches, CoconutBattery shows nothing with acpi_bat kext and a bit more info with smart_bat kext

Do they report correctly ?
If the travel bat is not attached the time and percentage seems to be correct.

Forgot to mention, your DSDT includes a lot of windows specific stuff, that you can safely remove.
how to identify what could be deleted?

#92
Yragael

Yragael

    InsanelyMac Protégé

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Fort de France, Martinique
Ok, little progress on my side, it seems that Lion's System Profiler requires some data returned by BBIX.
On my laptop, i need "UseExtraBatteryInformationMethod" to return some mandatory data, otherwise system_profiler SPPowerDataType hangs (null pointer to some string).

Using ACPI3 or ACPI4 method works fine, but only when returning extended informations.

As soon as i find the missing parameter, i think we'll be able to fake the system so system_profiler is happy.

Strange thing is that now i've lost Power Adapter informations :-(

About DSDT cleaning, a good start is to remove devices and methods used only by HP specific windows software, you may look for PNPxxxx strings to know about them, but i would recommend to do it only when your laptop is fully operational.

As i already told you, i'm not an ACPI guru :-)

#93
s.sirio

s.sirio

    InsanelyMac Protégé

  • Members
  • PipPip
  • 82 posts
  • Gender:Male
Dear Yragael, I have read all the instruction on the first post but since I have zero knowledge of the DSDT I need to ask someone some clarification before proceeding. My laptop is an old HP pavilion DV6700 series (specifics in the signature). Considering my attached DSDT which are the steps that I need to follow? All the 1 2a, 2b, 2c? why some of them are called optional? Thanks for the clarification

#94
3.14r2

3.14r2

    The Round One

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,333 posts
  • Location:Molvania
Thanks for the driver - works better then the previous (also quite good) version!

Even iStat Pro shows all the information (except cycles shown as 0, but its really not the big deal). System Profiler also shows all the info correctly (cycles also shown as 0).

Tested on HP DV1660se X.6.8. Used ACPI 3.X version.

#95
Jingu

Jingu

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 119 posts
ASUS NOTEBOOK. Working both in Snow Leopard 10.6.8 and Lion 10.7.2

Posted ImagePosted Image

Yes. Got gsly's AppleSmartBatteryManager to work on my Asus M60J.

In the interest of helping other Asus notebook owners with similar dsdts, I'll provide how I made it happen. But, it is not my intent to steal gsly's glory. All this was made possible thanks to him. I'm only adapting his project to my Asus notebook. Also thanks to bcc9 for deriving the formula for taking a 16-bit reference and breaking it down into high-byte and low-byte to do byte (8-bit) references.

Back in post# 47, gsly provided abundant comments for another Asus notebook dsdt, the G53S. My BAT0 dsdt is nearly identical. So, all those comments on that Asus dsdt were really helpful in helping me figuring out what was going on with my own dsdt. Thanks gsly for doing that.

My Asus doesn't seem to use much SMBus access to the battery register sensors. It's making much use of EC access to the battery registers.

The Asus notebook BAT0 dsdt is quite different from the HP BAT0 dsdt. It has several more Method subroutines and it does all kinds of calculations based on what it detects. In the end, it does quite a good job of returning the battery values in accordance with the ACPI 3.x specs. The problem is that it was set to convert the units mAh to mWh and 2 things were happening wrong with that conversion. Design Capacity and Last Full Charge Capacity were kept in mAh and were 1000 times too small while the Current Capacity was converted to mWh. That created remaining percentages of over 115,000% and the inability to calculate remaining time. So, my goal was to prevent the conversion and fix it so it returns mAh units.

If the original Methods FBIF, CBIF and CBST in your Asus dsdt look like below, then the modification should work for you.

CODE

// If the Methods FBIF, CBIF and CBST in your original Asus notebook battery look like below, the
// recommended modifications shoud work for you

Method (FBIF, 5, NotSerialized)
{
Store (Arg0, PUNT)
Store (Arg1, Local1)
Store (Arg2, Local2)
If (LEqual (PUNT, 0x00))
{
Multiply (Local1, 0x0A, Local1)
Multiply (Local2, 0x0A, Local2)
}

Store (Arg0, Index (PBIF, 0x00))
Store (Local1, Index (PBIF, 0x01))
Store (Local2, Index (PBIF, 0x02))
Store (Local2, LFCC)
Store (Arg3, Index (PBIF, 0x03))
Store (Arg4, Index (PBIF, 0x04))
Divide (Local1, 0x0A, Local3, Local5)
Store (Local5, Index (PBIF, 0x05))
Divide (Local1, 0x64, Local3, Local6)
Store (Local6, Index (PBIF, 0x06))
Store (Local6, LOW2)
Divide (Local1, 0x64, Local3, Local7)
Store (Local7, Index (PBIF, 0x07))
Store (Local7, Index (PBIF, 0x08))
}

Method (CBIF, 0, NotSerialized)
{
If (PUNT)
{
Store (DerefOf (Index (PBIF, 0x04)), Local0)
Add (Local0, 0x01F4, Local0)
Divide (Local0, 0x03E8, Local1, DVOT)
Store (Zero, Index (PBIF, 0x00))
Multiply (DerefOf (Index (PBIF, 0x01)), DVOT, Index (PBIF, 0x01
))
Multiply (DerefOf (Index (PBIF, 0x02)), DVOT, Index (PBIF, 0x02
))
Multiply (DerefOf (Index (PBIF, 0x05)), DVOT, Index (PBIF, 0x05
))
Multiply (DerefOf (Index (PBIF, 0x06)), DVOT, Index (PBIF, 0x06
))
Multiply (DerefOf (Index (PBIF, 0x07)), DVOT, Index (PBIF, 0x07
))
Multiply (DerefOf (Index (PBIF, 0x08)), DVOT, Index (PBIF, 0x08
))
}
}

Method (CBST, 0, NotSerialized)
{
If (PUNT)
{
Multiply (DerefOf (Index (PBST, 0x01)), DVOT, Index (PBST, 0x01
))
Multiply (DerefOf (Index (PBST, 0x02)), DVOT, Index (PBST, 0x02
))
}
}


1) IN SNOW LEOPARD

-mWh Units
If you're fine with having the units in mWh, then all you need to do is change Store (Zero, Index (PBIF, 0x00)) to Store (One, Index (PBIF, 0x00)) in the Method CBIF. That's it! iStat will report a battery current about 10 times too high, but the capacity values and remaining times and percentages will all be accurate.

-mAh Units
This is the preferred unit in Mac OS X. It requires a little editing of Methods FBIF, CBIF and CBST. For some reason, when retrieving values in mAh, the capacities will be 1.85% too small. 1.85% doesn't sound like much, but my capacities are in the 4000 mAh range. That was causing them to be about 79 mAh too small compared to the mAh values in Windows 7 with BatteryEater Pro. It was also causing a little percentage anomaly. Percentages would go straight from 100% down to 97% when discharging and straight from 97% to 100% when recharging, never seeing 98% and 99%. That's why I'm applying a 1.85% correction (that's times 185 divided by 10,000)

Here's the Mehod FBIF, CBIF and CBST edits to accurately have to units in mAh. Just replace your Methods FBIF, CBIF and CBST with my corrected ones.

Attached File  Asus_SnowLeo_Corrected.dsl.zip   1.05KB   40 downloads


2) LION 10.7.2

-mAh Units
Okay. I was in for a surprise on this one. My battery EC registers are all 16-bit at Offset (0xA0) from B0VL to B0DV. They're all mirrored by B1VL to B1DV also 16-bit. But those B1xx variables are never executed in the conditional loops, so the battery EC registers that matter are the B0xx. I converted all of those to 8-bit reference based on bcc9's method.

I did this for the all 8 battery B0xx registers and one B0SN register. With all that conversion to 8-bit, gsly's AppleSmartBattery was still working flawless in Snow Leopard, as a testimony that my 8-bit conversion was done correctly. But it wasn't working Lion, all I had was 0, -1 and unknown for the values.

Then I made a puzzling discovery. I discovered that the only reason why the Fill Battery Information Method (Method FBIF) or Method _BIF was failing in Lion, was not because the battery EC registers were accessed in 16-bit, but because the Method that extracts the Battery OEM information string (Method BIF9) has an incompatibility with Lion and that alone was causing the whole Method FBIF or Method _BIF to fail. There's something incompatible with this Method BIF9

CODE
Method (BIF9, 0, NotSerialized)
{
Name (BSTR, Buffer (0x20) {})
Store (SMBR (RDBL, BADR, 0x21), Local0)
If (LNotEqual (DerefOf (Index (Local0, Zero)), Zero))
{
Store (MNAM, BSTR)
Store (Zero, Index (BSTR, 0x04))
}
Else
{
Store (DerefOf (Index (Local0, 0x02)), BSTR)
Store (Zero, Index (BSTR, DerefOf (Index (Local0, One))))
}

Return (BSTR)
}

I don't know how to fix that one.

*** EDIT 26 Nov **: SOLVED!! With the help of gsly rewriting Method SMBR to read Word and Block (string) 8-bit at a time, combined with deleting one line in Method SMBR, SmartBattery fully works now in Lion and can extract the battery name string without crashing.

Below is my dsdt corrected for Lion on my Asus M60J. Attached are also the complete edit instructions that should apply to all Asus core i3/i5/i7 Notebooks.

Attached File  Asus_Coreix_Lion_Edits.zip   3.5KB   181 downloadsAttached File  AsusM60J_Lion.zip   39.26KB   138 downloads

#96
gsly

gsly

    InsanelyMac Geek

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

My Asus doesn't seem to use much SMBus access to the battery register sensors. It's making much use of EC access to the battery registers.

Excellent post Jingu! FWIW, the HP DVx was similar in that some of the EC registers are tried directly to the battery so they would sometimes read the information from there, rather than through the SBS. However, this makes it dependent on how the manufacturer implements the battery at the hardware level and the whole point of the SBS standard/controller, is to eliminate this dependency and make the code consistent regardless of the hardware platform.

Actually, your DSDT is reading the SMBus for some of the battery information (see below)

Then I made a puzzling discovery. I discovered that the only reason why the Fill Battery Information Method (Method FBIF) or Method _BIF was failing in Lion, was not because the battery EC registers were accessed in 16-bit, but because the Method that extracts the Battery OEM information string (Method BIF9) has an incompatibility with Lion and that alone was causing the whole Method FBIF or Method _BIF to fail. There's something incompatible with this Method BIF9

Method (BIF9, 0, NotSerialized)        {            Name (BSTR, Buffer (0x20) {})            Store (SMBR (RDBL, BADR, 0x21), Local0)            If (LNotEqual (DerefOf (Index (Local0, Zero)), Zero))            {                Store (MNAM, BSTR)                Store (Zero, Index (BSTR, 0x04))            }            Else            {                Store (DerefOf (Index (Local0, 0x02)), BSTR)                Store (Zero, Index (BSTR, DerefOf (Index (Local0, One))))            }            Return (BSTR)        }

I don't know how to fix that one.

I commented your DSDT. BIF9 is reading the DeviceName() via the SMBus and the issue is in the SMBR method (SMBus Read). You'll need to re-write that similar to what I did so that it only accesses 8-bits (BCC9's findings).

Oh, and your DSDT seems to define 2 SMBuses in your machine but I didn't look to see what the other one may talk to ;)

Attached File  AsusM60J_gsly.zip   38.75KB   33 downloads

#97
Jingu

Jingu

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 119 posts
Thanks much gsly.

I'll have a look at the comments you made for my Asus dsdt and see if I can come up with the re-write to 8-bit reference for the SMBus Read function.

#98
gsly

gsly

    InsanelyMac Geek

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

Thanks much gsly.

I'll have a look at the comments you made for my Asus dsdt and see if I can come up with the re-write to 8-bit reference for the SMBus Read function.

Jingu, try the attached. I re-wrote SMBR similar to what I did for my HP by changing the Word and Block read code to do it 8-bits at a time. There is an additional Field definition for the 32 bytes of SMBus data and I added the PBFE method in your _SB scope. The latter is the only unknown as on my HP, it strangely uses a 32-bit field defined in what looks like integrated graphics memory to copy the byte data, even though this laptop has no integrated graphics! I found what looks like an "unused" 32-bit field in a similar operational region in your DSDT, but I have no idea if this will work :(

Attached File  AsusM60J_gsly_rewrite.zip   39.68KB   29 downloads

#99
Jingu

Jingu

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 119 posts
Thanks gsly.

That was very nice of you to do the edits on my dsdt.

Unfortunately, it doesn't work.

When I put back Store (^^LPCB.EC0.BIF9 (), Index (PBIF, 0x09)) in Method _BIF, Method _BIF fails and no battery information is returned. There is also an unexpected side effect from your edits. I lose the fan rpm sensor in iStat each time.

That was some really nice edits you came up. Too bad it doesn't work, but that's fine. I just won't be able to see battery information in system profiler under Lion, but everything else about your SmartBattery works perfect where before in Lion all I had was the battery icon, no percentages, no remaining time. Your project brought me so much further.

#100
Bungo

Bungo

    InsanelyMac Sage

  • Coders
  • 296 posts
  • Gender:Male
Hi,
Thanks gsly for your good, hard work.

I've had same problem as Jingu on my Samsung with Lion 10.7.2.

...Unfortunately, battery information doesn't work in system profiler. But battery percentages and remaining times will work perfect...

Adding PBIG and BBIX code (from first post) resolved it - info in System Profiler appeared. Because of not enough my knowlege of EC registers I faked data in PBIG and skipped all procedures in BBIX to check if it works.
PBIG and BBIX seem to be mandatory and UseExtraBatteryInformationMethod=Yes. Using _BIX instead of _BIF is also possible.
We need help from gsly to adopt his idea to non HP machines. We'll be very thankful.





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