Fedora Linux Support Community & Resources Center
  #1  
Old 22nd August 2012, 02:33 PM
eduardowoj Offline
Registered User
 
Join Date: Aug 2012
Location: Brazil
Posts: 8
linuxopera
Question Cannot install tp_smapi on Thinkpad T420 in F17

Hello guys!

I've got a Thinkpad T420 and Fedora 17 works like a charm in it. This laptop came to replace a Dell Inspiron 1525 which was almost 5 years old.

The Thinkpads have many solutions and modules to protect and extend the computer's life, and I would like to use those features on Fedora too. One critical module is the tp_smapi, which manage the battery charging (to prevent it to be fully charged or depleted, extending its lifespan), the HDD tilt and shock protection and so on. So, here is the deal:

I found many guides to install the tp_smapi modules on F16, F15, F14 and older versions, but couldn't find any on F17. I download the most recent version, but when I try to install, I get this:

Code:
[eduardo@Andromeda ~]$ su -c "yum localinstall tp_smapi-0.40-5.fc17.noarch.rpm --nogpgcheck"
Password: 
Loaded plugins: langpacks, presto, refresh-packagekit
Examining tp_smapi-0.40-5.fc17.noarch.rpm: tp_smapi-0.40-5.fc17.noarch
Marking tp_smapi-0.40-5.fc17.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package tp_smapi.noarch 0:0.40-5.fc17 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                   Arch                    Version                      Repository                                     Size
====================================================================================================================================
Installing:
 tp_smapi                  noarch                  0.40-5.fc17                  /tp_smapi-0.40-5.fc17.noarch                   40 k

Transaction Summary
====================================================================================================================================
Install  1 Package

Total size: 40 k
Installed size: 40 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : tp_smapi-0.40-5.fc17.noarch                                                                                      1/1 
Error unpacking rpm package tp_smapi-0.40-5.fc17.noarch
error: unpacking of archive failed on file /usr/share/doc/tp_smapi-0.40/CHANGES;5034eaaa: cpio: read
  Verifying  : tp_smapi-0.40-5.fc17.noarch                                                                                      1/1 

Failed:
  tp_smapi.noarch 0:0.40-5.fc17                                                                                                     

Complete!
What am I doing wrong? How can I solve this? For a temporary solution, I configured Fedora's battery monitor to warn me when the battery reaches 20%, so I plug in the AC adapter and charge it until it reaches about 90%.

Last edited by eduardowoj; 22nd August 2012 at 03:22 PM. Reason: Realized something I missed on the installation, but I'm still without success.
Reply With Quote
  #2  
Old 23rd August 2012, 09:08 AM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,910
linuxfirefox
Re: Cannot install tp_smapi on Thinkpad T420 in F17

Where did you get the rpm from ? This file,
http://endur.fedorapeople.org/downlo...c17.noarch.rpm
seems to only include a few DOC files and no driver.

Quote:
[stevea@crucibulum Downloads]$ rpm -qlp ./tp_smapi-0.40-5.fc17.noarch.rpm
warning: ./tp_smapi-0.40-5.fc17.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID e8d479fc: NOKEY
/usr/share/doc/tp_smapi-0.40
/usr/share/doc/tp_smapi-0.40/CHANGES
/usr/share/doc/tp_smapi-0.40/README
/usr/share/doc/tp_smapi-0.40/TODO

Since no one seems to be maintaining this driver for Fedora the best approach is to pull the source and and build the driver yourself. It needs to be rebuilt for every new kernel.


Directions:

Install the build tools & kernel devel packages,
sudo yum group install "Development Tools"
sudo yum install kernel-devel kernel-headers


Go here and get, tp_smapi-0.40.tgz
http://sourceforge.net/projects/tpctl/files/tp_smapi/

Pick some good directory (any) and untar the tarball
tar -xvf tp_smapi-0.40.tgz

That driver is out of date and needs to be updated for 3.x kernels so get the .diff file I've attached and apply this using patch utility. (correct the patchfile directory to your case).
cd ./tp_smapi-0.40
patch -p 2 < ~/Downloads/tp_smapi-0.40-update.diff


=========
At this point you should have a good source directory for building the driver. SAVE this directory since you need to build & install it for each kernel update.

To build and install the driver into the driver module tree you need to ...

cd ~/somewhere/tp_smapi-0.40
make
sudo make install


To load the driver into the current kernel
sudo modprobe tp_smapi

You can cause the driver to load on boot by creating a file using this cut-n-paste script...
sudo bash
cat <<EOF >>/etc/sysconfig/modules/tp_smapi.modules
#!/bin/bash
modprobe tp_smapi >/dev/null 2>&1
EOF
chmod 0755 /etc/sysconfig/modules/tp_smapi.modules
exit



There are some additional notes on make options for the driver here, for example to use the internal accelerometer..
http://www.thinkwiki.org/wiki/Tp_smapi
=============

As an aside your battery life will be a LOT better if you keep the charge level down under 50% most of the time and only charge up to ~90-95 percent when you are going 'unplugged'. See the think.bat script attached.

Ive attached a think.bat (as think.bat.sh to make the attachment engine happy) ... script you might want,

Quote:
[stevea@crucibulum ~]$ think.bat help
Battery: Thresholds Stop:Start = 70%:80%, remaining=80%, idle
Usage: think.bat [home | travel | rate | LOWLIM HIGHLIM]
[stevea@crucibulum ~]$ think.bat
Battery: Thresholds Stop:Start = 70%:80%, remaining=80%, idle
[stevea@crucibulum ~]$ sudo think.bat home
Battery: Thresholds Stop:Start = 70%:80%, remaining=80%, idle
Battery: Thresholds Stop:Start = 30%:40%, remaining=80%, idle
[stevea@crucibulum ~]$ sudo think.bat travel
Battery: Thresholds Stop:Start = 30%:40%, remaining=80%, idle
Battery: Thresholds Stop:Start = 90%:95%, remaining=80%, idle
[stevea@crucibulum ~]$ sudo think.bat 25 75
Battery: Thresholds Stop:Start = 90%:95%, remaining=79%, discharging
Battery: Thresholds Stop:Start = 25%:75%, remaining=79%, discharging
[stevea@crucibulum ~]$ think.bat rate
Battery: Thresholds Stop:Start = 25%:75%, remaining=79%, discharging
-13747
-14053
-14053
-13832
-13832
W/o arguments it prints the battery stop:start levels currently set.
'home' 'travel' and numeric pairs like "25 75" set the start:stop levels and prints the same before and after setting.
'rate' causes the script to print the charge (positive) or discharge (negative) rate in milliwatts once a second.
Attached Files
File Type: diff tp_smapi-0.40-update.diff (3.5 KB, 130 views)
File Type: sh think.bat.sh (1.1 KB, 100 views)
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 24th August 2012 at 04:54 AM.
Reply With Quote
  #3  
Old 23rd August 2012, 02:49 PM
eduardowoj Offline
Registered User
 
Join Date: Aug 2012
Location: Brazil
Posts: 8
linuxopera
Re: Cannot install tp_smapi on Thinkpad T420 in F17

Hello, thanks for the tips. To keep the drivers even in the worst case, I synchronized the folder with my dropbox. Now nothing will make me lose it!

I sucessfully patched the files:

Code:
[eduardo@Andromeda tp_smapi-0.40]$ patch -p 2 < ~/tp_smapi-0.40/tp_smapi-0.40-update.diff 
patching file hdaps.c
patching file include/linux/thinkpad_ec.h
patching file Makefile
patching file thinkpad_ec.c
patching file thinkpad_ec.h
patching file tp_smapi.c

But when I tried to make, no sucess:

Code:
[eduardo@Andromeda tp_smapi-0.40]$ make
Makefile:31: /lib/modules/3.5.2-1.fc17.i686.PAE/build/include/linux/aio_abi.h 
Makefile:32: Building tp_smapi requires Linux kernel 2.6.19 or newer, and matching kernel headers.
Makefile:33: You may need to override the following Make variables:
Makefile:34: .   KVER=3.5.2-1.fc17.i686.PAE
Makefile:35: .   KBUILD=/lib/modules/3.5.2-1.fc17.i686.PAE/build
Makefile:36: .   MOD_DIR=/lib/modules/3.5.2-1.fc17.i686.PAE/kernel
Makefile:37: For "make patch", you may also need the full kernel sources, and may need to override:
Makefile:38: .   KSRC=/lib/modules/3.5.2-1.fc17.i686.PAE/source
Makefile:39: *** Missing kernel headers.  Stop.
My uname -r tells me: 3.5.2-1.fc17.i686.PAE

How can I solve this?

Also, it may sound like a newbie question (which is quite true...), but to run this battery script I should configure Fedora's energy settings to load this script?
Reply With Quote
  #4  
Old 24th August 2012, 04:52 AM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,910
linuxfirefox
Re: Cannot install tp_smapi on Thinkpad T420 in F17

Apologies, my fault.
To build a driver you need the kernel-devel and likely the kernel-headers package too. So do this.

sudo yum install kernel-devel kernel-headers

Then start over with the make' 'sudo make install' .

I've modified post #2 to reflect this correction.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 24th August 2012 at 04:55 AM.
Reply With Quote
  #5  
Old 24th August 2012, 02:43 PM
eduardowoj Offline
Registered User
 
Join Date: Aug 2012
Location: Brazil
Posts: 8
linuxopera
Re: Cannot install tp_smapi on Thinkpad T420 in F17

I had both packages installed, so I removed and reinstalled them. But I can't make it yet:

Code:
[eduardo@Andromeda tp_smapi-0.40]$ make
Makefile:31: /lib/modules/3.5.2-3.fc17.i686.PAE/build/include/linux/aio_abi.h 
Makefile:32: Building tp_smapi requires Linux kernel 2.6.19 or newer, and matching kernel headers.
Makefile:33: You may need to override the following Make variables:
Makefile:34: .   KVER=3.5.2-3.fc17.i686.PAE
Makefile:35: .   KBUILD=/lib/modules/3.5.2-3.fc17.i686.PAE/build
Makefile:36: .   MOD_DIR=/lib/modules/3.5.2-3.fc17.i686.PAE/kernel
Makefile:37: For "make patch", you may also need the full kernel sources, and may need to override:
Makefile:38: .   KSRC=/lib/modules/3.5.2-3.fc17.i686.PAE/source
Makefile:39: *** Missing kernel headers.  Stop.
I think the key is where the makefile tells me Building tp_smapi requires Linux kernel 2.6.19 or newer, and matching kernel headers., but my packages do match:

Code:
Installed:
  kernel-headers.i686 0:3.5.2-3.fc17  

Installed:
  kernel-devel.i686 0:3.5.2-3.fc17
The other warning lines from makefile makes me wonder if I need to change some lines in the code of the driver...
Reply With Quote
  #6  
Old 27th August 2012, 03:49 PM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,910
linuxfirefox
Re: Cannot install tp_smapi on Thinkpad T420 in F17

Yes, you are correct. This is caused by the PAE kernel. I *think* you just need to install
sudo yum install kernel-PAE-devel

Then run the makefile ...
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #7  
Old 27th August 2012, 04:45 PM
eduardowoj Offline
Registered User
 
Join Date: Aug 2012
Location: Brazil
Posts: 8
linuxopera
Re: Cannot install tp_smapi on Thinkpad T420 in F17

After installing that package, the makefile seems to have worked, but when I tried to load the module:

Code:
[eduardo@Andromeda tp_smapi-0.40]$ make
make -C /lib/modules/3.5.2-3.fc17.i686.PAE/build M=/home/eduardo/Documents/tp_smapi-0.40 O=/lib/modules/3.5.2-3.fc17.i686.PAE/build modules
make[1]: Entering directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'
  CC [M]  /home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.o
/home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.c: In function ‘__check_force_io’:
/home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.c:96:86: warning: return from incompatible pointer type [enabled by default]
/home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.c: In function ‘check_dmi_for_ec’:
/home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.c:464:1: warning: the frame size of 1328 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  CC [M]  /home/eduardo/Documents/tp_smapi-0.40/tp_smapi.o
  Building modules, stage 2.
  MODPOST 2 modules
  CC      /home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.mod.o
  LD [M]  /home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.ko
  CC      /home/eduardo/Documents/tp_smapi-0.40/tp_smapi.mod.o
  LD [M]  /home/eduardo/Documents/tp_smapi-0.40/tp_smapi.ko
make[1]: Leaving directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'

[eduardo@Andromeda tp_smapi-0.40]$ sudo make install
make -C /lib/modules/3.5.2-3.fc17.i686.PAE/build M=/home/eduardo/Documents/tp_smapi-0.40 O=/lib/modules/3.5.2-3.fc17.i686.PAE/build modules
make[1]: Entering directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'
  Building modules, stage 2.
  MODPOST 2 modules
make[1]: Leaving directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'
rm -f /lib/modules/3.5.2-3.fc17.i686.PAE/kernel/drivers/misc/{thinkpad_ec,tp_smapi,tp_base}.ko
rm -f /lib/modules/3.5.2-3.fc17.i686.PAE/kernel/drivers/firmware/{thinkpad_ec,tp_smapi,tp_base}.ko
rm -f /lib/modules/3.5.2-3.fc17.i686.PAE/kernel/extra/{thinkpad_ec,tp_smapi,tp_base}.ko
make INSTALL_MOD_STRIP=1 -C /lib/modules/3.5.2-3.fc17.i686.PAE/build M=/home/eduardo/Documents/tp_smapi-0.40 O=/lib/modules/3.5.2-3.fc17.i686.PAE/build modules_install
make[1]: Entering directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'
  INSTALL /home/eduardo/Documents/tp_smapi-0.40/thinkpad_ec.ko
  INSTALL /home/eduardo/Documents/tp_smapi-0.40/tp_smapi.ko
  DEPMOD  3.5.2-3.fc17.i686.PAE
make[1]: Leaving directory `/usr/src/kernels/3.5.2-3.fc17.i686.PAE'
depmod -a

[eduardo@Andromeda tp_smapi-0.40]$ sudo modprobe tp_smapi 
ERROR: could not insert 'tp_smapi': No such device
I looked into lsmod and there isn't a tp_smapi module loaded. But when I typed modprobe tp_ and hit TAB, it was autocompleted by tp_smapi. I think the module was indeed installed, but the modprobe could not find it.

I'm feeling that I'm almost there!
Reply With Quote
  #8  
Old 31st August 2012, 02:39 PM
eduardowoj Offline
Registered User
 
Join Date: Aug 2012
Location: Brazil
Posts: 8
linuxopera
Cool Re: Cannot install tp_smapi on Thinkpad T420 in F17

I've got it!!!

I downloaded and installed the version 0.41, available on the github:

Code:
https://github.com/evgeni/tp_smapi
I only needed to follow the README instructions and it installed flawlessly, but it is mandatory to install the kernel-devel, kernel-headers and kernel-PAE-devel packages.

Code:
su -c "yum install kernel-devel kernel-headers kernel-PAE-devel
Thanks for all the support!

Last edited by eduardowoj; 11th September 2012 at 05:45 PM. Reason: I thought it was quite ambiguous, so I edited the bold section to make it very clear.
Reply With Quote
Reply

Tags
f17, install, t420, thinkpad, tpsmapi, tp_smapi

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Problems: Fedora on Thinkpad T420 stinky-tofu Hardware & Laptops 5 19th April 2012 01:22 PM
Fedora 16 on Thinkpad T420 bastani Hardware & Laptops 8 29th January 2012 11:17 AM
Problem with Thinkpad T420 and FC15 antonism Hardware & Laptops 0 10th October 2011 06:39 AM
Fedora15 on Thinkpad T420 winice Hardware & Laptops 1 31st August 2011 03:42 AM
Fedora 15 on Thinkpad T410 or T420 ciaraldi Hardware & Laptops 3 14th July 2011 02:21 AM


Current GMT-time: 04:48 (Wednesday, 22-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Bargi Travel Photos - Princeton Instagram Photos - Chacarita Photos on Instagram