Open agorgl opened 3 years ago
Thanks for showing interest in this project!
The reason for this error is that battery/charge values read with ACPI calls are not the same as Ideapad 15are05's. Please check this function for reference: https://github.com/0xless/battmngr/blob/56be748c2c5aeb14581a040719c522c26a101b0f/battmngr#L308-L331
If the problem is present for read functions only, I think we could support your laptop! If you feel free to hack the script a little bit, you could report the hex values (and corresponding modes) read back by the read_operation
and read_charge_operation
functions. If you want to explore with supporting your laptop yourself, I would suggest you try the experimental_support branch as it uses a json configuration file to load the calls/values relative to a specific laptop.
In the mean time, if you could please provide us with the output of each battmngr command, it would be amazing to evaluate the support state of your laptop.
Do you have the dsdt.dat or the decoded dsdt.dsl of your (working) model in order to compare it with mine? I see for example the SBMC method in mine that accepts argument that either is 0x03 0x05 0x07 0x08 but I need to know how your read op looks like in order to find mine similar one
Sure, you can find the zipped dsdt.dsl file attached. I've only gave a quick look to the code but I couldn't find some of the functions or argument values that works and that are in use in battmngr.
Let me know how it goes!
Hmmm, your dsdt.dsl seems way more straightforward than mine, as in the SBMC method it sets the BTSM and QCHO values that you read back directly. In my case:
Relevant acpi methods:
Method (SBMC, 1, NotSerialized)
{
If ((Arg0 == 0x03))
{
ECCC (0x30, 0xA0, Zero, Zero)
ECCC (0x31, 0xA1, Zero, Zero)
Return (Zero)
}
If ((Arg0 == 0x05))
{
ECCC (0x30, 0xA1, Zero, Zero)
Return (Zero)
}
If ((Arg0 == 0x07))
{
ECCC (0x31, 0xA0, Zero, Zero)
ECCC (0x30, 0xA1, Zero, Zero)
Return (Zero)
}
If ((Arg0 == 0x08))
{
ECCC (0x31, 0xA1, Zero, Zero)
Return (Zero)
}
Return (Zero)
}
and
Method (ECCC, 4, Serialized)
{
Local0 = Acquire (QEVT, 0x07D0)
If ((Local0 == Zero))
{
DAT0 = Arg1
DAT1 = Arg2
DAT2 = Arg3
CMDB = Arg0
Local0 = 0x0100
While ((Local0 && CMDB))
{
Sleep (0x02)
Local0--
}
If ((CMDB == Zero))
{
Local0 = Zero
}
Else
{
Local0 = 0xFF
}
Release (QEVT)
Return (Local0)
}
Release (QEVT)
Return (0xFF)
}
The CMDB seems to be the type of operation (rapid charge / battery conservation) and DAT0 the on/off toggle
The relevant memory region is this:
OperationRegion (SMA2, SystemMemory, 0xFEFF0A00, 0x80)
Field (SMA2, ByteAcc, Lock, Preserve)
{
CMDB, 8,
STAT, 8,
NUMB, 8,
DAT0, 8,
DAT1, 8,
DAT2, 8,
DAT3, 8,
DAT4, 8,
DAT5, 8,
DAT6, 8,
DAT7, 8,
DAT8, 8,
DAT9, 8,
DATA, 8,
DATB, 8,
DATC, 8
}
I'm not really familiar with ACPI/DSDT but I cannot find any read references for CMDB or any reference for SMA2 at all.
You went way more in depth than I did analyzing the code, thanks for the effort. As you pointed out, references to some of the functions used are not present in the file.
In my opinion it would be easier to setup a Windows test environment, install Lenovo Vantage and sniff the ACPI calls sent by the software. I didn't try this yet, but looking around on the internet, this seems to be doable.
@0xless : do you have recommendations on how to sniff ACPI calls (software etc,)?
@xaibex never attempted that, but if you find any interesting software, please let me know!
Laptop model: Lenovo IdeaPad 5 Pro 16ACH6 82L5005RMH Product name: 82L5
Getting 'Unrecognized battery mode, please retry' and 'Unrecognized battery charge mode, please retry' respectively for
-r
and-rc
flags.Tried both
main
andexperimental_support
branches.I'm willing to make relevant PR provided some guidance on what I should look for to add support for my model.