Solved Thinkpad T430 Battery Status Problem

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 :)
 
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).
 
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
 
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.
 
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
 
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!
 
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?
 
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)).
 
Hi there,

I am handling with exactly the same problem on different devices.

I tried all steps in the origininal post (chaning the script, changing the execution rights), and I even deleted the battery_shutdown.sh

There is no change at all, so maybe the link to the script is broken?

Edit: I tried to deactivate all daemons in rc.conf, but there was also no change.

What I recognized during bootup, there is a call of /sbin/sysctl - n hw.acpi.battery.time which throws the message.
Can I deactivate this module somehow?

Best regards,
Sebastian
 

Attachments

  • plugged in.jpg
    plugged in.jpg
    1.6 MB · Views: 386
  • unplugged.jpg
    unplugged.jpg
    1.6 MB · Views: 364
This is because the /usr/local/share/desktop-installer/Scripts/battery_shutdown.sh script gets copied to /usr/local/sbin/battery_shutdown.sh and it remains even after you remove the desktop-installer package (or port).

I made the same edit recommended above, but to the copy in /usr/local/sbin and this resolved the issue for me.
Code:
elif [ $ac_power = 0 -a $battery_time -le $warning_time ]; then
 
Back
Top