https://www.thinkwiki.org/w/api.php?action=feedcontributions&user=Pelzi&feedformat=atomThinkWiki - User contributions [en]2024-03-19T07:24:48ZUser contributionsMediaWiki 1.31.12https://www.thinkwiki.org/w/index.php?title=How_to_configure_the_TrackPoint&diff=38625How to configure the TrackPoint2008-08-17T08:04:49Z<p>Pelzi: Notes about coexistence with the synaptics touchpad.</p>
<hr />
<div>{| width="100%"<br />
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__<br />
|style="vertical-align:top" |The [[Patch to enable advanced trackpoint configuration|kernel trackpoint driver]] is controlled by echoing values to special files. Common configuration options are outlined below.<br />
{{NOTE|<br />
*With kernels 2.6.19 and above config files for this driver are located in <tt>/sys/devices/platform/i8042/serio1</tt>.<br />
*With kernels 2.6.13 (inclusive) to 2.6.19 (exclusive) config files for this driver are located in <tt>/sys/devices/platform/i8042/serio0/serio2</tt>.<br />
*With kernels 2.6.11 (inclusive) to 2.6.13 (exclusive) config files for this driver are located in <tt>/sys/devices/platform/i8042/serio0</tt>.<br />
*With kernels 2.6.9 (inclusive) to 2.6.11 (exclusive) config files for this driver are located in <tt>/proc/trackpoint</tt>.<br />
*Prior to kernel 2.6.9, configuration was not done through files but through command-line options to the psmouse module. (Note this means you must compile psmouse as a module!) See http://stephen.evanchik.com/node/16.<br />
}}<br />
|}<br />
<br />
==General Configuration==<br />
The configuration options are reflected by the files you can find in {{path|/sys/devices/platform/i8042/serio0/serio2}}. See the [[Patch to enable advanced trackpoint configuration|TrackPoint driver page]] for a complete list.<br />
Configuration is done by echoing the appropriate values into these special files.<br />
<br />
If you want to set the sysfs parameters at boot, you can use the [http://linux-diag.sourceforge.net/Sysfsutils.html sysfsutils] and put the preferred value in /etc/sysfs.conf.<br />
<br />
==Most common Features==<br />
The most common settings are '''Press to Select''', '''sensitivity''', '''speed''' and '''scrolling'''.<br />
<br />
===Press to Select===<br />
Press to Select allows you to tap the control stick which will simulate a left click. You can enable this feature by typing the following in to a terminal (you may need to be root):<br />
<br />
:{{cmdroot|echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/press_to_select}}<br />
<br />
Press to Select should now be enabled. You can disable it in a similar manner:<br />
<br />
:{{cmdroot|echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/press_to_select}}<br />
<br />
You can use this script to automate the operation<br />
<br />
#!/bin/bash<br />
if [ "$1" = "1" ]; then<br />
echo "Turning on tap on TrackPoint"<br />
echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/press_to_select<br />
exit 0<br />
fi<br />
if [ "$1" = "0" ]; then<br />
echo "Turning off tap on TrackPoint"<br />
echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/press_to_select<br />
exit 0<br />
fi<br />
echo -n "Tap status: "<br />
cat /sys/devices/platform/i8042/serio0/serio2/press_to_select<br />
<br />
===Sensitivity & Speed===<br />
Adjusting the speed and sensitivity of the TrackPoint requires echoing a value between 0 and 255 into the appropriate file. For example, for a speed of 120 and a sensitivity of 250, type the following into a terminal:<br />
<br />
:{{cmdroot|echo -n 120 > /sys/devices/platform/i8042/serio0/serio2/speed}}<br />
:{{cmdroot|echo -n 250 > /sys/devices/platform/i8042/serio0/serio2/sensitivity}}<br />
<br />
Feel free to experiment with your settings until you find a combination that is comfortable.<br />
<br />
When you satisfy your setting , add the two lines into /etc/rc.d/rc.local in order to avoid restoring the default setting every time the system reboots.<br />
<br />
===Scrolling===<br />
====Using a kernel prior to 2.6.11====<br />
The scrolling action is essentially the same as is used in the TrackPoint Windows drivers. To enable this feature, type the following in to a terminal (you may need to be root): <br />
<br />
:{{cmdroot|echo -n 1 > /proc/trackpoint/scroll}}<br />
<br />
Then press the middle button and push the stick up and down to scroll. Similarly, to disable scrolling:<br />
<br />
:{{cmdroot|echo -n 0 > /proc/trackpoint/scroll}}<br />
<br />
====Using the X server (kernel 2.6.11+)====<br />
The scroll setting has been removed from the trackpoint driver in kernel versions 2.6.11 and above. Scroll emulation should now be handled in the X server.<br />
<br />
A nice side effect of that is, that middle button scrolling applies to any mouse and not just the TrackPoint interface, which can be a quite handy feature for desktop computers or people who prefer to use an external mouse, especially when scrolling through long lists or needing to use horizontal scrolling with a mouse which has only a vertical scroll wheel.<br />
<br />
The necessary functionality, known as "EmulateWheelTimeout" allowing to use button 2 for a middle click, wasn't implemented in Xorg prior to 6.9/7.0. However, there was a patch included in most distributions packages of Xorg, which was announced [http://www.mail-archive.com/devel@xfree86.org/msg03333.html here]. You can find an updated version of the package in the experimental branch of {{Debian}} or try to build the mouse driver yourself with the information in the announcement. This has successfully been tried with FC3's 6.8.2 packages.<br />
<br />
Once this functionality is in the X.org, add these lines to your TrackPoint configuration section in {{path|/etc/X11/xorg.conf}}:<br />
<br />
Option "EmulateWheel" "on"<br />
Option "EmulateWheelButton" "2"<br />
<br />
It may also be necessary to add these lines:<br />
<br />
Option "YAxisMapping" "4 5"<br />
Option "XAxisMapping" "6 7"<br />
<br />
which specify which buttons are mapped to motion in the vertical (Y) and horizontal (X) directions, respectively, in wheel emulation mode (see http://www.xfree86.org/current/mouse.4.html).<br />
<br />
{{HINT| Use the program "xev" to see, what mouse button identifiers are sent by your mouse/touchpad/trackpoint.}}<br />
<br />
<br />
So, a complete mouse section, that implements this nicely and works very well on my R51, even with a simultaneously connected USB mouse, looks like that (tried out today, 20th of September, 2006 on Dapper):<br />
<br />
Section "InputDevice"<br />
Identifier "Configured Mouse"<br />
Driver "mouse"<br />
Option "CorePointer"<br />
Option "Device" "/dev/input/mice"<br />
Option "Protocol" "ExplorerPS/2"<br />
Option "Emulate3Buttons" "on"<br />
Option "Emulate3TimeOut" "50"<br />
Option "EmulateWheel" "on"<br />
Option "EmulateWheelTimeOut" "200"<br />
Option "EmulateWheelButton" "2"<br />
Option "YAxisMapping" "4 5"<br />
Option "XAxisMapping" "6 7"<br />
Option "ZAxisMapping" "4 5"<br />
EndSection<br />
<br />
The mappings for Y and Z are the same, since the "Z-Axis" refers to actual hardware scrolling wheels which usually scroll the screen along the Y-Axis. If there is no hardware scrolling wheel present, horizontal and vertical scrolling using the TrackPoint work fine without the Z-Axis line.<br />
<br />
Now restart X and hold down button 2 and move the mouse to scroll, or just press and release button 2 for a middle click.<br />
<br />
To make this work with the synaptics driver for the touchpad, you can add<br />
Option "GuestMouseOff" "1"<br />
to the synaptics device section. This will make the synaptics driver ignore the Trackpoint, so it will be handled by the mouse driver. This allowed me to disable the touchpad while making the TrackPoint work like it should.<br />
<br />
{{NOTE| With the above mouse section in my xorg.conf all this works like a charm: <br />
*I can press the wheel on my external USB mouse and move the mouse up and down for scrolling<br />
*or I can just use the wheel on the external mouse for scrolling<br />
*or pressing the MMB button of the trackpoint and use the trackpoint for scrolling.<br />
*Even horizontal scrolling works automagically in Konqueror, for Firefox/Opera see below.<br />
<br />
Simultaneously I can use <br />
*a press on the external mouse's wheel <br />
*or the MMB of the trackpoint<br />
<br />
for pasting the buffer. Lovely! :) }}<br />
<br />
{{HINT| If you don't use the middle-mouse-button for pasting and sometimes pasting things by mistake while scrolling (witch is really odd) simply set the "EmulateWheelTimeOut" to "1" as a (bloody) workaround. Middle click will only possible with pressing left and right button simultaneously!}}<br />
<br />
<br />
===== EmulateWheelTimeout temporarily broken (-> fix for Ubuntu Dapper) ===== <br />
<br />
Unfortunately, there was a regression so that EmulateWheelTimeout was broken in X.org 6.9.0, and fixed<br />
on March 20th, 2006. <br />
You can see the [https://bugs.freedesktop.org/show_bug.cgi?id=5071 primary bug report] here, and also reports on the [http://qa.mandriva.com/show_bug.cgi?id=21196 Mandriva] and [http://lists.debian.org/debian-x/2006/01/msg00249.html Debian] ([http://bugs.debian.org/346098 #346098], [http://bugs.debian.org/320136 #320136]) packages.<br />
<br />
Unfortunately, this bug is still present in Ubuntu Dapper Drake's xserver-xorg-input-mouse package (version 1.0.3.1+cvs.20060109-0ubuntu1)!<br />
<br />
{{HINT|xserver-xorg-input-mouse (version 1.0.3.1+cvs.20060109-0ubuntu1.1) is in dapper-updates since July 3rd, 2006. You don't need to patch it anymore.}}<br />
<br />
Use the following procedure to make it (middle button scrolling & middle button pasting) work:<br />
<br />
:{{cmduser|cd /desired/path && mkdir tmp && cd tmp}} (create temporary directory somewhere)<br />
:{{cmduser|sudo nano /etc/apt/sources.list}} (insert/uncomment the deb-src lines, save and exit)<br />
:{{cmduser|sudo apt-get update}}<br />
:{{cmduser|apt-get source xserver-xorg-input-mice}} (in order to get the source code)<br />
:{{cmduser|sudo aptitude install xserver-xorg-dev}} (this package and the packages it depends on are needed in order to compile the source code, use aptitude for easy removal later on)<br />
:{{cmduser|cd xserver-xorg-input-mouse-1.0.3.1+cvs.20060109/}}<br />
:{{cmduser|wget http://librarian.launchpad.net/2639933/xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2.debdiff}} (downloads the patch that fixes the bug)<br />
:{{cmduser|patch -p1 < xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2.debdiff}} (applies the bug fix)<br />
:{{cmduser|fakeroot dpkg-buildpackage}} (rebuilds the package... watch out for errors and install other missing packages)<br />
:{{cmduser|sudo dpkg -i ../xserver-xorg-input-mouse_1.0.3.1+cvs.20060109-0ubuntu2_i386.deb}} (installs the rebuilt built package)<br />
:{{cmduser|sudo aptitude remove xserver-xorg-dev}} (removes the packages needed to rebuild the package)<br />
<br />
Hope it works for you, it did work for me!<br />
CrypTom<br />
<br />
===== Older versions of X.org =====<br />
<br />
For older versions of Xorg or for Xfree86 ({{path|/etc/X11/XF86Config}}) try this:<br />
<br />
Option "Emulate3Buttons" "true"<br />
Option "EmulateWheel" "true"<br />
Option "EmulateWheelButton" "2"<br />
<br />
Now restart X and hold down button two and move the mouse for scrolling. To get a middle click, press buttons 1 and 3 simultaneously.<br />
<br />
==Soft Transparent Mode==<br />
If you wish to connect a special device to the external PS/2 port, you should consider using "Soft Transparent Mode" so that the TrackPoint controller does not interpret any commands sent to the external PS/2 port. You can enable soft transparent mode by typing the following in to a terminal:<br />
<br />
:{{cmdroot|echo -n 1 > /sys/devices/platform/i8042/serio0/serio2/transparent}}<br />
<br />
Disabling soft transparent mode is similar:<br />
<br />
:{{cmdroot|echo -n 0 > /sys/devices/platform/i8042/serio0/serio2/transparent}}<br />
<br />
==Modify trackpoint parameter permanently in trackpoint.h==<br />
If you do not want to run a script to reconfigure the trackpoint<br />
you can change the default settings in the trackpoint header file that is located in<br />
/usr/src/<KERNEL_VERSION>/drivers/input/mouse/trackpoint.h.<br />
<br />
First you must convert the values (decimal numbers) you normaly echo to /sys/[...] to hex:<br />
<br />
'''echo -e 'obase=16;<DECIMAL_NUMBER>' | bc'''<br />
<br />
Then simply replace the default hex values in trackpoint.h, run 'make && make modules_install' to recompile and install psmouse.ko (should be compiled as module)<br />
<br />
<br />
Example patch (speed=100, sensitivity=190, press_to_select=1):<br />
<pre><br />
--- trackpoint.h.orig 2006-01-17 16:18:30.000000000 +0100<br />
+++ trackpoint.h 2006-01-17 16:25:47.000000000 +0100<br />
@@ -108,9 +108,9 @@<br />
/*<br />
* Default power on values<br />
*/<br />
-#define TP_DEF_SENS 0x80<br />
+#define TP_DEF_SENS 0xBE<br />
#define TP_DEF_INERTIA 0x06<br />
-#define TP_DEF_SPEED 0x61<br />
+#define TP_DEF_SPEED 0x64<br />
#define TP_DEF_REACH 0x0A<br />
<br />
#define TP_DEF_DRAGHYS 0xFF<br />
@@ -123,7 +123,7 @@<br />
<br />
/* Toggles */<br />
#define TP_DEF_MB 0x00<br />
-#define TP_DEF_PTSON 0x00<br />
+#define TP_DEF_PTSON 0x01<br />
#define TP_DEF_SKIPBACK 0x00<br />
#define TP_DEF_EXT_DEV 0x01<br />
</pre><br />
<br />
==Configure firefox for using trackpoint horizontal scrolling==<br />
Vertical Scrolling seems to work out of the box in firefox if you followed the steps above.<br />
Anyway, there is a problem when you don't scroll exactly vertical, because horizontal scrolling turns into<br />
browser BACK/FORWARD commands. <br />
You can avoid this by typing about:config + ENTER in the address bar of firefox.<br />
You have to adjust the following options:<br />
<br />
<pre><br />
mousewheel.horizscroll.withcontrolkey.action = 3;<br />
mousewheel.horizscroll.withcontrolkey.numlines = 1; <br />
mousewheel.horizscroll.withcontrolkey.sysnumlines = true;<br />
<br />
mousewheel.horizscroll.withnokey.action = 0;<br />
mousewheel.horizscroll.withnokey.numlines = 1;<br />
mousewheel.horizscroll.withnokey.sysnumlines = true;<br />
<br />
mousewheel.horizscroll.withshiftkey.action = 1;<br />
mousewheel.horizscroll.withshiftkey.numlines = 1;<br />
mousewheel.horizscroll.withshiftkey.sysnumlines = true;<br />
</pre><br />
<br />
FWIW, you can change only the following value to remove the browser BACK/FORWARD commands:<br />
<br />
<pre><br />
mousewheel.horizscroll.withnokey.action = 0;<br />
</pre><br />
<br />
With that, you can still go BACK/FORWARD by pressing together the shift or the alt key, while with the control key you increase or decrease the font size.<br />
<br />
==Configure Opera for using trackpoint horizontal scrolling==<br />
You'll experience the same annoying problem with the popular browser Opera. To fix this you need to edit the configfile <tt>standard_mouse.ini</tt> in e.g. /usr/share/opera/ini/ (Debian) or /opt/opera/share/opera/ini/ (Gentoo) and comment out the following lines<br />
<pre><br />
Button6 = Back<br />
Button7 = Forward<br />
</pre><br />
so they look like that<br />
<pre><br />
;Button6 = Back<br />
;Button7 = Forward<br />
</pre><br />
Remember, Button6 and Button7 do not so coincidental correspond with our X configuration we know from above:<br />
<pre><br />
Option "YAxisMapping" "6 7"<br />
</pre><br />
After this change you will be able to scroll vertically and horizontally with your middle button.<br />
<br />
==Fixing trackpoint under Ubuntu 7.10 Gutsy Gibbon==<br />
===Using trackpoint deamon===<br />
My default Ubuntu Gutsy (running on an X61s) would give the following error messages when running the trackpoint daemon. Running<br />
<pre><br />
/etc/init.d/trackpoint restart<br />
</pre><br />
caused a bunch of error messages, as the wrong device was in<br />
<pre><br />
/etc/trackpoint/trackpoint.conf<br />
</pre><br />
<br />
I fixed this by changing:<br />
<pre><br />
echo -n > /sys/devices/platform/i8042/serio0/serio2/sensitivity<br />
</pre><br />
to<br />
<pre><br />
echo -n > /sys/devices/platform/i8042/serio1/sensitivity<br />
</pre><br />
in /etc/trackpoint/trackpoint.conf.<br />
<br />
In addition, Ubuntu ran the appropriate /etc/init.d/trackpoint script on booting, but would give a bunch of errors (which, oddly, I could never find in any of the log files).<br />
<br />
It seems that it was running the scripts too early in the boot sequence. The Gutsy package provided<br />
<pre><br />
/etc/rc2.d/S20trackpoint<br />
</pre><br />
<br />
so I renamed this to S99trackpoint (and in all the other rc.? directories) and it now works on boot.<br />
<br />
===Editing the kernel config files===<br />
Another way of configuring the trackpoint without using the trackpoint daemon is to edit the values of the trackpoint files which, BTW, are located in<br />
/sys/devices/platform/i8042/serio1/serio2.<br />
<br />
The script should be executed during boot. This can be done in an init script (e.g. /etc/bootmisc.sh in some distros)<br />
<br />
Script:<br />
<pre><br />
#! /bin/sh<br />
<br />
#<br />
# configuration du trackpoint<br />
#<br />
<br />
# vitesse<br />
echo -n 120 > /sys/devices/platform/i8042/serio1/serio2/speed<br />
<br />
# sensibilité<br />
echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity <br />
<br />
# press to select<br />
echo -n 1 > /sys/devices/platform/i8042/serio1/serio2/press_to_select<br />
</pre><br />
===An Ubuntu/Fedora example===<br />
Another script that I've created seems to work with all versions of Ubuntu/Fedora that I've been able to try (comment out and uncomment the appropriate lines for fedora/ubuntu as necessary)<br />
Place in /etc/rc.local or equivalent for your distro:<br />
<br />
Script:<br />
<pre><br />
#*************************<br />
## START TRACKPOINT CONFIG<br />
#*************************<br />
<br />
# For fedora (the slash after "speed" is returned)<br />
# TRACKPATH=$(find /sys -print0 | grep -FzZ "/serio2/speed" | sed s^speed/^^)<br />
<br />
# For ubuntu (the slash after "speed" is not returned)<br />
TRACKPATH=$(find /sys -print0 | grep -FzZ "/serio2/speed" | sed s/speed//)<br />
<br />
## Select "press_to_select" on the trackpoint input device<br />
## We need to specify the TRACKPATH above because the device under "serio#"<br />
## changes between system boots. (We first test to see if the file we want<br />
## to modify exists, if it does, we make the change<br />
#[ -f $TRACKPATH/press_to_select ] && echo -n 1 > $TRACKPATH/press_to_select<br />
<br />
## Adjust the speed setting of the trackpoint input device<br />
[ -f $TRACKPATH/speed ] && echo -n 120 > $TRACKPATH/speed <br />
## Adjust the sensitivity setting of the trackpoint input device<br />
[ -f $TRACKPATH/sensitivity ] && echo -n 200 > $TRACKPATH/sensitivity<br />
<br />
#***********************<br />
## END TRACKPOINT CONFIG<br />
#***********************<br />
</pre></div>Pelzihttps://www.thinkwiki.org/w/index.php?title=Tp_smapi&diff=18902Tp smapi2006-01-24T15:22:34Z<p>Pelzi: /* Model-specific status */</p>
<hr />
<div>{| width="100%"<br />
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__<br />
|style="vertical-align:top" |The <tt>tp_smapi</tt> kernel module exposes some features of the ThinkPad's [[SMAPI support for Linux|SMAPI]] functionality via a <tt>sysfs</tt> interface. Currently, the implemented functionality is control of battery charging, extended battery status and control of CD/DVD speed (disabled by default).<br />
<br />
For old ThinkPad models, see also [[tpctl]].<br />
<br />
{{WARN|This driver uses undocumented features and direct hardware access. They thus cannot be guaranteed to work, and may cause arbitrary damage (though so far none was reported)..}}<br />
<br />
|}<br />
<br />
===Features===<br />
*Battery charge/discharge control<br />
*Battery status information<br />
*Optical drive speed control<br />
<br />
===Project Homepage / Availability===<br />
* Project page: http://tpctl.sourceforge.net/<br />
* You need to download only the [http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579 tp_smapi kernel module].<br />
<br />
===Installation===<br />
For testing, you can simply compile and load the driver within the current<br />
working directory:<br />
:{{cmdroot|tar xzvf tp_smapi-0.16.tgz}}<br />
:{{cmdroot|cd tp_smapi-0.16}}<br />
:{{cmdroot|make load}}<br />
<br />
To compile and install into the kernel's module path:<br />
:{{cmdroot|make install}}<br />
<br />
If you use the [[HDAPS]] driver, add <tt>HDAPS=1</tt> to also patch the <tt>hdaps</tt> for compatibility with <tt>tp_smapi</tt> (this requires a kernel source tree):<br />
:{{cmdroot|1=make load HDAPS=1}} &nbsp; or &nbsp; {{cmdroot|1=make install HDAPS=1}}<br />
<br />
<br />
To prepare a stand-alone patch against the current kernel tree (including<br />
a compatibility fixes to <tt>hdaps</tt> and <tt>Kconfig</tt> entries):<br />
:{{cmdroot|make patch}}<br />
<br />
To delete all autogenerated files:<br />
:{{cmdroot|make clean}}<br />
<br />
The original kernel tree is never modified by any these commands. <br />
The {{path|/lib/modules}} directory is modified only by {{cmdroot|make install}}.<br />
<br />
===Battery charge control features===<br />
To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):<br />
:{{cmdroot|echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh}}<br />
:{{cmdroot|echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh}}<br />
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/*_charge_thresh}}<br />
{{HINT|Battery charging thresholds can be used to keep Li-Ion ad Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_Treatment|increase their lifetime]].}}<br />
To unconditionally inhibit charging for 17 minutes:<br />
:{{cmdroot|echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}<br />
{{HINT|Charge inhibiting can be used to reduce the power draw of the laptop, in order to use a an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when [[How to use UltraBay batteries|using an Ultrabay battery]].}}<br />
<br />
To cancel charge inhibiting:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}<br />
<br />
To force battery discharging even if connected to AC, use one of these:<br />
:{{cmdroot|echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge}}<br />
{{HINT|This can be used to choose which battery is discharged when [[How to use UltraBay batteries|using an UltraBay battery]].}}<br />
<br />
To cancel forced discharge:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge}}<br />
<br />
===Battery status features===<br />
To view extended battery status such as charging state, voltage, current, capacity, cycle count and model information:<br />
<br />
<pre><br />
# cat /sys/devices/platform/smapi/BAT0/installed<br />
# cat /sys/devices/platform/smapi/BAT0/state # idle/charging/discharging<br />
# cat /sys/devices/platform/smapi/BAT0/cycle_count <br />
# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current<br />
# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average<br />
# cat /sys/devices/platform/smapi/BAT0/power_now # instantaneous power<br />
# cat /sys/devices/platform/smapi/BAT0/power_avg # last minute average<br />
# cat /sys/devices/platform/smapi/BAT0/last_full_capacity<br />
# cat /sys/devices/platform/smapi/BAT0/remaining_capacity<br />
# cat /sys/devices/platform/smapi/BAT0/design_capacity<br />
# cat /sys/devices/platform/smapi/BAT0/voltage<br />
# cat /sys/devices/platform/smapi/BAT0/design_voltage<br />
# cat /sys/devices/platform/smapi/BAT0/manufacturer<br />
# cat /sys/devices/platform/smapi/BAT0/model<br />
# cat /sys/devices/platform/smapi/BAT0/serial<br />
# cat /sys/devices/platform/smapi/BAT0/barcoding<br />
# cat /sys/devices/platform/smapi/BAT0/chemistry<br />
# cat /sys/devices/platform/smapi/ac_connected<br />
</pre><br />
<br />
The raw status data is also available, including some fields not listed above (in case you can figure them out):<br />
<br />
:{{cmdroot|cat /sys/devices/platform/smapi/BAT0/dump}}<br />
<br />
In all of the above, replace <tt>BAT0</tt> with <tt>BAT1</tt> to address the 2nd battery.<br />
<br />
Note that the battery status readout conflicts with the stock [[HDAPS|hdaps]] driver, so if you use <tt>hdaps</tt> you will need to load <tt>tp_smapi</tt> using {{cmdroot|1=make load HDAPS=1}} (see [[#Conflict_with_hdaps|Conflict with hdaps]] below).<br />
<br />
===Optical drive control features===<br />
<br />
To control the speed of the optical drive:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/cd_speed # slow}}<br />
:{{cmdroot|echo 1 > /sys/devices/platform/smapi/cd_speed # medium}}<br />
:{{cmdroot|echo 2 > /sys/devices/platform/smapi/cd_speed # fast}}<br />
:{{cmdroot|cat /sys/devices/platform/smapi/cd_speed}}<br />
<br />
=====Enabling this feature=====<br />
Changing the drive speed when a disc is being accessed will hang your computer. This feature is thus '''disabled by default''', but can be enabled using by adding <tt>#define PROVIDE_CD_SPEED</tt> at the top of <tt>tp_smapi.c</tt>. The safe way to set the drive speed is using <tt>hdparm -E num</tt> or <tt>eject -x num</tt> for CD-ROM, and <tt>speedcontrol -x num</tt> (sourcecode [http://safari.iki.fi/speedcontrol.c here]) for DVD. For kernels older than 2.6.15, this may require the [[Problems_with_SATA_and_Linux#No_SMART_support libata pass-through|libata pass-through patch]].<br />
<br />
===Other features===<br />
Other things that can be controlled through SMAPI, but are not supported in this version of the driver, include forcing battery discharge, PCI bus power saving, CPU power saving control and fan control. See the included README file for more information.<br />
<br />
===Conflict with <tt>hdaps</tt>===<br />
The extended battery status function conflicts with the [[HDAPS|hdaps]] kernel module (they use the same IO ports). <br />
<br />
You can use <tt>HDAPS=1</tt> (see [[#Installation|Installation]]) to get a patched version of <tt>hdaps</tt> which is compatible with <tt>tp_smapi</tt>. <br />
<br />
Otherwise:<br />
<br />
If you load <tt>hdaps</tt> first, <tt>tp_smapi</tt> will disable its battery status functions (and log a message in the kernel log). If you load <tt>tp_smapi</tt> first, <tt>hdaps</tt> will refuse to load. To switch between the two, <tt>rmmod</tt> both and then load one you need.<br />
<br />
Some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}).<br />
<br />
The charging control files (<tt>*_charge_thresh</tt>, <tt>inhibit_charge_minutes</tt> and <tt>force_discharge*</tt>) don't have this problem.<br />
<br />
===Model-specific status===<br />
<br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|+<tt>tp_smapi</tt> feature support matrix<br />
|-<br />
! &times; <br />
! <tt>start_charge_<br />thresh</tt> <br />
! <tt>stop_charge_<br />thresh</tt><br />
! <tt>inhbit_charge_<br />minutes</tt><br />
! <tt>force_discharge</tt><br />
! battery status files<br \><font size="-2">(see [[#Conflict_with_hdaps|note about <tt>hdaps</tt>]] above)</font><br />
! <tt>cd_speed</tt><br \><font size="-2">(see [[#Enabling_this_feature|note]] above)</font><br />
|-<br />
! colspan=7 style="text-align:center;background:#efefef;" | G series<br />
|-<br />
! {{G41}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}}|| {{Cyes}} <br />
|-<br />
! colspan=7 style="text-align:center;background:#efefef;" | R series<br />
|-<br />
! {{R40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}}|| {{Cyes}} <br />
|-<br />
! {{R50}}<br />
| {{Cunk}} || {{Cno}} || {{Cunk}} || {{Cunk}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{R50p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{R51}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{R52}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}}|| {{Cyes}} <br />
|-<br />
! colspan=7 style="text-align:center;background:#efefef;" | T series<br />
|-<br />
! {{T22}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} <br />
|-<br />
! {{T23}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{T40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{T40p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{T41p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cunk}}|| {{Cyes}} <br />
|-<br />
! {{T42}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{T42p}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}}|| {{Cunk}} <br />
|-<br />
! {{T43}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! {{T43p}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}}|| {{Cyes}} <br />
|-<br />
! colspan=7 style="text-align:center;background:#efefef;" | X series<br />
|-<br />
! {{X24}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{X31}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{X32}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cunk}}|| {{Cunk}} <br />
|-<br />
! {{X40}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}}|| {{Cunk}} <br />
|-<br />
! {{X41}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}}|| {{Cunk}} <br />
|}<br />
<br />
Please update the above and report your experience on the [[Talk:tp_smapi|discussion]] page. If the module loads but gives a "<tt>not supported</tt>" or "<tt>not implementeded</tt>" when you try to use some specific file in {{path|/sys/devices/platform/smapi/}}, please report the <tt>dmesg</tt> output and whether the corresponding functionality is available under Windows - maybe your ThinkPad just can't do that.<br />
<br />
[[Category:Drivers]] [[Category:Patches]]<br />
<br />
===Tools using this driver===<br />
<br />
The driver's interface can be accessed directly through the files under {{path|/sys/devices/platform/smapi}}, or via the following tools:<br />
* [[KThinkBat]] - display battery status on the KDE <tt>kicker</tt> panel.</div>Pelzi