I don't need to talk about the advantages of Linux, but there are also many disadvantages. It is really difficult for me to wait for lazy people to use it. For example, my work notebook T61 has been used for three years because the RHEL5.x operating system does not have an integrated battery charging and protection module. When the battery is full, the AC power is still charging and two batteries are broken, although it is not painful for capitalists to pay, it is always uncomfortable. My friend recommended that Ubuntu have a tp_smapi module or something, which can protect the battery like windows. google gave it a hand and found that Fedora is outdated. I don't need to talk about the advantages of upstre Linux, there are also a lot of disadvantages. It is really difficult for me to wait for lazy people to use it. For example, my work notebook T61 has been used for three years because the RHEL5.x operating system does not have an integrated battery charging and protection module. When the battery is full, the AC power is still charging and two batteries are broken, although it is not painful for capitalists to pay, it is always uncomfortable. My friend recommended that Ubuntu have a tp_smapi module or something, which can protect the battery like windows. google gave it a hand and found that Fedora was outdated and did not integrate upstream. Unfortunately, it is only troublesome to do DIY.
According to the guidance of the experts, to engage in this Dongdong need to first use akmods, installed after the akmod-tp_smapi, then modprobe loaded smapi battery management module, and finally set the charging start and end threshold, the details are as follows:
Click here to download the compiled akmod module for Fedora. It does not matter if the version is low.
Unzip the package and install it using the rpm-ivh akmod-tp_smapi-0.40-1.fc11.i686.rpm. Note that this rpm requires support for kernel devel.
Call service akmods restart, and run rpm-qa | grep smapi. You can see that the rpm for F14 related to kernel has been generated and installed.
At this time, you can use modprobe-l | grep smapi to check whether the module is ready, and then modprobe tp_smapi to load the module.
Therefore, you can use the following command to set the charging threshold. BAT indicates the default battery of the notebook (BAT1 seems to be a BIOS battery, no need to care about it)
- # Echo20>/Sys/devices/platform/smapi/BAT0/start_charge_thresh
- # Echo80>/Sys/devices/platform/smapi/BAT0/stop_charge_thresh
# echo 20 > /sys/devices/platform/smapi/BAT0/start_charge_thresh# echo 80 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
Basically, 4 and 5 must be done before you enable this function each time. Therefore, it is better to set up a service, which is started by default for ease of use (/etc/init. d/tp_smapi ):
- #! /Bin/sh
- #
- # Chkconfig:12345 21 80
- ./Etc/init. d/functions
- SMAPILOCK =/var/lock/tp_smapi_lock
- Start ()
- {
- Echo-n $"Starting tp_smapi service :"
- /Sbin/modprobe-q tp_smapi
- Echo20>/Sys/devices/platform/smapi/BAT0/start_charge_thresh
- Echo80>/Sys/devices/platform/smapi/BAT0/stop_charge_thresh
- Echo
- Touch $ SMAPILOCK
- Echo
- }
- Stop ()
- {
- /Sbin/modprobe-r tp_smapi
- Rm-f $ SMAPILOCK
- }
- Status ()
- {
- Status =0
- If[-F $ SMAPILOCK]; then
- Echo"RUNNING"
- Else
- Echo"UNUSED"
- Status =1
- Fi
- Return$ Status
- }
- Case "$1"In
- Start)
- Start
- ;;
- Stop)
- Stop
- ;;
- Restart)
- Stop
- Start
- ;;
- Status)
- Status
- Exit $?
- ;;
- *)
- Echo"Usage: $0 {start | stop | status | restart }"
- Exit1
- ;;
- Esac
#!/bin/sh## chkconfig: 12345 21 80. /etc/init.d/functionsSMAPILOCK=/var/lock/tp_smapi_lockstart(){echo -n $"Starting tp_smapi service: "/sbin/modprobe -q tp_smapiecho 20 > /sys/devices/platform/smapi/BAT0/start_charge_threshecho 80 > /sys/devices/platform/smapi/BAT0/stop_charge_threshechotouch $SMAPILOCKecho}stop(){/sbin/modprobe -r tp_smapirm -f $SMAPILOCK}status(){status=0if [ -f $SMAPILOCK ]; thenecho "RUNNING"elseecho "UNUSED"status=1fireturn $status}case "$1" instart)start;;stop)stop;;restart)stopstart;;status)statusexit $?;;*)echo "Usage: $0 {start|stop|status|restart}"exit 1;;esac
After each F14 kernel upgrade, the related akmod should be re-implemented. Just write a script to solve it.
- #! /Bin/sh
- Echo'Looking for old rpms ...'
- ForRpm in 'sudo rpm-qa | grep smapi'
- Do
- Echo undeploying $ rpm...
- Sudo rpm-e $ rpm
- Done
- Echo'Installing akmod ...'
- Sudo rpm-ivh Co., akmod-tp_smapi-0.40-1. Fc11.i686. rpm
- Sudo/usr/sbin/akmods -- force
- Sudo service akmods restart
- Echo'Mod status :'
- Sudo modprobe-l | grep smapi
- Echo'Set battery thresholds ...'
- Sudo service tp_smapi restart
- Echo'Done .'