Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thinkpad tp_smapi support - wrong status display #31

Open
dglava opened this issue May 10, 2016 · 2 comments
Open

Thinkpad tp_smapi support - wrong status display #31

dglava opened this issue May 10, 2016 · 2 comments

Comments

@dglava
Copy link
Contributor

dglava commented May 10, 2016

I'm experiencing some funky behaviour when using cbatticon with a Thinkpad (T410 in this case). It's mostly related to the battery status display. Occasionally I would notice that the icon and battery status aren't corresponding to their actual state. For example:

$ cbatticon -d
ac path: /sys/class/power_supply/AC
workaround: current rate is not available, estimating rate
battery path: /sys/class/power_supply/BAT0
battery present: 1
battery status: 1 - Unknown
ac online: 1
battery string: Battery is charging (49%)
tooltip: Battery is charging (49%)
icon name: battery-good-charging

It says that the battery is charging, while in fact it isn't. The tooltip and icon don't match. They're saying that the battery is discharging and showing the "battery-good-symbolic" icon, but the debug output says that it's charging and displaying the "battery-good-charging" icon. Both of those are wrong.

This has to do with the tp_smapi feature which sets a percentage at which the battery starts and stops charging. If the battery's charge is between those thresholds and the AC is plugged in, the laptop is powered via AC and the battery is "idle".

Cbatticon seems to query the /sys/class/power_supply/ data. For the case mentioned above, the status is indeed Unknown.

$ cat /sys/class/power_supply/BAT0/status 
Unknown

The tp_smapi module provides more precise data through the /sys/devices/platform/smapi/ filesystem. Querying that shows us the correct battery status: "idle".

cat /sys/devices/platform/smapi/BAT0/state 
idle

Would it be possible to utilize that information when the tp_smapi module is installed for Thinkpad laptops? If not, is there a way to fix this using a different approach?

@valr
Copy link
Owner

valr commented May 10, 2016

Interesting question. It's indeed not a standard behaviour at all.
I'll have a look at the documentation you've provided (thanks for that) and see if the specific path /sys/devices/platform/smapi/ contains standard data, in which case it could be "as simple as" targetting the right path.

I'll let you know when I've done the analysis

@dglava
Copy link
Contributor Author

dglava commented Mar 27, 2017

Hi.
Has there been any progress on this? I'm willing to help if you need any information or output from the Thinkpad tp_smapi filesystem.

Here's the information it exposes:

$ ls /sys/devices/platform/smapi
BAT0		power		driver		modalias	subsystem
BAT1		ac_connected	driver_override	smapi_request	uevent

The most interesting data here is the ac_connected which tells if the AC is plugged in (1) or not (0) and the BATx directories which contain information about the batteries.

$ ls /sys/devices/platform/smapi/BAT0
barcoding	  dump		    last_full_capacit remaining_percent
charging_max_curr first_use_date    manufacture_date  remaining_running
charging_max_volt force_discharge   manufacturer      remaining_running
chemistry	  group0_voltage    model	      serial
current_avg	  group1_voltage    power_avg	      start_charge_thre
current_now	  group2_voltage    power_now	      state
cycle_count	  group3_voltage    remaining_capacit stop_charge_thres
design_capacity	  inhibit_charge_mi remaining_chargin temperature
design_voltage	  installed	    remaining_percent voltage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants