• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved Thinkpad T430 Battery Status Problem

Yosi

New Member


Messages: 5

#1
Greetings,
I've decided to install FreeBSD on my Thinkpad T430

Code:
FreeBSD Thinkpad 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
The problem is as follows;
When i plug in my charger sysctl and acpiconf will report an unknown remaining battery time
Code:
Thinkpad :: ~ acpacconf -i 0                                              1 ↵
Design capacity:   56160 mWh
Last full capacity:   48220 mWh
Technology:       secondary (rechargeable)
Design voltage:       10800 mV
Capacity (warn):   2411 mWh
Capacity (low):       200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:   1 mWh
Model number:       45N1005
Serial number:       52113
Type:           LION
OEM info:       LGC
State:           high
Remaining capacity:   99%
Remaining time:       unknown
Present rate:       0 mW
Present voltage:   12530 mV
Code:
Thinkpad :: ~ » sysctl -a | grep battery
hw.acpi.battery.info_expire: 10
hw.acpi.battery.units: 1
hw.acpi.battery.state: 2
hw.acpi.battery.time: -1
hw.acpi.battery.life: 80
dev.battery.0.%parent: acpi0
dev.battery.0.%pnpinfo: _HID=PNP0C0A _UID=0
dev.battery.0.%location: handle=\_SB_.PCI0.LPC_.EC__.BAT0
dev.battery.0.%driver: battery
dev.battery.0.%desc: ACPI Control Method Battery
dev.battery.%parent:
This is the result:
Code:
Broadcast Message from root@Thinkpad
        (no tty) at 20:39 CET...

Warning: Battery is at -1 minutes.


Broadcast Message from root@Thinkpad
        (no tty) at 20:40 CET...

Warning: Battery is at -1 minutes.
EDIT: Above seems to only spam on console when running tmux
Making tmux un-usable.

When i disconnect my charger the battery time is suddenly fine:
Code:
Thinkpad :: ~ » acpiconf -i 0
Design capacity:   56160 mWh
Last full capacity:   48220 mWh
Technology:       secondary (rechargeable)
Design voltage:       10800 mV
Capacity (warn):   2411 mWh
Capacity (low):       200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:   1 mWh
Model number:       45N1005
Serial number:       52113
Type:           LION
OEM info:       LGC
State:           discharging
Remaining capacity:   99%
Remaining time:       1:51
Present rate:       25739 mW
Present voltage:   12090 mV
Code:
Thinkpad :: ~ » sysctl hw.acpi.battery.time
hw.acpi.battery.time: 176
And the broadcast messages stop.

What i've tried to solve this is to edit /etc/syslog.conf
Code:
*.err;kern.warning;auth.notice;mail.crit       /var/log/console.log
But without success.

I also tried loading acpi_ibm()
but this didn't solve my issue aswell.

Is there a way to ignore these broadcast messages or stop reporting battery time?


Also im new to the forums :)
 

aragats

Aspiring Daemon

Thanks: 288
Messages: 768

#2
The problem is as follows;
When i plug in my charger sysctl and acpiconf will report an unknown remaining battery time
That is normal. How anyone can now the remaining time when there is no discharge current?

Broadcast Message from root@Thinkpad (no tty) at 20:39 CET...
Warning: Battery is at -1 minutes.
I suspect it's reported by a particular daemon. What do you have in your /etc/rc.conf?

(I run FreeBSD on T430 for many years, have never seen such messages).
 

Minbari

Active Member

Thanks: 72
Messages: 167

#3
I have the same specs on my T430:

Code:
sysctl hw.acpi.battery.                                                                                                                   
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 1
hw.acpi.battery.state: 0
hw.acpi.battery.time: -1
hw.acpi.battery.life: 98
 

Yosi

New Member


Messages: 5

#4
That is normal. How anyone can now the remaining time when there is no discharge current?
Thanks for your reply, yes you are right i didn't think about that.
So that makes it a whole different issue.

I suspect it's reported by a particular daemon. What do you have in your /etc/rc.conf?

(I run FreeBSD on T430 for many years, have never seen such messages).
Here is my /etc/rc.conf
Code:
clear_tmp_enable="YES"
syslogd_flags="-ss"
sendmail_enable="NONE"

# Networking
hostname="Thinkpad"
ifconfig_em0="DHCP"
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA DHCP country NL"

# NTPd
ntpd_enable="YES"
ntpdate_flags="-u pool.ntp.org"

powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"


nfs_client_enable="NO"
rpc_statd_enable="NO"
rpc_lockd_enable="NO"

# Devd
devd_enable="YES"
devfs_system_ruleset="system"

# X11
dbus_enable="YES"
hald_enable="YES"
cupsd_enable="YES"
slim_enable="YES"

kld_list="i915kms"
webcamd_enable="YES"
moused_enable="YES"

# Bluetooth
hcsecd_enable="YES"
sdpd_enable="YES"
I have to add that i've been using desktop-installer to install the XFCE desktop.
It pulled a whole bunch of unnecessary packages along with it.

Thank you for your time.
 

mrclksr

Active Member

Thanks: 103
Messages: 121

#5
I have to add that i've been using desktop-installer
The noise comes from the battery_shutdown.sh script, which is part of sysutils/desktop-installer. There is a logical problem in the script as aragats pointed out. Just change the line
Code:
    elif [ $battery_time -le $warning_time ]; then
to
Code:
    elif [ $ac_power = 0 -a $battery_time -le $warning_time ]; then
in /usr/local/share/desktop-installer/Scripts/battery_shutdown.sh
 

Yosi

New Member


Messages: 5

#6
The noise comes from the battery_shutdown.sh script, which is part of sysutils/desktop-installer. There is a logical problem in the script as aragats pointed out. Just change the line
Code:
    elif [ $battery_time -le $warning_time ]; then
to
Code:
    elif [ $ac_power = 0 -a $battery_time -le $warning_time ]; then
in /usr/local/share/desktop-installer/Scripts/battery_shutdown.sh
Thanks this has resolved my issue!
 

Beno Kurniawan

New Member


Messages: 9

#7
Hi, I am new with FreeBSD and installing KDE desktop through dekstop-installer too. I edited the battery_shutdown.sh as mrclksr suggestion, but the messages still bugging the terminal. Should I just delete the whole elif scripts?
 

mrclksr

Active Member

Thanks: 103
Messages: 121

#8
Hi, I am new with FreeBSD and installing KDE desktop through dekstop-installer too. I edited the battery_shutdown.sh as mrclksr suggestion, but the messages still bugging the terminal. Should I just delete the whole elif scripts?
You can change the line
Code:
printf "Warning: Battery is at $battery_time minutes.\n" | wall
to
Code:
printf "Warning: Battery is at $battery_time minutes.\r\n" > /dev/console
This will write the warning messages to the system console. Alternatively, you can change that line to
Code:
who -T | awk -vmin=$battery_time -F" " '{if ($2 == "+") cmd = sprintf("printf \"Warning: Battery is at %%d minutes.\\r\\n\" %d > /dev/%s", min, $3); system(cmd);}'
This will write the warning message to each user's ttys who have not disabled messages (mesg(1)).