Thinkpad L430 - unable to set thresholds #3

Closed
jseplae opened this Issue Feb 23, 2013 · 37 comments

Comments

Projects
None yet
9 participants

jseplae commented Feb 23, 2013

Hello, I'm reposting my issue here (from archlinux forums):
https://bbs.archlinux.org/viewtopic.php?id=158610

perl /usr/lib/perl5/vendor_perl/tpacpi-bat -v stopChargeThreshold 0 80
Call : _SB.PCI0.LPC.EC.HKEY.BCSS 0x50
Response: Error: AE_NOT_FOUND

journalctl:
kernel: acpi_call: Cannot get handle: Error: AE_NOT_FOUND

This is on standard 3.7.9-1 kernel.

Owner

teleshoes commented Feb 23, 2013

{what a weird place for them to put this script.}

dsdt mismatch.

try a different 'aslBase' {modify line 42 of tpacpi-bat}.

perhaps change it like this?

my $aslBase = '\_SB.PCI0.LPC.EC.HKEY';
=>
my $aslBase = '\_SB.PCI0.LPCB.EC0.HKEY';

this should give you the correct aslBase:

sudo acpidump -b -t DSDT -o /tmp/dsdt.aml
iasl -d /tmp/dsdt.aml
cat /tmp/dsdt.dsl | grep \\\\_SB\.PCI.*HKEY -o | uniq
Owner

teleshoes commented Feb 23, 2013

crap, markdown fucked with what i typed. there are slashes in there. fixed.

also, this should be automatic, but i dont have any machine other than a w520 to test with

jseplae commented Feb 23, 2013

This seems to work:
cat dsdt.dsl | grep \\_SB.PCI.*HKEY -o | uniq
_SB.PCI0.LPCB.H_EC.HKEY

sudo perl /usr/lib/perl5/vendor_perl/tpacpi-bat -v stopChargeThreshold 0 80
Call : _SB.PCI0.LPCB.H_EC.HKEY.BCSS 0x50
Response: 0x0

Thanks for the quick response. I commented out the default value in the perl and replaced with the new one, but I
get it that this is probably not a good/permanent solution here. I'm however completely ignorant when it comes to any of this acpi stuff - I doubt I can be of much assistance.

Owner

teleshoes commented Feb 23, 2013

cool.

no problem. yea, i dunno what a good approach would be. i dont think theres any nice way to detect this on the fly.
i could maintain a table of model numbers, but i dont have the data or any way to test it.

p.s.: note that i dont maintain any arch/fedora/debian/etc packages for this, and wont notice if you post anywhere but github. if you happen to come across someone else barking up the wrong tree, please point them here.

teleshoes closed this Feb 23, 2013

malenki commented Mar 23, 2013

The solution above worked for my X121e, too:
my $aslBase = '_SB.PCI0.LPCB.EC.HKEY';

Owner

teleshoes commented Mar 23, 2013

thanks! btw, does anyone know how i could go about detecting lenovo machine type without relying on something that varies much by distribution?

it would be nice if i could get the string 'W520' or 'X121e' and then just select an aslbase for you.

throck commented Mar 24, 2013

If anything, some invocation of dmidecode would probably do it - the Version/Family in the type 1 DMI entry has been fairly reliable for me in the past.

On my t430s, dmidecode --string=system-version returns 'ThinkPad T430s', but you'd probably need to dmidecode -t 1 and scrape the output.

Owner

teleshoes commented Mar 24, 2013

thanks! since this only works on certain explicit models and a limited range of kernels and distros, im going to just use exact match on version.

PLEASE, anyone who has this working, comment here with the output of "sudo dmidecode -t 1" and the value of '$aslBase' you use.

malenki commented Mar 24, 2013

Am Sun, 24 Mar 2013 12:21:58 -0700
schrieb Elliot Wolk notifications@github.com:

PLEASE, anyone who has this working, comment here with the output of
"sudo dmidecode -t 1" and the value of '$aslBase' you use.

dmidecode -t 1

dmidecode 2.11

SMBIOS 2.6 present.

Handle 0x0010, DMI type 1, 27 bytes
System Information
Manufacturer: LENOVO
Product Name: 3045A64
Version: ThinkPad X121e
Serial Number: XXX
UUID: XXX
Wake-up Type: Power Switch
SKU Number: ThinkPad X121e
Family:

uname

3.8-4.towo-siduction-686-pae #1 SMP PREEMPT
(debian sid)

aslBase as above:
my $aslBase = '_SB.PCI0.LPCB.EC.HKEY';

Owner

teleshoes commented Mar 24, 2013

thanks.
i just noticed that this is different than the other two.
are you sure its not: LPCB.EC0.HKEY?
{yours is EC vs EC0}

malenki commented Mar 24, 2013

Am Sun, 24 Mar 2013 12:57:14 -0700
schrieb Elliot Wolk notifications@github.com:

are you sure its not: LPCB.EC0.HKEY?
{yours is EC vs EC0}

Definitely.

Owner

teleshoes commented Mar 24, 2013

awesome, thanks!

Owner

teleshoes commented Mar 24, 2013

so i made it auto-detect a few laptops. it is is nothing like definitive, and far from complete.
it SHOULD work out of the box for everyone who has spoken up. i would greatly appreciate any testing!

this is the table as it stands

  'ThinkPad W520'  => '\_SB.PCI0.LPC.EC.HKEY',
  'ThinkPad X121e' => '\_SB.PCI0.LPCB.EC.HKEY',
  'ThinkPad L430'  => '\_SB.PCI0.LPCB.H_EC.HKEY',
  'ThinkPad E420s' => '\_SB.PCI0.LPCB.EC0.HKEY',
  'ThinkPad S420'  => '\_SB.PCI0.LPCB.EC0.HKEY',

jseplae commented Mar 25, 2013

Chiming in late, but here's my aslBase and dmidecode output.

tpacpi-bat:

my $aslBase = '_SB.PCI0.LPCB.H_EC.HKEY';

dmidecode 2.11

SMBIOS entry point at 0xdac16000

SMBIOS 2.7 present.

Handle 0x000F, DMI type 1, 27 bytes
System Information
Manufacturer: LENOVO
Product Name: 246837G
Version: ThinkPad L430
Wake-up Type: Power Switch
SKU Number: SKU
Family: ThinkPad L430

Owner

teleshoes commented Mar 25, 2013

thanks! {for anyone else, keep em coming}

lowcid commented Nov 10, 2013

Hi,

My lenovo x121e needs other string than the one in the program...

dmidecode 2.12

SMBIOS 2.6 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: LENOVO
Product Name: 30515XG
Version: ThinkPad X121e
Serial Number: XXX
UUID: XXX
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: ThinkPad X121e

commented out this line:

'ThinkPad X121e' => '_SB.PCI0.LPCB.EC.HKEY',

and added this line:
'ThinkPad X121e' => '_SB.PCI0.LPC0.EC.HKEY',

Owner

teleshoes commented Nov 11, 2013

crap. it was probably changed in a firmware upgrade.
i dont know if ill be able to determine it at run time if thats the case.

if you can comment with your BIOS version, and someone else with an x121e can comment with their bios version and the ASL prefix they have to use, we can determine that this is actually the problem {and not a typo}

lowcid commented Nov 11, 2013

biosversion i use now : 8RET52WW (1.15)

just notice its quite old (nov 2011), im going to update it. I'll let you know what happens ;)

lowcid commented Nov 11, 2013

oke, just updated the bios. With the new bios version: 8RET54WW (1.17) tpacpi-bat needs the same asl-prefix as with bios 1.15.

Owner

teleshoes commented Nov 11, 2013

thanks for the info. ill try to find the person who contributed the previous ASL for x121e.

Hi there. After quite some searching I found this bug report. The problem does not seem to be fixed in any general sense. Some things changed since 2013, which makes things harder for users to reproduce. Here is what I had to do for my L520 on Arch Linux.

install acpica (Version used: 20151218)

$ sudo acpidump -b
$ iasl -d dsdt.dat
Intel ACPI Component Architecture
ASL+ Optimizing Compiler version 20151218-64
Copyright (c) 2000 - 2015 Intel Corporation

Input file dsdt.dat, Length 0xD170 (53616) bytes
ACPI: DSDT 0x0000000000000000 00D170 (v02 LENOVO TP-8G    00001230 INTL 20060912)
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed

Found 3 external control methods, reparsing with new information
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed
Disassembly completed
ASL Output:    dsdt.dsl - 438971 bytes

iASL Warning: There were 3 external control methods found during
disassembly, but additional ACPI tables to resolve these externals
were not specified. The resulting disassembler output file may not
compile because the disassembler did not know how many arguments
to assign to these methods. To specify the tables needed to resolve
external control method references, the -e option can be used to
specify the filenames. Note: SSDTs can be dynamically loaded at
runtime and may or may not be available via the host OS.
Example iASL invocations:
    iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml
  }
    iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml
    iasl -e ssdt*.aml -d dsdt.aml

In addition, the -fe option can be used to specify a file containing
control method external declarations with the associated method
argument counts. Each line of the file must be of the form:
    External (<method pathname>, MethodObj, <argument count>)
Invocation:
    iasl -fe refs.txt -d dsdt.aml
$ cat dsdt.dsl | grep \\\\_SB.PCI.*HKEY -o | uniq
\_SB.PCI0.LPCB.EC.HKEY
$ sudo vim /usr/bin/tpacpi-bat

Edit line 401:

  my $aslBase = `cat $psdev`;

to:

  my $aslBase = '\_SB.PCI0.LPCB.EC.HKEY';

Otherwise $aslBase would end up being '_SB.HKEY'.

Oh, and in case this is still being collected, here is my dmidecode output:

$ sudo dmidecode -t 1
[sudo] password for murks: 
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: LENOVO
    Product Name: 78595VG
    Version: ThinkPad L520
    Serial Number: LR5FL4E
    UUID: D4059A81-4AEE-11CB-8D7D-C514CE06B1E2
    Wake-up Type: LAN Remote
    SKU Number: Not Specified
    Family: ThinkPad L520
Owner

teleshoes commented Jan 16, 2016

weird, this should be working automatically these days. thanks for the update!

Well, I thought it worked. The service started if the string was enclosed in " instead of '. Sadly I couldn't set a parameter, with the same error. When using the correct String enclosed in ' it still fails:

Jan 17 00:42:17 eeyore systemd[1]: tpacpi-bat.service: Main process exited, code=exited, status=255/n/a
Jan 17 00:42:17 eeyore systemd[1]: Failed to start sets battery thresholds.
Jan 17 00:42:17 eeyore systemd[1]: tpacpi-bat.service: Unit entered failed state.
Jan 17 00:42:17 eeyore systemd[1]: tpacpi-bat.service: Failed with result 'exit-code'.
Jan 17 00:42:17 eeyore tpacpi-bat[12605]: Error: AE_NOT_FOUND for ASL base: \_SB.PCI0.LPCB.EC.HKEY
Jan 17 00:42:17 eeyore tpacpi-bat[12605]: Error: AE_NOT_FOUND

With the stock code it also fails to start:

Jan 17 00:45:46 eeyore systemd[1]: Starting sets battery thresholds...
Jan 17 00:45:46 eeyore tpacpi-bat[12640]: Error: AE_NOT_FOUND for ASL base: \_SB.HKEY
Jan 17 00:45:46 eeyore tpacpi-bat[12640]: Error: AE_NOT_FOUND
Jan 17 00:45:46 eeyore systemd[1]: tpacpi-bat.service: Main process exited, code=exited, status=255/n/a
Jan 17 00:45:46 eeyore systemd[1]: Failed to start sets battery thresholds.
Jan 17 00:45:46 eeyore systemd[1]: tpacpi-bat.service: Unit entered failed state.
Jan 17 00:45:46 eeyore systemd[1]: tpacpi-bat.service: Failed with result 'exit-code'.

Any ideas as to what could be wrong?

The problem does not seem to be fixed in any general sense.

In fact it was solved in a general way, see line 391ff. But it seems Lenovo cannot stop making more strange exceptions in their UEFI/BIOSes ;-).

Is the newest BIOS installed?

Please show the output of

grep '.*' /sys/class/power_supply/{BAT0,BAT1,AC,ADP0,ADP1}/device/path
cat /sys/class/dmi/id/bios_version
$ grep '.*' /sys/class/power_supply/{BAT0,BAT1,AC,ADP0,ADP1}/device/path
grep: /sys/class/power_supply/BAT0/device/path: No such file or directory
/sys/class/power_supply/BAT1/device/path:\_SB_.BAT1
grep: /sys/class/power_supply/AC/device/path: No such file or directory
grep: /sys/class/power_supply/ADP0/device/path: No such file or directory
grep: /sys/class/power_supply/ADP1/device/path: No such file or directory
$ cat /sys/class/dmi/id/bios_version
8GET46WW (1.23 )

According to the lenovo page, 1.23 is the latest version: http://support.lenovo.com/at/de/downloads/migr-77079

Yes, it's the latest BIOS for your machine.

ASL base auto detection does not work under the above conditions. Sorry, it seems you'll have to live with your workaround.

Just for reference the expected output (X220, same hardware gen):

/sys/class/power_supply/BAT0/device/path:\_SB_.PCI0.LPC_.EC__.BAT0
/sys/class/power_supply/AC/device/path:\_SB_.PCI0.LPC_.EC__.AC__

Sadly my workaround doesn't work.

Can't it be made to work with this instead?

$ ls /sys/devices/platform/smapi/BAT0/
barcoding             design_voltage   inhibit_charge_minutes  remaining_capacity          state
charging_max_current  dump             installed               remaining_charging_time     stop_charge_thresh
charging_max_voltage  first_use_date   last_full_capacity      remaining_percent           temperature
chemistry             force_discharge  manufacture_date        remaining_percent_error     voltage
current_avg           group0_voltage   manufacturer            remaining_running_time
current_now           group1_voltage   model                   remaining_running_time_now
cycle_count           group2_voltage   power_avg               serial
design_capacity       group3_voltage   power_now               start_charge_thresh

You could try all known ASL bases from the pre autodetection era --> https://github.com/teleshoes/tpacpi-bat/blob/ba20013cf5801edc4325f35b4afdf04da992fd60/tpacpi-bat#L42

And watch your perl syntax. Correct syntax is:

my $aslBase = '\_SB.PCI0.   ';

In the end auto detection may be quite right and L520 is incompatible ...

ps. if tp-smapi loads on the L520 then use TLP to set the thresholds.

I have tried them all, without success.

I am unfamiliar with pearl but I corrected the typo above. Your example contains three spaces in the string, are they required?

It fails with:

Jan 17 16:19:41 eeyore systemd[1]: Starting Set battery charge thresholds using tpacpi-bat...
Jan 17 16:19:41 eeyore tp-battery-mode[6498]: Error: no ASL base found
Jan 17 16:19:41 eeyore tp-battery-mode[6498]: Error: no ASL base found

Then you're out of luck finally.

Ok, thanks for your help. I guess I will try to use tp_smapi more directly through /sys/devices/platform/smapi/BAT0/. I guess that should allow to at least set the charge threshholds.

N46AN commented Apr 5, 2016

Somehow 'sudo acpidump -b -n DSDT -o /tmp/dsdt.aml' returns an empty file.

Alternate method for extracting DSDT table:

sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
iasl -d dsdt.aml
cat dsdt.dsl | grep \\\\_SB\.PCI.*HKEY -o | uniq
Owner

teleshoes commented Apr 5, 2016

thanks!

Hi everyone,

I tried running the script on a Lenovo Y50-70 (not a thinkpad yes but it does have the battery limit) and I get the AE_NOT_FOUND error. I stumbled upon this thread and tried the detect command which returns nothing, there is no "*HKEY" entry in my dsdt at all.

Does anyone know how I could find which function would allow me to set the battery threshold? i.e.: how did you find the "HKEY" function was the one to use in the first place?

Owner

teleshoes commented Jun 21, 2016

you hit the nail on the head: the Y50 is not a thinkpad. it therefore almost certainly does not have this thinkpad-only ACPI interface, and so you wont be able to find it through any method.

lenovo might have an interface hiding somewhere in there, but youd have to spend quite a lot of time reverse engineering (on windows) to discover anything useful. doing this without any documentation is extremely unlikely to yield any results, so id suggest begging lenovo for docs (which is also unlikely to yield any results).

good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment