https://www.thinkwiki.org/w/api.php?action=feedcontributions&user=Maikel&feedformat=atomThinkWiki - User contributions [en]2024-03-29T08:41:43ZUser contributionsMediaWiki 1.31.12https://www.thinkwiki.org/w/index.php?title=Power_Sources&diff=55354Power Sources2014-02-26T01:12:00Z<p>Maikel: /* fuel cell */ added</p>
<hr />
<div>Like most electrical devices ThinkPads are commonly connected to a public power grid providing 100V to 240V of alternating current (AC). This alternating current is converted to direct current (DC) by an external AC [[Power Connector|power adapter]]. For example, 240V AC is converted to 20V DC. This direct current is the power input for a ThinkPad to run the device, to [[Maintenance#Battery treatment|charge the battery]] or both at the same time.<br />
<br />
But other power sources are possible. Most of them require a kind of converter to generate the required input of a ThinkPad model. Lenovo lists an [http://support.lenovo.com/en_US/detail.page?LegacyDocID=migr-68305 adapter set] for most models. With alternative power sources ThinkPads can operate long-term independet from a grid.<br />
__TOC__<br />
<br />
<br />
== cigarette lighter receptacle ==<br />
<br />
The [https://en.wikipedia.org/wiki/Cigarette_lighter_receptacle cigarette lighter receptacle] is a defacto standard DC connector in automobiles. It provides 6V or more commonly 12V, but this can fluctuate depending on the state of the car engine. A DC-to-DC converter can compensate these fluctuations and provide the required voltage for a particular ThinkPad.<br />
<br />
<br />
== EmPower ==<br />
<br />
The [https://en.wikipedia.org/wiki/EmPower_%28aircraft_power_adapter%29 EmPower] adapter is used by airlines and provides 15V DC. A DC-to-DC converter is required.<br />
<br />
<br />
== solar panel ==<br />
<br />
Descriptions of using solar panels to power a laptop are rare. Lenovo links to a reseller in the USA that advertises complete [http://www.sunshineworks.com/solar-computer-power-supply.htm power backup sets]. Most solar panel systems don't provide exactly the voltage used by a particular ThinkPad model. Then a DC-to-DC converter is required.<br />
<br />
20V solar panels are available which could be used directly to charge actual ThinkPads. But no experience is available yet.<br />
<br />
<br />
== fuel cell ==<br />
<br />
Fuel cells are available for the charge of smartphones but not for laptops yet.<br />
<br />
== other sources ==<br />
<br />
There are a lot of power sources which have to be explored to be used with a ThinkPad. For example: wind, water, cranck-handle, bicycle, ...</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Power_Sources&diff=55353Power Sources2014-02-26T01:09:36Z<p>Maikel: /* list of power inputs of different models */ deleted <- info on Power Connector</p>
<hr />
<div>Like most electrical devices ThinkPads are commonly connected to a public power grid providing 100V to 240V of alternating current (AC). This alternating current is converted to direct current (DC) by an external AC [[Power Connector|power adapter]]. For example, 240V AC is converted to 20V DC. This direct current is the power input for a ThinkPad to run the device, to [[Maintenance#Battery treatment|charge the battery]] or both at the same time.<br />
<br />
But other power sources are possible. Most of them require a kind of converter to generate the required input of a ThinkPad model. Lenovo lists an [http://support.lenovo.com/en_US/detail.page?LegacyDocID=migr-68305 adapter set] for most models. With alternative power sources ThinkPads can operate long-term independet from a grid.<br />
__TOC__<br />
<br />
<br />
== cigarette lighter receptacle ==<br />
<br />
The [https://en.wikipedia.org/wiki/Cigarette_lighter_receptacle cigarette lighter receptacle] is a defacto standard DC connector in automobiles. It provides 6V or more commonly 12V, but this can fluctuate depending on the state of the car engine. A DC-to-DC converter can compensate these fluctuations and provide the required voltage for a particular ThinkPad.<br />
<br />
<br />
== EmPower ==<br />
<br />
The [https://en.wikipedia.org/wiki/EmPower_%28aircraft_power_adapter%29 EmPower] adapter is used by airlines and provides 15V DC. A DC-to-DC converter is required.<br />
<br />
<br />
== solar panel ==<br />
<br />
Descriptions of using solar panels to power a laptop are rare. Lenovo links to a reseller in the USA that advertises complete [http://www.sunshineworks.com/solar-computer-power-supply.htm power backup sets]. Most solar panel systems don't provide exactly the voltage used by a particular ThinkPad model. Then a DC-to-DC converter is required.<br />
<br />
20V solar panels are available which could be used directly to charge actual ThinkPads. But no experience is available yet.<br />
<br />
<br />
== other sources ==<br />
<br />
There are a lot of power sources which have to be explored to be used with a ThinkPad. For example: wind, water, cranck-handle, bicycle, ...</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Power_Sources&diff=55352Power Sources2014-02-26T01:08:39Z<p>Maikel: link to Power Connector</p>
<hr />
<div>Like most electrical devices ThinkPads are commonly connected to a public power grid providing 100V to 240V of alternating current (AC). This alternating current is converted to direct current (DC) by an external AC [[Power Connector|power adapter]]. For example, 240V AC is converted to 20V DC. This direct current is the power input for a ThinkPad to run the device, to [[Maintenance#Battery treatment|charge the battery]] or both at the same time.<br />
<br />
But other power sources are possible. Most of them require a kind of converter to generate the required input of a ThinkPad model. Lenovo lists an [http://support.lenovo.com/en_US/detail.page?LegacyDocID=migr-68305 adapter set] for most models. With alternative power sources ThinkPads can operate long-term independet from a grid.<br />
__TOC__<br />
<br />
<br />
== cigarette lighter receptacle ==<br />
<br />
The [https://en.wikipedia.org/wiki/Cigarette_lighter_receptacle cigarette lighter receptacle] is a defacto standard DC connector in automobiles. It provides 6V or more commonly 12V, but this can fluctuate depending on the state of the car engine. A DC-to-DC converter can compensate these fluctuations and provide the required voltage for a particular ThinkPad.<br />
<br />
<br />
== EmPower ==<br />
<br />
The [https://en.wikipedia.org/wiki/EmPower_%28aircraft_power_adapter%29 EmPower] adapter is used by airlines and provides 15V DC. A DC-to-DC converter is required.<br />
<br />
<br />
== solar panel ==<br />
<br />
Descriptions of using solar panels to power a laptop are rare. Lenovo links to a reseller in the USA that advertises complete [http://www.sunshineworks.com/solar-computer-power-supply.htm power backup sets]. Most solar panel systems don't provide exactly the voltage used by a particular ThinkPad model. Then a DC-to-DC converter is required.<br />
<br />
20V solar panels are available which could be used directly to charge actual ThinkPads. But no experience is available yet.<br />
<br />
<br />
== other sources ==<br />
<br />
There are a lot of power sources which have to be explored to be used with a ThinkPad. For example: wind, water, cranck-handle, bicycle, ...<br />
<br />
<br />
== list of power inputs of different models ==<br />
<br />
Different models have different energy needs and use different connectors and different voltages. Most common inputs are 20V, 19V and 16V.<br />
<br />
{| border="0" cellspacing="2" cellpadding="2"<br />
!Model !! AC input Voltage !! AC input Current(s) !! Battery Voltage<br />
|-<br />
|X200s || 20V || 3.25A / 4.5A || 14.4V<br />
|}</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Power_Connector&diff=55351Power Connector2014-02-26T01:03:00Z<p>Maikel: /* Models using this connector */ X200s has also labled 4.5 Amps, maybe others too?</p>
<hr />
<div>{| width="100%"<br />
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__<br />
|style="vertical-align:top" |<br />
Over time, different ThinkPads have used different power connectors. You can use a higher Amperage rated power supply then your ThinkPad needs, as long as the physical connector is correct. But you should not use a lower Amperage power supply on a ThinkPad needing more Amperage. Doing so will overheat the power supply, and might cause issues such as screen flicker.<br />
<br />
{{HINT|In case you cannot find your Model ThinkPad listed, or you wish to double check, you can find the required power information on a label on the bottom of your ThinkPad}}<br />
<br />
{{NOTE|The Amperage's listed below are the OUTPUT values for the AC adapter, which should be equal or greater then what your ThinkPad requires}}<br />
<br />
All current Thinkpads require 20 Volt DC input. See also the official Lenovo {{IBMDOCURL|MIGR-4tcmcu|page for power adapters}}.<br />
<br />
|}<br />
<br />
<br />
=6.3 mm outer, 3.0 mm inner diameter=<br />
{{HELP|Will someone with an actual unit in-hand, please confirm the size?}}<br />
15 V, 2.0 A Power.<br />
*ThinkPad {{350}}, {{350C}}<br />
*ThinkPad {{500}}, {{510Cs}}<br />
*ThinkPad {{700T}}, {{730T}}<br />
<br />
=4-Pin hexagon=<br />
{{NOTE|The information found in this page is mostly correct. But the four-pin connector, in particular, is not thoroughly understood. This information '''is incomplete''' and not entirely correct.}}<br />
[[image:4pin-power-plug.JPG|right|thumb|4 pin power connector]]<br />
===Unknown watts/amps===<br />
*ThinkPad {{355}}, {{355Cs}}, {{355C}}<br />
*ThinkPad {{360}}, {{360Cs}}, {{360C}}, {{360P}}, {{360CSE}}, {{360CE}}<br />
*ThinkPad {{370C}}<br />
*ThinkPad {{700}}, {{700C}}<br />
*ThinkPad {{720}}, {{720C}}<br />
*ThinkPad {{750}}, {{750Cs}}, {{750C}}, {{750P}}<br />
<br />
===35W===<br />
AC Adapter PN 76H0119<br />
* ThinkPad {{755CX}}, {{755CV}}, {{755CD}}, {{755CDV}}<br />
*ThinkPad {{760L}}, {{760C}}, {{760CD}}, {{760EL}}, {{760ELD}}, {{760E}}, {{760ED}}, {{760XL}}, {{760XD}}<br />
===40W===<br />
*ThinkPad {{555BJ}}<br />
*ThinkPad {{755C}}, {{755Cs}}, {{755CSE}}, {{755CE}}<br />
*ThinkPad {{760LD}}<br />
===50W===<br />
20 V 2.5 A - FRU 49G2196<br />
* ThinkPad {{360PE}}<br />
*ThinkPad {{850}}, 851<br />
<br />
===56W===<br />
AC Adapter PN 12J2456<br />
*ThinkPad {{765L}}, {{765D}}<br />
<br />
{{HINT|As these 4-pin PSUs are getting more rare and more expensive, a cheap solution if you don't have one is to adapt a universal 19-20V laptop PSU with a barrel connector. This isn't ideal if you're relying on the Thinkpad for some critical old business application, but it's fine if you're just a tinkerer playing with an old one off eBay for example. <br />
Only the "+" and "-" connections (top-right and bottom-right looking into the connector on the back of the laptop from the back of the laptop) are required for basic operation, so that's all you need to adapt. <br />
Get an extension lead for your barrel connector - e.g. 2.1mm - and cut it in half. Discard the plug half.<br />
Get a "Mini JST" plug with flying leads, commonly used to power model helicopters etc. This is the plug that I've found will fit over the + and - pins.<br />
Wire the two together so that the red wire on the Mini JST is soldered to the centre contact wire on the barrel connector extension (socket half). <br />
<br />
ALWAYS double check the polarity when plugging in your custom modded connector, since it's possible to get it the wrong way round.}}<br />
<br />
=4-Pin Kycon=<br />
This connector resembles, but is slightly larger, than Mini-Din. <br />
[[image:120w-plug.jpg|right|thumb|120W power plug]]<br />
===120W 7.5 Amps===<br />
ThinkPad 120W AC Adapter {{IBMDOCURL|MIGR-50424|(Support Website)}}<br/><br />
AC Adapter FRU PN 92P1035<br/><br />
AC Adapter Ouput: 7.5A, 16V<br />
*ThinkPad {{G Series}}<br />
*[[ThinkPad Mini-Dock]]<br />
<br />
=5.5 mm outer, 2.5 mm inner diameter=<br />
[[image:16v-barrel.jpg|right|thumb|16V coax connector]]<br />
This is a 2.5/5.5mm barrel coax connector, delivering 16 volts.<br />
<br />
===35W 2.2 Amps===<br />
*ThinkPad {{340CSE}} (rated 1.0A)<br />
*ThinkPad {{345CS}}, {{345C}}<br />
*ThinkPad {{365CS}}, {{365C}}, {{365CSD}}, {{365CD}}, {{365E}}, {{365ED}}, {{365X}}, {{365XD}}<br />
*ThinkPad {{380}}, {{380D}}<br />
*ThinkPad {{560E}}, {{560X}}, {{560Z}}<br />
*ThinkPad {{560}} (rated 1.9A)<br />
*ThinkPad {{701C}}, {{701CS}} (rated 1.9A)<br />
<br />
===54W 3.36 Amps===<br />
Some of them have been recalled: see the page [[Damage in 56W AC-Adapter, plastic housing melted]].<br />
*ThinkPad {{240}}, {{240X}}, {{240Z}}<br />
*ThinkPad {{390}}, {{390E}}, {{390X}}, i Series 1700 ({{I1720|displaylikethis}}, {{I1721}}, {{I1780}}, {{I1781}})<br />
*ThinkPad {{570}}, {{570E}}<br />
*ThinkPad i Series 1400 and 1500 (type 2621) ({{I1400}}, {{I1500}})<br />
*{{I1200}}, {{I1330}}<br />
*ThinkPad {{T20}}, {{T21}}, {{T22}}<br />
<br />
===56W 3.5 Amps===<br />
*ThinkPad {{235}}<br />
*ThinkPad {{340}}<br />
*ThinkPad {{380E}}, {{380ED}}, {{380XD}}, {{380Z}}<br />
*ThinkPad {{385D}}, {{385ED}}, {{385XD}}<br />
*ThinkPad {{535}}, {{535E}}<br />
*ThinkPad {{600}}, {{600E}}, {{600X}}<br />
*ThinkPad {{770}}, {{770E}}, {{770ED}}, {{770X}}, {{770Z}}<br />
*ThinkPad {{TransNote}}<br />
*ThinkPad {{X20}}, {{X21}}, {{X22}}, {{X23}}, {{X24}}, {{X30}}, {{X31}}, {{X32}}, {{X40}}, {{X41}}, {{X41t}}<br />
<br />
===72W 4.5 Amps===<br />
*ThinkPad {{A Series}}<br />
*ThinkPad {{R30}}, {{R31}}, {{R32}}<br />
*ThinkPad {{R40}}, {{R40e}}, {{R50}}, {{R50e}}, {{R50p}}, {{R51}}, {{R51e}}, {{R52}}<br />
*ThinkPad {{T23}}, {{T30}}<br />
*ThinkPad {{T40}}, {{T40p}}, {{T41}}, {{T41p}}, {{T42}}, {{T42p}}, {{T43}}, {{T43p}}<br />
<br />
=barrel connector, slim=<br />
19 Volt Coax connector<br><br />
IBM called it "barrel connector, slim". 19 V, 45 W 2.4 A. 5.5 mm outer, 2.1 mm inner diameter. Option Marketing number 11J8702. See {{LNVDOCURL|PD012162|AC adapter matrix (Doc PD012162)}} as a source of information.<br />
<br />
*ThinkPad 310 (type 2600)<br />
*ThinkPad {{310}}, {{310D}}, {{310E}}, {{310ED}}<br />
*ThinkPad i Series 1400 and 1500 (type 2611) ({{IBMDOCURL|LWIK-3Z7J5H|reference Doc LWIK-3Z7J5H}})<br />
**{{I1410}}, {{I1411}}, {{I1412}}, {{I1450}}, {{I1451}}, {{I1452}}, {{I1472}}<br />
**{{I1512}}, {{I1552}}<br />
<br />
=big barrel "advanced" connector=<br />
[[image:20v-barrel.jpg|right|thumb|20V coax connector]]<br />
20 Volt Coax. 7.5mm OD, 5.55mm ID, 0.8mm diameter central pin.<br />
<br />
==Signal Pin==<br />
Power controller subsystem senses when power is connected, and measures resistance between central signal pin and ground. Firmware policy might reduce performance (battery charges slowly, processors throttle to low speed) if an insufficient supply is detected. This issue is [http://forum.thinkpads.com/viewtopic.php?f=48&t=94554 discussed at forum.thinkpads.com, "W520 requires 170W AC adapter"].<br />
<br />
{| border=1 cellspacing=0 cellpadding=2<br />
|- style="background:#ffdead;white-space:nowrap;"<br />
! power rating !! resistance<br />
|-<br />
| 65 W || 10 kΩ<br />
|-<br />
| 90 W || not connected<br />
|-<br />
| 135 W || 0 Ω<br />
|-<br />
| 170 W || 1.5 kΩ<br />
|}<br />
<br />
==Models using this connector==<br />
===65W 3.25 Amps===<br />
AC Adapter Output 3.25A, 20V<br />
*ThinkPad {{R60}}, {{R400}}, {{R500}} - with Intel Graphics<br />
*ThinkPad {{T60}}, {{T400}}, {{T400s}}, {{T410s}}, {{T500}}, {{T510}}, - with Intel Graphics<br />
*ThinkPad {{T410i}}, {{T410si}}, {{T430i}}, {{T510i}}<br />
*ThinkPad {{X60s}}, {{X61}}, {{X61s}}, {{X61 Tablet}}<br />
*ThinkPad {{X100e}}, {{X200}}, {{X200s}}, {{X200 Tablet}}, {{X201}}, {{X201i}}, {{X201s}}, {{X201 Tablet}}, {{X300}}, {{X301}}, {{X220}}, {{X220 Tablet}}, {{X230}}, {{X230 Tablet}}<br />
*Thinkpad {{Z60m}}, {{Z60t}}, {{Z61e}}, {{Z61m}}, {{Z61t}} - with Intel Graphics<br />
<br />
===90W 4.5 Amps===<br />
*ThinkPad {{R60}}, {{R60e}}<br />
*ThinkPad {{T60}}, {{T60p}}, {{T61}}, {{T61p}}, {{T400}}, {{T410}}, {{T500}}, {{T510}} - With ATI or Nvidia Graphics<br />
*ThinkPad {{T430}}<br />
*ThinkPad {{T520}} - Dual Core<br />
*ThinkPad {{W500}}<br />
*ThinkPad {{X200s}}<br />
*ThinkPad {{Z60m}}, {{Z60t}}<br />
<br />
===135W 6.75 Amps===<br />
AC Adapter {{IBMDOCURL|MIGR-74503|PN 55Y9317}}<br />
*ThinkPad {{T520}} - Quad Core<br />
*ThinkPad {{W510}}<br />
<br />
===170W 8.5 Amps===<br />
AC Adapter {{IBMDOCURL|MIGR-76762|PN 0A36227}} (US) and {{IBMDOCURL|MIGR-76762|PN 0A36231}} (EU)<br />
*ThinkPad {{W520}}<br />
*ThinkPad {{W530}}<br />
This AC adapter has the same diameter as the usual 20V AC adapters, but there is an extra plastic knob on one side of the connector. It is not round any more, that is, you can only plug it in one particular orientation. The extra knob prevents one from using the AC adapter on any other Thinkpads.<br />
<br />
=slim plug=<br />
This connector is used in power accessories, not in any Think system. It is found in {{IBMDOCURL|MIGR-68305|90W Slim AC/DC Combo Adapter}} (which won a [http://www.g-mark.org/award/describe/34706 Good Design Award] ) and later {{IBMDOCURL|MIGR-72900|90W Ultraslim AC/DC Combo Adapter}}.<br />
<br />
==slim power tips==<br />
*Lenovo Slim Power Tip for X1 Carbon: ASM part 0B47048. {{LNVDOCURL|PD025643|Support Doc PD025643}}. (Despite its name, compatibility is not limited to X1 Carbon.)<br />
<br />
=W700 Coax connector=<br />
6.0 mm outer, 3.0 mm inner diameter. {{HELP|Will someone with an actual unit in-hand, please confirm the size?}}<br />
The W700/W700ds AC adapter plug has a different diameter than all other 20 Volt AC adapters. You cannot plug in a different AC adapter into a W700-series Thinkpad nor can you use the W700 AC adapter on a non-W700 Thinkpad.<br />
<br />
===170W 8.5 Amps for W700===<br />
AC Adapter {{IBMDOCURL|MIGR-70684|PN 41R4421}}<br />
*ThinkPad {{W700}}, {{W700ds}}<br />
<br />
===230W 11.5 Amps===<br />
AC Adapter {{IBMDOCURL|MIGR-74950|PN 55Y9333}}<br />
*ThinkPad {{W700}}, {{W700ds}}, {{W701}}, {{W701ds}}<br />
<br />
=slim tip=<br />
[[image:20v-connectors.jpg|right|thumb|20V coax rectangle and barrel connectors]]<br />
{{QUOTE|Lenovo|store product description|New rectangular fixed “slim tip” plug to support thin and light hardware designs}}<br />
Lenovo introduced a new power connector in 2012. This connector is standard in all new models since late 2013 product line. It is rectangular, close in size to USB A connector, and it has a signal pin in centre. A conversion cable for 20V barrel plugs exists (ASM 0A36037; FRU 03X6261).<br />
<br />
==Signal Pin==<br />
{| border=1 cellspacing=0 cellpadding=2<br />
|- style="background:#ffdead;white-space:nowrap;"<br />
! power rating !! resistance<br />
|-<br />
| 45 W || 120 Ω<br />
|-<br />
| 65 W || 280 Ω<br />
|-<br />
| 90 W || 550 Ω<br />
|-<br />
| 135 W || 1 kΩ<br />
|-<br />
| 170 W || 1.9 kΩ<br />
|}<br />
<br />
==Models using this connector==<br />
*OneLink connector<br />
*ThinkPad Ultra Dock<br />
<br />
===45W 2.25 Amps===<br />
*{{IdeaPad Yoga 11}}<br />
*ThinkPad {{Helix}}<br />
*ThinkPad {{T431s}}<br />
*ThinkPad {{X240s}}<br />
*ThinkPad {{T440s}} (with Intel graphics)<br />
<br />
===65W 3.25 Amps===<br />
*{{IdeaPad Yoga 13}}<br />
*ThinkPad Edge {{E531}}<br />
*ThinkPad {{T440s}} (with discrete graphics)<br />
<br />
===90W 4.5 Amps===<br />
*ThinkPad {{X1 Carbon}}<br />
<br />
===135W 6.75 Amps===<br />
*ThinkPad {{T540p}}<br />
*ThinkPad {{W540}} (i5+K1100M)<br />
<br />
===170W 8.5 Amps===<br />
*ThinkPad {{W540}} (i7+K2100M, [http://forums.lenovo.com/t5/W-Series-ThinkPad-Laptops/W540-displays-are-flickering-off-and-on-randomly/td-p/1449317 i7+K1100M])<br />
<br />
=unsorted=<br />
*ThinkPad {{820}}, {{860}}, {{I1124}}, {{I1157}}, {{I1300}}, {{I1370}}, {{I1620}}, {{I1800}}<br />
*ThinkPad {{S30}}, {{S31}}<br />
*54 or 56 W, clarity needed: {{I1210}}, {{I1230}}, {{I1250}}, {{I1260}}, {{i1420}}, {{I1460}}, {{I1480}}, {{I1421}}, {{I1441}}, {{I1422}}, {{I1442}}, {{I1482}}, {{I1483}}, {{I1492}}, {{I1540}}, {{I1541}}, {{I1542}}, {{I1560}}, {{I1562}}, {{I1592}}, <br />
===10.5 V, 1.0 A Power===<br />
*ThinkPad {{220}}<br />
<br />
<br />
[[Category:Components]]</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Power_Sources&diff=55346Power Sources2014-02-25T12:38:54Z<p>Maikel: Collecting information about possible power sources</p>
<hr />
<div>Like most electrical devices ThinkPads are commonly connected to a public power grid providing 100V to 240V of alternating current (AC). This alternating current is converted to direct current (DC) by an external AC power adapter. For example, 240V AC is converted to 20V DC. This direct current is the power input for a ThinkPad to run the device, to [[Maintenance#Battery treatment|charge the battery]] or both at the same time.<br />
<br />
But other power sources are possible. Most of them require a kind of converter to generate the required input of a ThinkPad model. Lenovo lists an [http://support.lenovo.com/en_US/detail.page?LegacyDocID=migr-68305 adapter set] for most models. With alternative power sources ThinkPads can operate long-term independet from a grid.<br />
__TOC__<br />
<br />
<br />
== cigarette lighter receptacle ==<br />
<br />
The [https://en.wikipedia.org/wiki/Cigarette_lighter_receptacle cigarette lighter receptacle] is a defacto standard DC connector in automobiles. It provides 6V or more commonly 12V, but this can fluctuate depending on the state of the car engine. A DC-to-DC converter can compensate these fluctuations and provide the required voltage for a particular ThinkPad.<br />
<br />
<br />
== EmPower ==<br />
<br />
The [https://en.wikipedia.org/wiki/EmPower_%28aircraft_power_adapter%29 EmPower] adapter is used by airlines and provides 15V DC. A DC-to-DC converter is required.<br />
<br />
<br />
== solar panel ==<br />
<br />
Descriptions of using solar panels to power a laptop are rare. Lenovo links to a reseller in the USA that advertises complete [http://www.sunshineworks.com/solar-computer-power-supply.htm power backup sets]. Most solar panel systems don't provide exactly the voltage used by a particular ThinkPad model. Then a DC-to-DC converter is required.<br />
<br />
20V solar panels are available which could be used directly to charge actual ThinkPads. But no experience is available yet.<br />
<br />
<br />
== other sources ==<br />
<br />
There are a lot of power sources which have to be explored to be used with a ThinkPad. For example: wind, water, cranck-handle, bicycle, ...<br />
<br />
<br />
== list of power inputs of different models ==<br />
<br />
Different models have different energy needs and use different connectors and different voltages. Most common inputs are 20V, 19V and 16V.<br />
<br />
{| border="0" cellspacing="2" cellpadding="2"<br />
!Model !! AC input Voltage !! AC input Current(s) !! Battery Voltage<br />
|-<br />
|X200s || 20V || 3.25A / 4.5A || 14.4V<br />
|}</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Battery&diff=55345Battery2014-02-25T11:37:33Z<p>Maikel: link fixed</p>
<hr />
<div>#REDIRECT [[Maintenance#Battery treatment]]</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Code/tp-theft&diff=55273Code/tp-theft2014-01-22T04:15:15Z<p>Maikel: added forgotten hash for comment</p>
<hr />
<div><pre><br />
#!/usr/bin/perl<br />
#<br />
# tp-theft v0.5.1<br />
# (http://thinkwiki.org/wiki/Script_for_theft_alarm_using_HDAPS)<br />
<br />
# Provided under the GNU General Public License version 2 or later or<br />
# the GNU Free Documentation License version 1.2 or later, at your option.<br />
# See http://www.gnu.org/copyleft/gpl.html for the Warranty Disclaimer.<br />
<br />
# This script uses the HDAPS accelerometer found on recent ThinkPad models<br />
# to emit an audio alarm when the laptop is tilted. In sufficiently<br />
# populated environments, it can be used as a laptop theft deterrent.<br />
# Uses a state machine and some heuristics to reduce false alarms.<br />
#<br />
# By default the alarm will be activated only when the KDE screen saver is<br />
# locked. If you you open the laptop lid (or press the lid button) shortly<br />
# before or after the beginning of movement, the alarm will be suspended<br />
# (except for a brief warning) and you will get a few seconds of grace to <br />
# unlock the screen saver. You can disable this functionality by passing <br />
# the "--arm" parameter, or by setting $use_kde=0 and $use_lid=0.<br />
#<br />
# There is also an option to track a BlueTooth device (e.g., a mobile phone).<br />
# In this case, the alarm is activated (and optionally, the KDE desktop is <br />
# locked) whenever the device is turned off or too distant for a given period,<br />
# and deactivated when the BlueTooth device is nearby. You need to provide the<br />
# device's BD address. If both KDE screen saver and BlueTooth checking are<br />
# enabled, then the alarm will be activated when *either* the screensaver<br />
# is enabled or the BlueTooth device is amiss.<br />
#<br />
# To control the sound and blinkenlights, and adjust the alarm activation <br />
# parameters, see the variables below.<br />
<br />
use strict;<br />
use warnings;<br />
use FileHandle;<br />
use IO::Pipe;<br />
use Time::HiRes qw(sleep time);<br />
use POSIX qw(:errno_h :signal_h);<br />
<br />
##############################<br />
# Siren volume and content<br />
<br />
# Alarm audio volume (0..100)<br />
my $alarm_volume = 70;<br />
# Alarm command (default: synthesize a siren for 1.0 seconds):<br />
my $alarm_cmd = "sox -t nul /dev/null -t wav -s -w -c2 -r48000 -t raw - synth 1.0 sine 2000-4000 sine 4000-2000 | aplay -q -fS16_LE -c2 -r48000";<br />
# my $alarm_cmd = "aplay keep_your_hands_off_me.wav";<br />
<br />
# Warning audio volume (0..100)<br />
my $warn_volume = 45;<br />
# Alarm command (default: synthesize a biref siren):<br />
my $warn_cmd = "sox -t nul /dev/null -t wav -s -w -c2 -r48000 -t raw - synth 0.10 sine 2000-4000 sine 4000-2000 | aplay -q -fS16_LE -c2 -r48000";<br />
# my $warn_cmd = "aplay warning.wav";<br />
<br />
# Set ibm_acpi volume (0..15), if ibm_acpi is loaded with "experimental=1".<br />
# Combining $acpi_volume=15 and $alarm_volume=100 makes the alarm <br />
# dangerously loud.<br />
my $acpi_volume = 10;<br />
<br />
# Blink system LEDs when alarm activated?<br />
my $use_led = 'safe'; # 0=off, 'safe'=only LEDs whose state you can recover, 'all'=pretty blinkenlights!<br />
<br />
# Blink ThinkLight when alarm activated?<br />
my $use_light = 0; # 0=off, 1=on<br />
<br />
# Use AC state to monitor <br />
my $use_ac_state = 1; # 0=off, 1=on<br />
##############################<br />
# Activation control<br />
<br />
# Tilt threshold (increase value to decrease sensitivity):<br />
my $thresh = 0.20;<br />
# Minimum movement duration between warning and alarm:<br />
my $min_hold = 1.3;<br />
# When armed, any movement triggers alarm. How long should it remain armed?<br />
my $arm_persist = 6;<br />
<br />
# After this many seconds of no movement, will allow a grace period again:<br />
my $grace_relax = 15;<br />
<br />
# Activate according to KDE screen saver? Otherwise, always active:<br />
my $use_kde = 1;<br />
# When screen saver locked, wait this long before activation:<br />
my $kde_lock_delay = 8;<br />
<br />
# Provide grace period if laptop lid is opened?<br />
my $use_lid = 1;<br />
# Opening a lid will grant this many seconds of grace (once):<br />
my $lid_grace = 7;<br />
# Lid must to be opened within this time to hold/pause alarm:<br />
my $lid_grace_window = 8;<br />
# Alarm will hold off this long when grace is available:<br />
my $lid_hold = 3;<br />
<br />
# Control arming according by presence of a BlueTooth token<br />
my $use_bluetooth = 0;<br />
# Lock KDE screen saver when BlueTootk is not present?<br />
my $bluetooth_lock_kde = 1;<br />
# BD address of BlueTooth token (use "hcitool scan" to find this)<br />
my $bluetooth_token_addr = '00:00:00:00:00:00';<br />
# Consider token amiss when its received signal leve is below this (see "hcitool rssi")<br />
my $bluetooth_min_rssi = -10;<br />
# Activate if BlueTooth token not seen this long:<br />
my $bluetooth_activate_period = 12;<br />
# Disactivate if BlueTooth token seen this recently:<br />
my $bluetooth_deactivate_period = 5;<br />
# If BlueTooth detection activated KDE lock, don't do it again for this long<br />
my $bluetooth_lock_kde_interval = 30;<br />
# If BlueTooth wasn't polled for this long, disregard recent history<br />
my $bluetooth_reset_period = 10; <br />
<br />
##############################<br />
# Other setup vars<br />
<br />
my $interval = 0.1; # sampling intervalm in seconds<br />
my $depth = 10; # number of recent samples to analyze<br />
my $verbose = 2; # 0=nothing, 1=alarms, 2=state transitions, 3=everything<br />
my $kde_check_interval = 1.5; # KDE screen saver check is expensive<br />
my $bluetooth_sleep = 1; # Sleep interval in BlueTooth check loop<br />
<br />
my $pos_file = '/sys/devices/platform/hdaps/position';<br />
my $lid_file = '/proc/acpi/button/lid/LID/state';<br />
my $led_file = '/proc/acpi/ibm/led';<br />
my $light_file = '/proc/acpi/ibm/light';<br />
my $bay_file = '/proc/acpi/ibm/bay';<br />
my $volume_file = '/proc/acpi/ibm/volume'; # load ibm_acpi with experimental=1<br />
my $bluetooth_file = '/proc/acpi/ibm/bluetooth'; # load ibm_acpi with experimental=1<br />
my $ac_state_file = '/proc/acpi/ac_adapter/AC/state'; # ac state <br />
<br />
my $alsactl = '/usr/sbin/alsactl';<br />
my $amixer = 'amixer';<br />
my $kdesktop_lock = '/usr/bin/kdesktop_lock';<br />
my $hcitool = '/usr/bin/hcitool';<br />
my $l2ping = '/usr/bin/l2ping';<br />
<br />
##############################<br />
# Utility functions<br />
<br />
sub say {<br />
my ($verb, $what) = @_;<br />
print(gmtime().": $what\n") if $verb<=$verbose;<br />
}<br />
<br />
sub slurp { # read whole file<br />
my ($filename) = @_;<br />
local $/;<br />
my $fh = new FileHandle($filename,"<") or return;<br />
return <$fh>;<br />
}<br />
<br />
sub burp { # write whole file<br />
my ($filename) = shift;<br />
my $fh = new FileHandle($filename,">") or die "Can't open $filename for writing: $!";<br />
print $fh @_ or die "Can't write to $filename: $!";<br />
close $fh or die "Can't close $filename after writing: $!";<br />
}<br />
<br />
sub stddev { # standard deviation of list<br />
my $sum=0;<br />
my $sumsq=0;<br />
my $n=$#_+1;<br />
for my $v (@_) {<br />
$sum += $v;<br />
$sumsq += $v*$v;<br />
}<br />
return sqrt($n*$sumsq - $sum*$sum)/($n*($n-1));<br />
}<br />
<br />
sub frac {<br />
my ($x) = @_;<br />
return $x-int($x);<br />
}<br />
<br />
sub max {<br />
return $_[0] > $_[1] ? $_[0] : $_[1];<br />
}<br />
<br />
my $alarm_file; # flags ongoing alarm (and also stores saved mixer settings)<br />
<br />
sub sound_alarm {<br />
# Sound alarm. Forks bash code which sets given volumes, runs the given<br />
# command, and then restores the given volumes to their saved values.<br />
my ($name, $volume, $acpi_volume, $cmd) = @_;<br />
return if (defined($alarm_file) && -f $alarm_file);<br />
say(1,$name);<br />
$alarm_file = `mktemp /tmp/tp-theft-tmp.XXXXXXXX` or die "mktemp: $?";<br />
chomp($alarm_file);<br />
my ($acpi_vol_file, $acpi_vol_set, $acpi_vol_restore);<br />
if ($_=slurp($volume_file) and m/^level:\s+(\d+)\n/) {<br />
$acpi_vol_file = $volume_file; <br />
$acpi_vol_set = "level $acpi_volume"; <br />
$acpi_vol_restore = "level $1"; <br />
if (m/^mute:\s+on$/m) {<br />
$acpi_vol_set = "up,".$acpi_vol_set; # unmute first<br />
$acpi_vol_restore .= ",mute"; # mute last<br />
}<br />
} else {<br />
$acpi_vol_file='/dev/null'; $acpi_vol_set=''; $acpi_vol_restore='';<br />
}<br />
system('/bin/bash', '-c', <<"EOF")==0 or die "Failed: $?";<br />
( trap \"echo '$acpi_vol_restore' > $acpi_vol_file; sleep 0.1;<br />
$alsactl -f $alarm_file restore;<br />
rm -f $alarm_file<br />
\" EXIT HUP QUIT TERM<br />
$alsactl -f $alarm_file store && # store ALSA<br />
echo '$acpi_vol_set' > $acpi_vol_file && sleep 0.1 && # set ACPI<br />
$amixer -q set Master $volume% unmute && # set ALSA Master<br />
$amixer -q set PCM 100% unmute && # set alsa PCM<br />
$cmd ) & # invoke command<br />
EOF<br />
}<br />
<br />
<br />
##############################<br />
# KDE screen saver lock check<br />
<br />
if ($use_kde) { # Basic sanity check<br />
`/sbin/pidof kdesktop`; $?==0 or die "Can't use KDE, it's not running.\n";<br />
}<br />
<br />
sub kdesktop_lock_status {<br />
# See if kdesktop_lock is running and check its cmdline and automatic lock delay<br />
my $bin = $kdesktop_lock;<br />
my $pids = `/sbin/pidof $bin`;<br />
return 'off' unless $?==0;<br />
for my $pid (split(/\s+/,$pids)) {<br />
next unless $pid =~ m/^\d+$/;<br />
# Attached to display ":0" or "localhost:0"?<br />
my $environ = slurp("/proc/$pid/environ") or next;<br />
my $good=0; my $home;<br />
for (split(/\x00/,$environ)) { <br />
$good=1 if m/^DISPLAY=(localhost)?:0$/; <br />
$home=$1 if m/^HOME=(.+)$/; # also remember its $HOME<br />
}<br />
next unless $good;<br />
# Check command line<br />
my $cmdline = slurp("/proc/$pid/cmdline") or next;<br />
$cmdline =~ m/^[^\x00]+\x00(?:([^\x00]+)\x00)?/ or die "Cannot parse $bin command line\n";<br />
if (!defined($1)) {<br />
# Read KDE screensaver lock time<br />
defined($home) or die "Cannot find HOME in environment of $bin process";<br />
my $rc_path = "$home/.kde/share/config/kdesktoprc";<br />
my $rc = new FileHandle($rc_path,"<") or die "Error opening $rc_path: $!";<br />
while (<$rc>) { m/^LockGrace=(\d+)$/ and return ('auto', $1/1000.0); };<br />
die "Cannot parse $rc_path";<br />
} elsif ($1 eq '--forcelock') {<br />
return "force";<br />
}<br />
}<br />
return 'off';<br />
}<br />
<br />
my $last_kls_update = 0; # time of last update<br />
my $last_kls = 'init'; # last state seen<br />
my $last_kls_start; # when that state started<br />
my @last_kls_opwhy = ();<br />
<br />
sub check_kde_lock {<br />
# De/activate according to KDE screen saver:<br />
my $now=time();<br />
return @last_kls_opwhy if $now < $last_kls_update + $kde_check_interval;<br />
my ($kls, $auto_delay) = kdesktop_lock_status();<br />
$last_kls_update = time();<br />
if ($kls ne $last_kls) {<br />
$last_kls = $kls;<br />
$last_kls_start = $now;<br />
}<br />
if ($kls eq 'off') { # no screen saver<br />
@last_kls_opwhy = (0, 'KDE screen saver not locked');<br />
} elsif ($kls eq 'auto') { # screen saver with automatic lock<br />
if ($now >= $last_kls_start + $auto_delay + $kde_lock_delay) {<br />
@last_kls_opwhy = (1, 'KDE screen saver is auto-locked');<br />
}<br />
} elsif ($kls eq 'force') { # screen saver with forced lock<br />
if ($now >= $last_kls_start + $kde_lock_delay) {<br />
@last_kls_opwhy = (1, 'KDE screen saver is forced-locked');<br />
}<br />
}<br />
return @last_kls_opwhy;<br />
}<br />
<br />
# Lock KDE desktop<br />
sub force_kde_lock {<br />
return if ($last_kls eq 'auto' or $last_kls eq 'force');<br />
say(1, "Locking KDE desktop");<br />
# system('dcop kdesktop KScreensaverIface lock') or die "Cannot lock KDE dekstop: $!"<br />
<br />
my %oldENV = %ENV;<br />
my $kde_pids = `/sbin/pidof -x /usr/bin/startkde`;<br />
for my $kde_pid (split(/\s+/,$kde_pids)) {<br />
my $kde_env = slurp("/proc/$kde_pid/environ") or next;<br />
%ENV = ();<br />
for (split(/\x00/,$kde_env)) {<br />
m/^(DISPLAY|HOME|XAUTHORITY|USER|DBUS_SESSION_BUS_ADDRESS)=(.+)$/<br />
and $ENV{$1} = $2;<br />
}<br />
next unless defined($ENV{DISPLAY}) and $ENV{DISPLAY} =~ m/^:/;<br />
system('dcop kdesktop KScreensaverIface lock') and die "Cannot lock KDE dekstop: $!"<br />
}<br />
my %ENV = %oldENV;<br />
}<br />
<br />
##############################<br />
# Lid checking<br />
<br />
if ($use_lid) { # sanity check<br />
slurp($lid_file) or die "Can't use lid via $lid_file: $!";<br />
}<br />
<br />
my $last_lid_status = 'open';<br />
my $last_lid_open = 0;<br />
<br />
sub check_lid {<br />
my $lid = slurp($lid_file) or return;<br />
if ($lid =~ m/state: *open$/) {<br />
$last_lid_open = time() if ($last_lid_status eq 'closed');<br />
$last_lid_status = 'open';<br />
} else {<br />
$last_lid_status = 'closed';<br />
}<br />
return $last_lid_status;<br />
}<br />
<br />
##############################<br />
# AC state checking<br />
<br />
my $ac_state;<br />
sub read_ac_state {<br />
open F, $ac_state_file;<br />
if ((<F>) =~ /^state:\s*(on|off)-line$/)<br />
{<br />
$ac_state=$1;<br />
}<br />
close F;<br />
return($1);<br />
}<br />
read_ac_state;<br />
### used for testing print "AC: $ac_state\n";<br />
<br />
##############################<br />
# LED blinking<br />
<br />
# Flash LEDs<br />
sub led_activate {<br />
return if $use_led eq '0';<br />
my $ledf = new FileHandle($led_file,">");<br />
if (!defined($ledf)) {<br />
print "Cannot open $led_file, disabling LED indicator: $!\n";<br />
$use_led = '0';<br />
return;<br />
}<br />
$ledf->autoflush(1);<br />
my $base = time()*2.5;<br />
print $ledf '0 '.((frac($base)>0.7)?'on':'off')."\n"; # power<br />
if ($use_led eq 'all') { # battery -- we can't recover these<br />
print $ledf '1 '.((frac($base+0.50)>0.7)?'on':'off')."\n"; # battery, orange<br />
print $ledf '2 '.((frac($base+0.25)>0.7)?'on':'off')."\n"; # battery, yellow<br />
}<br />
print $ledf '4 '.((frac($base)>0.7)?'on':'off')."\n"; # bay<br />
print $ledf '7 '.((frac($base+0.725)>0.7)?'on':'off')."\n"; # standby<br />
}<br />
<br />
# Restore LEDs to normal state<br />
sub led_restore {<br />
return if $use_led eq '0';<br />
my $ledf = new FileHandle($led_file,">") or die "Cannot open $led_file: $!\n";<br />
$ledf->autoflush(1);<br />
print $ledf "0 on\n"; # power=on<br />
if ($use_led eq 'all') { # battery -- we can't recover these<br />
print $ledf "1 on\n";<br />
print $ledf "2 on\n";<br />
}<br />
print $ledf "7 off\n"; # power=off<br />
if (my $baydata = slurp($bay_file)) {<br />
my $is_bay = ($baydata =~ m/^status:\s*occupied$/m)?'on':'off';<br />
print $ledf "4 $is_bay\n"; # reset to correct status<br />
} else {<br />
print $ledf "4 on\n"; # force bay on, we don't know correct status<br />
}<br />
}<br />
<br />
<br />
##############################<br />
# ThinkLight blinking<br />
<br />
sub light_activate {<br />
return if $use_light eq '0';<br />
my $lightf = new FileHandle($light_file,">");<br />
if (!defined($lightf)) {<br />
print "Cannot open $light_file, disabling ThinkLight indicator: $!\n";<br />
$use_light = '0';<br />
return;<br />
}<br />
my $base = time()/2;<br />
print $lightf (check_lid() eq 'open' && ((frac($base)<0.1)?'on':'off'))."\n";<br />
}<br />
<br />
sub light_restore {<br />
return if $use_light eq '0';<br />
my $lightf = new FileHandle($light_file,">") or die "Cannot open $light_file: $!\n";<br />
print $lightf "off\n"; # ThinkLight<br />
}<br />
<br />
##############################<br />
# BlueTooth token detection<br />
<br />
<br />
{<br />
my $temporary_bt = 0;<br />
my $bt_pid;<br />
my $bt_pipe;<br />
my $bluetooth_last_seen = 0; # last time we saw the BlueTooth token<br />
my $bluetooth_last_read = 0; # last time we polled the BlueTooth child process<br />
my $bluetooth_ignore_missing_until = time() + $bluetooth_reset_period; <br />
<br />
if ($use_bluetooth) {<br />
# If BlueTooth is disabled, temporarily enable it<br />
slurp($bluetooth_file) or die "Can't control bluetooth via $bluetooth_file: $!";<br />
my $bt_status = slurp($bluetooth_file);<br />
$temporary_bt = $bt_status =~ m/status:[\t]*disabled/;<br />
if ($temporary_bt) {<br />
say(1, 'BlueTooth was disabled, enabling');<br />
burp($bluetooth_file, "enable\n");<br />
sleep(1);<br />
}<br />
}<br />
<br />
sub bluetooth_reset { # disregard recent (negative) history<br />
$bluetooth_ignore_missing_until = max($bluetooth_ignore_missing_until, time() + $bluetooth_reset_period);<br />
}<br />
<br />
sub check_bluetooth {<br />
if (!defined($bt_pid)) {<br />
# Create new child process, which will loop checking<br />
# for the token. Each time it sees the token, it writes<br />
# the current time to a pipe that's read by the main process.<br />
$bt_pipe = new IO::Pipe;<br />
$bt_pid = fork();<br />
die "Cannot fork BlueTooth check: $!" unless defined($bt_pid);<br />
if (!$bt_pid) {<br />
# Child<br />
$bt_pipe->writer();<br />
$bt_pipe->autoflush(1);<br />
open(STDOUT, ">/dev/null");<br />
open(STDERR, ">/dev/null");<br />
while(1) {<br />
# Is the BlueTooth token reachable?<br />
my $res = system($l2ping,'-c','1','-t',1,$bluetooth_token_addr);<br />
die "Failed invoking l2ping: $!\n" if $res&0xFF;<br />
if ($res==0) {<br />
# Is the BlueTooth sufficiently close, as judged by signal strength?<br />
$res = `$hcitool rssi $bluetooth_token_addr`;<br />
if ($?==0 && $res =~ m/^RSSI return value: (-?[0-9]+)$/) {<br />
my $rssi = $1;<br />
printf $bt_pipe "%d\n", time() if ($rssi > $bluetooth_min_rssi);<br />
}<br />
}<br />
sleep($bluetooth_sleep);<br />
}<br />
}<br />
$bt_pipe->reader();<br />
$bt_pipe->blocking(0);<br />
}<br />
<br />
while (1) { <br />
my $res = <$bt_pipe>;<br />
last if ($!==POSIX::EAGAIN); # busy<br />
die "Error reading from BlueTooth check child process\n" unless defined($res);<br />
$bluetooth_last_seen = $res;<br />
}<br />
<br />
my $now = time();<br />
bluetooth_reset() if ($now > $bluetooth_last_read + $bluetooth_reset_period);<br />
$bluetooth_last_read = time();<br />
if ($now > max($bluetooth_last_seen + $bluetooth_activate_period, $bluetooth_ignore_missing_until)) {<br />
if ($bluetooth_lock_kde) {<br />
force_kde_lock();<br />
$bluetooth_ignore_missing_until = max($bluetooth_ignore_missing_until, time() + $bluetooth_lock_kde_interval);<br />
}<br />
return (1, "BlueTooth token not seen for $bluetooth_activate_period seconds, activating.");<br />
} elsif ($now < $bluetooth_last_seen + $bluetooth_deactivate_period) {<br />
return (0, "BlueTooth token seen during last $bluetooth_deactivate_period seconds, deactivating.");<br />
}<br />
return ();<br />
}<br />
<br />
sub bluetooth_restore {<br />
if ($temporary_bt) {<br />
say(1, 'Disabling BlueTooth');<br />
burp($bluetooth_file, "disable\n");<br />
}<br />
if ($bt_pid) {<br />
kill(SIGTERM, $bt_pid);<br />
waitpid($bt_pid, 0);<br />
}<br />
}<br />
}<br />
<br />
##############################<br />
# Main code<br />
<br />
my $state; # See state machine in main loop<br />
my %state_names=(0 =>'disabled ',<br />
0.5=>'activating ',<br />
1 =>'active+grace',<br />
2 =>'active ',<br />
3 =>'hold+grace ',<br />
4 =>'armed+grace ',<br />
5 =>'hold ',<br />
6 =>'armed ',<br />
7 =>'armed-force ' );<br />
my $state_end = 0; <br />
my $last_tilt = 0;<br />
my $arm_forced = 0;<br />
my (@XHIST, @YHIST); # sensor history<br />
<br />
my $initpower=read_ac_state(); #check power state when script runs<br />
<br />
sub set_state {<br />
my ($st, $why) = @_;<br />
say(2, "state=[".$state_names{$st}."] ($why)");<br />
(@XHIST, @YHIST) = () if $st==0.5;<br />
led_restore() and light_restore() if defined($state) && $st==0;<br />
$state = $st;<br />
}<br />
<br />
sub get_pos {<br />
my $pos = slurp($pos_file);<br />
return undef if $!{EBUSY};<br />
die "Can't open HDAPS file $pos_file: $!\n" if (!defined($pos) || $!);<br />
$pos =~ m/^\((-?\d+),(-?\d+)\)$/ or die "Can't parse $pos_file content\n";<br />
return ($1,$2);<br />
}<br />
<br />
<br />
for (@ARGV) {<br />
m/^--arm/ && do { $arm_forced=1; $use_lid=0; $use_kde=0; last; };<br />
die "Unknown parameter\n";<br />
}<br />
<br />
set_state( ($use_kde || $use_bluetooth) ? 0 : 0.5, "init");<br />
<br />
eval {<br />
<br />
$SIG{'HUP'}=$SIG{'INT'}=$SIG{'ABRT'}=$SIG{'QUIT'}=$SIG{'SEGV'}=$SIG{'TERM'} = sub { die "signal\n" };<br />
<br />
while (1) {<br />
sleep(($state==0 && $use_kde) ? $kde_check_interval : $interval);<br />
<br />
check_lid() if $use_lid;<br />
# Check screensaver and BlueTooth. Activate if either says so,<br />
# otherwise deactivate if either says so.<br />
my ($op1, $why1); ($op1, $why1) = check_kde_lock() if $use_kde;<br />
my ($op2, $why2); ($op2, $why2) = check_bluetooth() if $use_bluetooth;<br />
my ($op, $why) = ( !defined($op1) || ( defined($op2) && $op2>$op1 ) ) ? ($op2,$why2) : ($op1,$why1);<br />
if (defined($op)) {<br />
if ($op==1 && $state==0) { set_state(0.5, $why); }<br />
if ($op==0 && $state>0) { set_state(0, $why); bluetooth_reset(); }<br />
}<br />
next unless $state>0;<br />
<br />
# Collect and analyze sensor data:<br />
my $now = time();<br />
my $tilted;<br />
my ($x,$y) = get_pos() or next; # Hopefully the error is transient<br />
push(@XHIST,$x); push(@YHIST,$y);<br />
if ($state>0.5) {<br />
shift(@XHIST); shift(@YHIST);<br />
my $xdev = stddev(@XHIST);<br />
my $ydev = stddev(@YHIST);<br />
say(3,"X: v=$xdev (".join(',',@XHIST).") Y: v=$ydev (".join(",",@YHIST).")");<br />
$tilted = ($xdev>$thresh || $ydev>$thresh);<br />
$last_tilt = $now if $tilted;<br />
}<br />
<br />
# ac state check and set when system started on battery and later plugged power cord<br />
my $power = read_ac_state();<br />
if ($initpower eq 'off' && $power eq 'on') {<br />
$initpower='on';<br />
}<br />
<br />
# Decide: state machine transitions<br />
if ($state==0.5) { # ACTIVATING (collecting motion data will soon activate)<br />
if ($#XHIST >= $depth && $#YHIST >= $depth) {<br />
set_state($arm_forced?7:$use_lid?1:2, "finished data collection");<br />
}<br />
} elsif ($state==1) { # ACTIVE+GRACE (quiet for a long time, awaiting movement)<br />
if ($tilted) {<br />
set_state(3, "motion detected, holding for $lid_hold seconds, open lid for grace");<br />
$state_end = $now + $lid_hold;<br />
sound_alarm("WARNING", $warn_volume, $acpi_volume, $warn_cmd);<br />
}<br />
} elsif ($state==2) { # ACTIVE (short for a shorter time, awaiting movement)<br />
if ($tilted) {<br />
set_state(5, "motion detected, holding for $min_hold seconds");<br />
$state_end = $now + $min_hold;<br />
sound_alarm("WARNING", $warn_volume, $acpi_volume, $warn_cmd);<br />
} else {<br />
if ($use_lid && ($now > $last_tilt + $grace_relax )) { <br />
set_state(1, "$grace_relax seconds since last motion, so allowing grace again");<br />
}<br />
}<br />
} elsif ($state==3) { # HOLD+GRACE (recent movemvent, but still holding off alarm; after long quiet)<br />
if ($now < $last_lid_open + $lid_grace) {<br />
set_state(5, "lid opened, holding for $lid_grace seconds grace period");<br />
$state_end = $now + $lid_grace;<br />
} elsif ($now >= $state_end) {<br />
my $delta = $lid_grace_window - $lid_hold;<br />
$state_end = $now + $delta;<br />
set_state(4, "hold ended, arming but allowing grace for $delta more seconds");<br />
}<br />
} elsif ($state==4) { # ARMED+GRACE (armed, but recently quiet so allow grace if lid opened)<br />
if ($now < $last_lid_open + $lid_grace) {<br />
set_state(5, "lid opened, holding for $lid_grace seconds grace period");<br />
$state_end = $now + $lid_grace;<br />
} elsif ($now >= $state_end) {<br />
set_state(6, "grace window ended");<br />
}<br />
} elsif ($state==5) { # HOLD (recent movement, but still holding off alarm; there was recent action)<br />
if ($now >= $state_end) {<br />
set_state(6, "hold ended, arming");<br />
}<br />
} elsif ($state==6) { # ARMED (sound alarm on any movement)<br />
if ($now > $last_tilt + $arm_persist) {<br />
set_state(2, "no motion for $arm_persist seconds, unarming");<br />
}<br />
}<br />
<br />
# LEDs:<br />
if ($state>0) {<br />
led_activate(); light_activate();<br />
}<br />
<br />
# Alarm: <br />
# included initpower state<br />
if (($state==4 || $state==6 || $state==7) && ($tilted || ($power eq 'off') && $initpower eq 'on')) {<br />
sound_alarm("ALARM", $alarm_volume, $acpi_volume, $alarm_cmd);<br />
}<br />
}<br />
<br />
};<br />
<br />
print "Shutting down.\n" if $verbose>1;<br />
led_restore() and light_restore() if ($state>0);<br />
bluetooth_restore();<br />
die "$@" if $@;<br />
</pre></div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Problem_with_high_pitch_noises&diff=55272Problem with high pitch noises2014-01-22T02:09:41Z<p>Maikel: /* Disable USB */ reorganize text</p>
<hr />
<div>Information on strange high pitch, low volume noises emitted by ThinkPads.<br />
<br />
==Problem description==<br />
Even though ThinkPads are known as very silent notebooks, they tend to emit different, mostly high pitch noises in certain circumstances. The noises are of low volume and hence not realized by everyone or at least tolerated by most people. However, there are those with "bat like ears" that hear them and might be annoyed by that.<br />
<br />
==Affected Models==<br />
Noises have been experienced in the following situations:<br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|-<br />
! style="vertical-align:top;background-color:#DDDDDD;" | situation<br />
! style="vertical-align:top;background-color:#DDDDDD;" | noise description<br />
! style="vertical-align:top;background-color:#DDDDDD;" | affected models<br />
|-<br />
| style="vertical-align:top;" |<br />
Plugged into AC / running at high CPU frequency<br />
| style="vertical-align:top;" |<br />
soft crackling, buzzing noise<br />
| style="vertical-align:top;" |<br />
*{{T41}}<br />
**2379-DJU<br />
|-<br />
| style="vertical-align:top;" |<br />
ThinkPad suspended to RAM<br />
| style="vertical-align:top;" |<br />
constant high pitch noise<br />
| style="vertical-align:top;" |<br />
*{{T42p}}<br />
|-<br />
| style="vertical-align:top;" |<br />
ThinkPad connected to power and switched off, with battery fully charged<br />
| style="vertical-align:top;" |<br />
constant high pitch noise<br />
| style="vertical-align:top;" |<br />
*{{T41p}}<br />
**2373-GHG<br />
|-<br />
| style="vertical-align:top;" |<br />
moving windows or just the mouse in xorg<br />
| style="vertical-align:top;" |<br />
strange noise like a rapid series of very short high pitch noises adding to a constant kind of whistling (only as long as the movement goes)<br />
| style="vertical-align:top;" |<br />
*{{A21m}}<br />
**2628<br />
*{{T41p}}<br />
**2373-GHG<br />
*{{T60}}<br />
|-<br />
| style="vertical-align:top;" |<br />
Thinkpad connected to power or working on battery, also when suspended to RAM<br />
| style="vertical-align:top;" |<br />
High pitch noise also when HD is powered down.<br />
| style="vertical-align:top;" |<br />
*{{T23}}<br />
**2647-DG4<br />
*{{X24}}<br />
**2662-MWG<br />
|-<br />
| style="vertical-align:top;" |<br />
Thinkpad connected to power battery charged less than 60%<br />
| style="vertical-align:top;" |<br />
High pitch noise till battery is charged more than 60%.<br />
| style="vertical-align:top;" |<br />
*{{T41p}}<br />
**2373-GEG<br />
|-<br />
| style="vertical-align:top;" |<br />
Constantly, if AC connected<br />
| style="vertical-align:top;" |<br />
High pitched, low volume constant noise.<br />
| style="vertical-align:top;" |<br />
*{{T40}}<br />
**2373-88U<br />
|-<br />
| style="vertical-align:top;" |<br />
When the CPU freq jumps up to 1Ghz or above, or when the laptop is in suspend mode<br />
| style="vertical-align:top;" |<br />
Constant high pitched<br />
| style="vertical-align:top;" |<br />
*{{R50}}<br />
**1829-6DM<br />
|-<br />
| style="vertical-align:top;" |<br />
(May come from harddisk.)<br />
| style="vertical-align:top;" |<br />
continuous, intermittent, low volume, high pitched<br />
| style="vertical-align:top;" |<br />
*{{600X}}<br />
|-<br />
| style="vertical-align:top;" |<br />
ACPI puts the processor into the C3 or C4 power saving states (i.e., the system is idle).<br />
| style="vertical-align:top;" |<br />
High-pitched crackling noise.<br />
| style="vertical-align:top;" |<br />
*{{X61}}<br />
**7673-B56<br />
*{{X41}}<br />
*{{T43}}<br />
**2686-DGU<br />
*{{T43p}}<br />
*{{T60}}<br />
**2007-72U<br />
*{{T21}}<br />
*{{T20}}<br />
**2648-46U<br />
|-<br />
| style="vertical-align:top;" |<br />
Cpufreqd (or powernowd etc.) slows down the processor, for exemple at the end of an heavy task.<br />
| style="vertical-align:top;" |<br />
High-pitched crackling noise.<br />
| style="vertical-align:top;" |<br />
*{{T42}}<br />
|-<br />
| style="vertical-align:top;" |<br />
When on battery<br />
| style="vertical-align:top;" |<br />
Noise level varies from inaudible to clearly audible, screeching sound, or sometimes beeping (when wifi is on). <br />
| style="vertical-align:top;" |<br />
*{{A21m}}<br />
**2628<br />
*{{R51}}<br />
**EHG-1829<br />
*{{R52}}<br />
**1858-A11<br />
**1846-B5G<br />
*{{R60}}<br />
**9461-DXG<br />
**9462-77G<br />
**9456-HTG<br />
**9461-DXG<br />
*{{R60e}}<br />
**0657-A9G<br />
**0657-3LG<br />
*{{T43}}<br />
**2686-DGU<br />
**1871-4AG<br />
*{{T60}}<br />
**2007-72U<br />
**1951-24G<br />
**1951-24G<br />
**2007-49G<br />
**2007-FUG<br />
*{{T60p}}<br />
**2007-FBG<br />
*{{T61}}<br />
**7659-12G<br />
**8898-5FG<br />
**6463-9WG<br />
*{{x60}}<br />
*{{x31}}<br />
**2673-CBU<br />
*{{Z61m}}<br />
**9450-3HG<br />
**9452-128<br />
**9452-W5Q<br />
*{{Z61t}}<br />
**9440-2QU<br />
<br />
|-<br />
| CPU is used much AND laptop is on AC power AND the TFT panel is enabled.<br />
| Screetching high pitch noise, like a million crickets<br />
| <br />
* {{X41}}<br />
<br />
|-<br />
| Network is pluged in and networkload is ~100%.<br />
| low volume highfreq. pitch noise from left speaker or cpu.<br />
|<br />
*{{Z60m}}, {{Z60t}}<br />
*{{T40}}<br />
*{{T43}}<br />
**2687-DDU<br />
<br />
|-<br />
| Constant, but is louder when Tablet Pen is near screen, on battery power<br />
| high pitch noise, screeching sounds *solved by "Media player paused" (see below) and also by BIOS versions 1.05 and later.<br />
|<br />
*{{X60_Tablet}}<br />
**6366-4DU<br />
<br />
|-<br />
| When fan is running on some speeds. Turning off fan stops pitch noise instandly.<br />
| High pitch noise ("CPU whining"). <br />
|<br />
*{{T60p}}<br />
**2007-83G<br />
|}<br />
<br />
==Affected Operating Systems==<br />
All, though Linux appears especially susceptible.<br />
<br />
==Possible sources==<br />
<br />
* '''CPU activity:''' On some models the noise is triggered by certain CPU power states or activity patterns (as proven [http://www.wisdom.weizmann.ac.il/~tromer/acoustic here]).<br />
* '''Graphics processor:''' In some models from the T2x era, e.g. the {{T23}}, the problem was related to the graphics circuitry and occured especially or only while making use of DirectDraw functions. IBM was able to fix it through a BIOS upgrade.<br />
* '''Hard disk:''' On some ThinkPads the processor and hard disk are adjacent and produce similar noise. For example, in the {{X41}} the sound generated by the hard disk is likely to be loudest at the vent.<br />
* '''Gigabit Ethernet processor:''' In some models (e.g., {{T43}}) high ethernet activity causes a high pitch noise.<br />
* '''Screen brightness:''' on an {{X31}}, a hissing sound is started whenever screen brightness is not full.<br />
* '''Power supply:''' a T61p is known to have the sound if a 90W power supply revision 01 is used. An alternative power supply of an other manufacturer did not make the laptop noisy.<br />
<br />
==Status==<br />
<br />
The problem is highly specific to operating system, model and even individual machines. There is no universal solution, but on most machines one of the following will reduce or eliminate the noise (possibly at some cost in power consumption).<br />
<br />
==Solutions for CPU-triggered noise==<br />
<br />
===Limit ACPI CPU power states===<br />
<br />
By default, the kernel supports up to eight ACPI CPU power saving states (C-states), called C1 through C8 (but the ThinkPad BIOS and hardware often offers (or remaps them to) only C1 to C4). Often only the extreme power saving modes C4 or C3 produce the noise, so the noise can be stopped by instructing the Linux ACPI code to use only lower modes. This has a cost, though: disabling C3 and C4 will make the CPU consume more power and reduce battery life. <br />
<br />
To forbid the ACPI driver from using C4 (this fixed the problem with on some ThinkPad {{T43}}, {{T43p}} and {{T41}}):<br />
* If the ACPI processor component is compiled as built-in (<tt>CONFIG_ACPI_PROCESSOR=y</tt>):<br />
**Pass the {{bootparm|processor.max_cstate|3}} kernel argument.<br />
* If the ACPI processor component is loaded as a module (<tt>CONFIG_ACPI_PROCESSOR=m</tt> and <tt>processor</tt> shows in the output of {{cmdroot|lsmod}}), do either of:<br />
** Pass the {{bootparm|processor.max_cstate|3}} kernel argument (this does not work in Ubuntu 5.10 with default kernel).<br />
** Add <code>options processor max_cstate=3</code> to {{path|/etc/modprobe.conf}} (or {{path|/etc/modprobe.conf.local}}, or {{path|/etc/modprobe.d/...}}, depending on your system) (this does not work in Ubuntu 5.10 with default kernel).<br />
** {{cmdroot|echo 3 > /sys/module/processor/parameters/max_cstate}} (this can be changed in runtime for experimentation). (If may need to be set again upon resume from suspend, e.g., in the wakeup script.)<br />
** (On Ubuntu 5.10, the default kernel uses <code>processor</code> as a module. Unfortunately, the script loading it, {{path|/etc/init.d/acpid}}, ignores the <code>options processor max_cstate=3</code> setting in {{path|/etc/modprobe.d/<my file>}}. As a solution for this specific problem, add the line <code>echo 2 > /sys/module/processor/parameters/max_cstate</code> directly to {{path|/etc/init.d/acpid}}, at the end of the function <code>load_modules()</code>, immediately after the line <code>echo "$PRINTK" > /proc/sys/kernel/printk</code>.)<br />
** On Gentoo: Configure your Thinkpad as described in the [http://www.gentoo.org/doc/en/power-management-guide.xml Power Management Guide]. Then as root create the files {{path|/etc/init.d/limit-sleep-states}} and {{path|/etc/conf.d/limit-sleep-states}} as below. After that just issue the command {{cmdroot|rc-update add limit-sleep-states default}} to limit the sleep states only when running on AC power, or {{cmdroot|rc-update add limit-sleep-states default battery}} to always limit the sleep states.<br />
cat <<EOF > /etc/init.d/limit-sleep-states<br />
#!/sbin/runscript<br />
<br />
depend() {<br />
need acpid<br />
}<br />
<br />
start() {<br />
ebegin "Limiting CPU sleep state to C${LIMIT_CSTATE}"<br />
echo $LIMIT_CSTATE > /sys/module/processor/parameters/max_cstate<br />
eend $?<br />
}<br />
<br />
stop() {<br />
ebegin "Removing CPU sleep state limit"<br />
echo $REMOVE_CSTATE > /sys/module/processor/parameters/max_cstate<br />
eend $?<br />
}<br />
EOF<br />
<br />
cat <<EOF > /etc/conf.d/limit-sleep-states<br />
# limit CPU sleep state to the following value (adjust accordingly)<br />
LIMIT_CSTATE=3<br />
# some value which is higher than all available sleep states<br />
REMOVE_CSTATE=8<br />
EOF<br />
<br />
To also forbid the C3 state, replace "<tt>3</tt>" with "<tt>2</tt>" above (this fixed the problem on some ThinkPad {{X40}}, {{X41}}, {{X60}}, {{T60}}, {{T61}}, {{Z61t}} and {{R52}}, as well as on {{T20}} where C4 is not supported at all).<br />
<br />
Note that these options affect power consumption when the CPU is idle. For example, here is the [[How to measure power consumption|measured power consumption]] on a ThinkPad {{T43}}:<br />
* {{bootparm|processor.max_cstate|4}}: 15160mW (default, noisy)<br />
* {{bootparm|processor.max_cstate|3}}: 15770mW (660mW higher, silent)<br />
* {{bootparm|processor.max_cstate|2}}: 16100mW (2940mW higher, silent)<br />
<br />
One can control how often Linux tries to enter the C3 state by using the {{bootparm|processor.bm_history|<bitmask>}} parameter on kernels with a scheduler frequency below 800Hz (and if you have noise problems, you really should not be running the kernel at 1000Hz...). Setting {{bootparm|processor.bm_history|0xFFFFFFFF}} will cause C3 to be entered less often. This will waste more power as the CPU won't do C3 or C4 as often, but at least it doesn't forbid C3 and C4 permanently, unlike {{bootparm|max_cstate|2}}.<br />
<br />
See the [http://thinkwiki.org/wiki?title=Talk:Problem_with_high_pitch_noises discussion page] for further information and success reports.<br />
<br />
*Jakob Schou Pedersen: Editing the file {{path|/etc/init.d/acpid}} as described above (the last solution) worked on my T43 :-)<br />
<br />
===MS Windows: Disable CPU popup mode ===<br />
<br />
This is a generic solution for Core 2 Duo platforms --- using the RMClock utility you can disable C4 to C1/C2/C3 transition and force the CPU to go straight to C0. To do this, in RMClock settings go to: "Enable Advanced CPU settings > Chipset" and disable at least "Enable Popup Mode". Related discussion can be found here: [[http://forum.thinkpads.com/viewtopic.php?f=30&t=75283]].<br />
<br />
===Turn off CPU power saving in the BIOS===<br />
<br />
Go into the BIOS and turn off the power saving processor feature that puts it into idle mode. This should be somewhere under Config/Power - look for "CPU Power Management", the default being automatic. Set "CPU Power Management" to "Disabled" (This worked on a ThinkPad {{T21}}, {{T43}}, {{T60}}, {{X60s}}, {{X200s}} and {{Z61m}}). However, this also affects power consumption when the CPU is idle, it's similar to disabling the C4/C3 ACPI CPU power state. For example, on a Z61m 9450-3HG, a full charged battery with power management enabled in the BIOS provides the notebook with power for about 3.5h, if disabled, the battery-lifetime is only about 2h.<br />
<br />
===Disable ACPI CPU power states===<br />
<br />
Completely disable CPU ACPI power states. Discussion:<br />
<br />
*From Martin Steigerwald: I made the observation that I get at least less high pitch noises on my {{T23}} when I do not use the two ACPI modules "processor" and "thermal" (depends on the first one). I have no clue, why. Anyone with similar experiences?<br />
:Omar Yasin: I've got a {{R52}} and when I load the same ACPIO modules the high pitch noises are not as loud but I can still hear them.<br />
*Kaspar Schleiser: On my {{T23}} the noise is less loud when setting max_cstate to 2, but to completely silence it, I have to set it to "1". Is that the same as removing the "processor"-module? "cat /proc/acpi/battery/BAT0/state" does not show increased power drain.<br />
*Niko Ehrenfeuchter: I'm experiencing the same here on my {{X24}}. Removing the "processor" module also stops the pitch noise, which does ONLY occur when setting the CPU to maximum speed (using cpufreq). On low speed it's completely silent, even having loaded the processor module.<br />
<br />
*Rolf Adelsberger: I can confirm this: the high pitch noise is only remarkable (at least with my ears ;-) ) if the processor speed is set to maximum frequency.<br />
<br />
*Stefan Baums: My {{X41}} produced a high-pitched crackle from the processor vent on the left. Changing HZ did nothing, and the 'processor' module could not easily be removed from the system (Ubuntu 5.04). What solved the problem for me was adding {{bootparm|idle|halt}} to the boot command line. Unfortunately, this solution only lasts until the first hibernation or suspend - when the computer ({{X41}}) resumes, the high-pitched crackle is back.<br />
<br />
* The {{bootparm|idle|halt}} solution combined with setting <code>#define HZ 100</code> in the kernel fixes the problem on a {{T43}}.<br />
<br />
* jhatch: {{bootparm|idle|halt}} plus <code>#define HZ 100</code> also worked on my {{T43}}. It still reverts back to noisy after a suspend/resume though. This needs to be fixed...<br />
<br />
===Use both C-States (sleep modes) and P-States (frequency scaling)===<br />
*Max Gaukler: I had the problem with a "beeping" noise of my {{R60}} on battery. When using powertop I recognised that it went into C3 (deep sleep mode), but it was always running at the highest possible frequency. I followed the instructions in [[How_to_make_use_of_Dynamic_Frequency_Scaling|How to make use of Dynamic Frequency Scaling]] and the noise disappeared except for a short time during boot until frequency scaling has been loaded.<br />
<br />
===Change the timer interrupt frequency===<br />
<br />
Change the "HZ" kernel constants to alter the frequency of timer interrupts. Discussion:<br />
<br />
{{NOTE|The timer interrupt frequency (HZ) in current Linux kernels is directly tied to the kernel task scheduler. Lower frequencies provide larger time-slices and thus also higher latencies (which may kill latency-sensitive applications like audio processing). 100Hz ended up as the recommended "server" setting (because it increases disk/CPU throughput in a latency-insensitive environment). Higher frequencies are better for latency-sensitive applications, and improve desktop responsivity at the cost of less processor throughput. 1000Hz ended up as the recommended "desktop" setting.}}<br />
<br />
*Andreas Karnahl: i've read in several forums it has something to do with the "idle"-state (or "C3") of the processor. There is a frequency called "timer interrupt" (or so mething like that). Since kernel 2.6x it is set to 1000 Hz by default (compared to 100 Hz in Kernel 2.4x). The exact reason i don't know, but it is safe to change this frequency to 100 Hz in kernel 2.6x (by the way, windows up to XP uses 100 Hz by default).<br />Just do the following:<br /><br />
: In {{path|[path to kernel-sources]/include/asm-i386/param.h}} find the line<br />
:: <code>#define HZ 1000</code><br />
: and change the value of HZ to 100: <br />
:: <code>#define HZ 100</code><br />
:Then recompile the kernel.<br />After i changed it on my ThinkPad {{A30}} (under SuSE 9.2 and 9.3) and recompiling the kernel the high pitch noise is gone away.<br />
<br />
* Omar Yasin: Worked on my {{R52}}, thanks.<br />
<br />
* [[User:Thinker|Thinker]]: In modern kernels this constant is in the kernel configuration {{kernelconf|CONFIG_HZ|Processor type and features||Timer Frequency|||||}}.<br />
<br />
* [[User:sklnd|sklnd]]: As of 2.6.21, enabling a tickless kernel (CONFIG_NO_HZ) seems to fix the sound issue on the X60. This also has the added benefit of causing the kernel to wake up less, which will improve battery life.<br />
<br />
===Prevent idling===<br />
<br />
Indirectly avoid power saving states by making sure the CPU is rarely idle:<br />
<br />
* Paul RIVIER: Here is a really simple workaround. C3 / C4 states are mainly called when the cpu freq is higher than required, for example if your cpufreqd is lazy to slow down the frequency but quick to raise it. That is why I use powernowd with the builtin "passive" mode, which is lazy for raising frequency, but quick to go back to the lowest. Now I don't hear them as often as before, as I avoid C3/C4 states at high frequency.<br />
<br />
* The problem also occurs on my {{X41}} with 2.6.11. Setting up [[How to make use of Dynamic Frequency Scaling|frequency scaling]] with the <code>ondemand</code> governor makes things a lot better, as the processor does not stay with the maximum frequency when in idle mode. It can be still heard sometimes, though.<br />
<br />
* On a {{T43}} the noise was gone after dropping cpufreqd and switching to the ondemand governor - maybe because of the high sampling rate? (used the default: 10ms)<br />
<br />
===Change the processor voltage===<br />
<br />
Reducing the processor voltage (when possible) may decrease or eliminate the noise. On one ThinkPad {{T43}}, [[Pentium M undervolting and underclocking|undervolting the Pentium M processor]] eliminated the high-pitched noise. Compared to the other solutions this has the benefit of lower power consumption, both due to the undervolting itself and because there is no need to forbid high APCI CPU power saving modes.<br />
<br />
===Kernel BIOS options===<br />
<br />
Adding acpi_sleep=s3_bios and pci=bios as boot parameters significantly reduced the pitch noise on a T61. Seems to be the best solution so far, without losing battery capacity. If ondemand governor is enabled as well, the noise is almost gone.--[[User:Mozz|Mozz]] 13:14, 18 January 2008 (CET)<br />
<br />
===Kernel Update===<br />
<br />
The recent kernel update in Ubuntu 8.04 from 2.6.24-19 to 2.6.24-21 made the noise disappear on my T61. With the old kernel the sound was very audible when running on battery power, although setting the kernel BIOS options as specified in the paragraph above made it somewhat bearable. Now I can barely hear anything with the default startup options, even with my ear close to the laptop.<br />
<br />
==Solutions for screen brightness related sounds==<br />
<br />
===Disable BIOS brightness control===<br />
<br />
The sound starts when on batteries as the BIOS automatically reduces screen brightness. To disable this, simply switch Config>Display>Brightness from<br />
Normal to High. See also [[User:Piccobello/Hissing sound on battery|here]].<br />
<br />
==Other solutions==<br />
<br />
===Disable UltraBay===<br />
*Naheed Vora: My {{T41}} (2373-268) started to give high pitch noise ocassionally, when I upgraded to 2.6.11 kernel. I tried to unload lot of modules but finally figured out that disabling bay stops the noise. If you have [[ibm-acpi]], do (need a cleaner solution): {{cmduser|echo eject >/proc/acpi/ibm/bay}} .<br />
<br />
===Disable IrDA===<br />
*Mike Perry: I was able to cure an intermittent high-pitched whine on both my {{X24}} and {{X40}} by disabling the Infrared port.<br />
<br />
===Disable the Linuxant Modem Driver===<br />
*Joern Heissler: I made another experience. I played around with linuxant conexant [[Modem Devices|modem]] drivers. After loading them I got some noise on my {{T42p}}.<br />
<br />
===Media Player paused===<br />
*Eilif Muller: On my {{R52}} the high-pitched noises go away if I load XMMS, play something then pause it.<br />
*Jacob: On my {{T43}} DGU it goes away if I open mplayerc.exe and press play then pause it. This is the high-pitched noise that only shows up when I'm on battery.<br />
*butcom: On my {{X60 Tablet}}, this tip works in Windows as well with Media Player Classic or Windows Media Player. Just open either program, start playing any music file and pause it and the screeching noise stops.<br />
<br />
''I'd guess that the above tip works as when xmms or similar is running, it is uncompressing compressed audio/video, which is a processor intensive action. Keeping this paused means that the app won't 'let go' of the processor, forcing it to stay up and running, which stops it entering the higher powersave modes.''<br />
<br />
===nice yes===<br />
<br />
Run the command: <br />
{{cmduser|nice yes > /dev/null}}.<br />
<br />
This is a good way to test whether the processor is causing the interference, since it forces the CPU to stay at full power. Of course, this will make your system get warm, and probably turn on the fan, as well as eating power.<br />
<br />
===Upgrade BIOS===<br />
On a ThinkPad {{X60s}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 1.06 eliminated the high pitch noise when running on battery.<br />
<br />
On a ThinkPad {{X61}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 2.21 reduces the noise. It's not completely eliminated though.<br />
<br />
On a ThinkPad {{R60}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 2.19 eliminated the voice also.<br />
<br />
===Disable USB===<br />
Disabling USB (partially) using {{cmdroot|rmmod uhci_hcd}} significantly reduced the noise in some cases.<br />
Reported on {{T43}}, {{T61}}, {{X60}}, {{X200s}}<br />
On a {{T60}} this trick worked well and doing ''rmmod/modprobe'' twice wiped the noise permanently.<br />
<br />
This is likely a CPU-induced noise case, as disabling USB UHCI will reduce a lot the amount of busmaster activity while the computer is idle, and thus has a direct effect on the need for ACPI C-state transitions from C3/C4 to C2 or lower states.<br />
<br />
<br />
*syscrash: Plugging in my USB mouse has completely solved the problem for me.<br />
*lorien: Plugging USB mouse helped me too {{T61}}<br />
*telofy: Disabling USB "solved" the problem; so does disabling the CPU idle setting in the BIOS on my X200s.<br />
<br />
===Suspend USB===<br />
*Stefan Ott: On my X41, the noise seems to have stopped since I enabled "USB selective suspend/resume and wakeup" (CONFIG_USB_SUSPEND).<br />
*babrodtk: This approach worked with an R60 as well.<br />
<br />
===Turn off fan===<br />
On a ThinkPad {{T60p}}, changing the fan speed or turning off the fan using TP Fan Control eliminated the high pitch noise.</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Problem_with_high_pitch_noises&diff=55271Problem with high pitch noises2014-01-22T02:05:43Z<p>Maikel: /* Turn off CPU power saving in the BIOS */ adding X200s as working model</p>
<hr />
<div>Information on strange high pitch, low volume noises emitted by ThinkPads.<br />
<br />
==Problem description==<br />
Even though ThinkPads are known as very silent notebooks, they tend to emit different, mostly high pitch noises in certain circumstances. The noises are of low volume and hence not realized by everyone or at least tolerated by most people. However, there are those with "bat like ears" that hear them and might be annoyed by that.<br />
<br />
==Affected Models==<br />
Noises have been experienced in the following situations:<br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|-<br />
! style="vertical-align:top;background-color:#DDDDDD;" | situation<br />
! style="vertical-align:top;background-color:#DDDDDD;" | noise description<br />
! style="vertical-align:top;background-color:#DDDDDD;" | affected models<br />
|-<br />
| style="vertical-align:top;" |<br />
Plugged into AC / running at high CPU frequency<br />
| style="vertical-align:top;" |<br />
soft crackling, buzzing noise<br />
| style="vertical-align:top;" |<br />
*{{T41}}<br />
**2379-DJU<br />
|-<br />
| style="vertical-align:top;" |<br />
ThinkPad suspended to RAM<br />
| style="vertical-align:top;" |<br />
constant high pitch noise<br />
| style="vertical-align:top;" |<br />
*{{T42p}}<br />
|-<br />
| style="vertical-align:top;" |<br />
ThinkPad connected to power and switched off, with battery fully charged<br />
| style="vertical-align:top;" |<br />
constant high pitch noise<br />
| style="vertical-align:top;" |<br />
*{{T41p}}<br />
**2373-GHG<br />
|-<br />
| style="vertical-align:top;" |<br />
moving windows or just the mouse in xorg<br />
| style="vertical-align:top;" |<br />
strange noise like a rapid series of very short high pitch noises adding to a constant kind of whistling (only as long as the movement goes)<br />
| style="vertical-align:top;" |<br />
*{{A21m}}<br />
**2628<br />
*{{T41p}}<br />
**2373-GHG<br />
*{{T60}}<br />
|-<br />
| style="vertical-align:top;" |<br />
Thinkpad connected to power or working on battery, also when suspended to RAM<br />
| style="vertical-align:top;" |<br />
High pitch noise also when HD is powered down.<br />
| style="vertical-align:top;" |<br />
*{{T23}}<br />
**2647-DG4<br />
*{{X24}}<br />
**2662-MWG<br />
|-<br />
| style="vertical-align:top;" |<br />
Thinkpad connected to power battery charged less than 60%<br />
| style="vertical-align:top;" |<br />
High pitch noise till battery is charged more than 60%.<br />
| style="vertical-align:top;" |<br />
*{{T41p}}<br />
**2373-GEG<br />
|-<br />
| style="vertical-align:top;" |<br />
Constantly, if AC connected<br />
| style="vertical-align:top;" |<br />
High pitched, low volume constant noise.<br />
| style="vertical-align:top;" |<br />
*{{T40}}<br />
**2373-88U<br />
|-<br />
| style="vertical-align:top;" |<br />
When the CPU freq jumps up to 1Ghz or above, or when the laptop is in suspend mode<br />
| style="vertical-align:top;" |<br />
Constant high pitched<br />
| style="vertical-align:top;" |<br />
*{{R50}}<br />
**1829-6DM<br />
|-<br />
| style="vertical-align:top;" |<br />
(May come from harddisk.)<br />
| style="vertical-align:top;" |<br />
continuous, intermittent, low volume, high pitched<br />
| style="vertical-align:top;" |<br />
*{{600X}}<br />
|-<br />
| style="vertical-align:top;" |<br />
ACPI puts the processor into the C3 or C4 power saving states (i.e., the system is idle).<br />
| style="vertical-align:top;" |<br />
High-pitched crackling noise.<br />
| style="vertical-align:top;" |<br />
*{{X61}}<br />
**7673-B56<br />
*{{X41}}<br />
*{{T43}}<br />
**2686-DGU<br />
*{{T43p}}<br />
*{{T60}}<br />
**2007-72U<br />
*{{T21}}<br />
*{{T20}}<br />
**2648-46U<br />
|-<br />
| style="vertical-align:top;" |<br />
Cpufreqd (or powernowd etc.) slows down the processor, for exemple at the end of an heavy task.<br />
| style="vertical-align:top;" |<br />
High-pitched crackling noise.<br />
| style="vertical-align:top;" |<br />
*{{T42}}<br />
|-<br />
| style="vertical-align:top;" |<br />
When on battery<br />
| style="vertical-align:top;" |<br />
Noise level varies from inaudible to clearly audible, screeching sound, or sometimes beeping (when wifi is on). <br />
| style="vertical-align:top;" |<br />
*{{A21m}}<br />
**2628<br />
*{{R51}}<br />
**EHG-1829<br />
*{{R52}}<br />
**1858-A11<br />
**1846-B5G<br />
*{{R60}}<br />
**9461-DXG<br />
**9462-77G<br />
**9456-HTG<br />
**9461-DXG<br />
*{{R60e}}<br />
**0657-A9G<br />
**0657-3LG<br />
*{{T43}}<br />
**2686-DGU<br />
**1871-4AG<br />
*{{T60}}<br />
**2007-72U<br />
**1951-24G<br />
**1951-24G<br />
**2007-49G<br />
**2007-FUG<br />
*{{T60p}}<br />
**2007-FBG<br />
*{{T61}}<br />
**7659-12G<br />
**8898-5FG<br />
**6463-9WG<br />
*{{x60}}<br />
*{{x31}}<br />
**2673-CBU<br />
*{{Z61m}}<br />
**9450-3HG<br />
**9452-128<br />
**9452-W5Q<br />
*{{Z61t}}<br />
**9440-2QU<br />
<br />
|-<br />
| CPU is used much AND laptop is on AC power AND the TFT panel is enabled.<br />
| Screetching high pitch noise, like a million crickets<br />
| <br />
* {{X41}}<br />
<br />
|-<br />
| Network is pluged in and networkload is ~100%.<br />
| low volume highfreq. pitch noise from left speaker or cpu.<br />
|<br />
*{{Z60m}}, {{Z60t}}<br />
*{{T40}}<br />
*{{T43}}<br />
**2687-DDU<br />
<br />
|-<br />
| Constant, but is louder when Tablet Pen is near screen, on battery power<br />
| high pitch noise, screeching sounds *solved by "Media player paused" (see below) and also by BIOS versions 1.05 and later.<br />
|<br />
*{{X60_Tablet}}<br />
**6366-4DU<br />
<br />
|-<br />
| When fan is running on some speeds. Turning off fan stops pitch noise instandly.<br />
| High pitch noise ("CPU whining"). <br />
|<br />
*{{T60p}}<br />
**2007-83G<br />
|}<br />
<br />
==Affected Operating Systems==<br />
All, though Linux appears especially susceptible.<br />
<br />
==Possible sources==<br />
<br />
* '''CPU activity:''' On some models the noise is triggered by certain CPU power states or activity patterns (as proven [http://www.wisdom.weizmann.ac.il/~tromer/acoustic here]).<br />
* '''Graphics processor:''' In some models from the T2x era, e.g. the {{T23}}, the problem was related to the graphics circuitry and occured especially or only while making use of DirectDraw functions. IBM was able to fix it through a BIOS upgrade.<br />
* '''Hard disk:''' On some ThinkPads the processor and hard disk are adjacent and produce similar noise. For example, in the {{X41}} the sound generated by the hard disk is likely to be loudest at the vent.<br />
* '''Gigabit Ethernet processor:''' In some models (e.g., {{T43}}) high ethernet activity causes a high pitch noise.<br />
* '''Screen brightness:''' on an {{X31}}, a hissing sound is started whenever screen brightness is not full.<br />
* '''Power supply:''' a T61p is known to have the sound if a 90W power supply revision 01 is used. An alternative power supply of an other manufacturer did not make the laptop noisy.<br />
<br />
==Status==<br />
<br />
The problem is highly specific to operating system, model and even individual machines. There is no universal solution, but on most machines one of the following will reduce or eliminate the noise (possibly at some cost in power consumption).<br />
<br />
==Solutions for CPU-triggered noise==<br />
<br />
===Limit ACPI CPU power states===<br />
<br />
By default, the kernel supports up to eight ACPI CPU power saving states (C-states), called C1 through C8 (but the ThinkPad BIOS and hardware often offers (or remaps them to) only C1 to C4). Often only the extreme power saving modes C4 or C3 produce the noise, so the noise can be stopped by instructing the Linux ACPI code to use only lower modes. This has a cost, though: disabling C3 and C4 will make the CPU consume more power and reduce battery life. <br />
<br />
To forbid the ACPI driver from using C4 (this fixed the problem with on some ThinkPad {{T43}}, {{T43p}} and {{T41}}):<br />
* If the ACPI processor component is compiled as built-in (<tt>CONFIG_ACPI_PROCESSOR=y</tt>):<br />
**Pass the {{bootparm|processor.max_cstate|3}} kernel argument.<br />
* If the ACPI processor component is loaded as a module (<tt>CONFIG_ACPI_PROCESSOR=m</tt> and <tt>processor</tt> shows in the output of {{cmdroot|lsmod}}), do either of:<br />
** Pass the {{bootparm|processor.max_cstate|3}} kernel argument (this does not work in Ubuntu 5.10 with default kernel).<br />
** Add <code>options processor max_cstate=3</code> to {{path|/etc/modprobe.conf}} (or {{path|/etc/modprobe.conf.local}}, or {{path|/etc/modprobe.d/...}}, depending on your system) (this does not work in Ubuntu 5.10 with default kernel).<br />
** {{cmdroot|echo 3 > /sys/module/processor/parameters/max_cstate}} (this can be changed in runtime for experimentation). (If may need to be set again upon resume from suspend, e.g., in the wakeup script.)<br />
** (On Ubuntu 5.10, the default kernel uses <code>processor</code> as a module. Unfortunately, the script loading it, {{path|/etc/init.d/acpid}}, ignores the <code>options processor max_cstate=3</code> setting in {{path|/etc/modprobe.d/<my file>}}. As a solution for this specific problem, add the line <code>echo 2 > /sys/module/processor/parameters/max_cstate</code> directly to {{path|/etc/init.d/acpid}}, at the end of the function <code>load_modules()</code>, immediately after the line <code>echo "$PRINTK" > /proc/sys/kernel/printk</code>.)<br />
** On Gentoo: Configure your Thinkpad as described in the [http://www.gentoo.org/doc/en/power-management-guide.xml Power Management Guide]. Then as root create the files {{path|/etc/init.d/limit-sleep-states}} and {{path|/etc/conf.d/limit-sleep-states}} as below. After that just issue the command {{cmdroot|rc-update add limit-sleep-states default}} to limit the sleep states only when running on AC power, or {{cmdroot|rc-update add limit-sleep-states default battery}} to always limit the sleep states.<br />
cat <<EOF > /etc/init.d/limit-sleep-states<br />
#!/sbin/runscript<br />
<br />
depend() {<br />
need acpid<br />
}<br />
<br />
start() {<br />
ebegin "Limiting CPU sleep state to C${LIMIT_CSTATE}"<br />
echo $LIMIT_CSTATE > /sys/module/processor/parameters/max_cstate<br />
eend $?<br />
}<br />
<br />
stop() {<br />
ebegin "Removing CPU sleep state limit"<br />
echo $REMOVE_CSTATE > /sys/module/processor/parameters/max_cstate<br />
eend $?<br />
}<br />
EOF<br />
<br />
cat <<EOF > /etc/conf.d/limit-sleep-states<br />
# limit CPU sleep state to the following value (adjust accordingly)<br />
LIMIT_CSTATE=3<br />
# some value which is higher than all available sleep states<br />
REMOVE_CSTATE=8<br />
EOF<br />
<br />
To also forbid the C3 state, replace "<tt>3</tt>" with "<tt>2</tt>" above (this fixed the problem on some ThinkPad {{X40}}, {{X41}}, {{X60}}, {{T60}}, {{T61}}, {{Z61t}} and {{R52}}, as well as on {{T20}} where C4 is not supported at all).<br />
<br />
Note that these options affect power consumption when the CPU is idle. For example, here is the [[How to measure power consumption|measured power consumption]] on a ThinkPad {{T43}}:<br />
* {{bootparm|processor.max_cstate|4}}: 15160mW (default, noisy)<br />
* {{bootparm|processor.max_cstate|3}}: 15770mW (660mW higher, silent)<br />
* {{bootparm|processor.max_cstate|2}}: 16100mW (2940mW higher, silent)<br />
<br />
One can control how often Linux tries to enter the C3 state by using the {{bootparm|processor.bm_history|<bitmask>}} parameter on kernels with a scheduler frequency below 800Hz (and if you have noise problems, you really should not be running the kernel at 1000Hz...). Setting {{bootparm|processor.bm_history|0xFFFFFFFF}} will cause C3 to be entered less often. This will waste more power as the CPU won't do C3 or C4 as often, but at least it doesn't forbid C3 and C4 permanently, unlike {{bootparm|max_cstate|2}}.<br />
<br />
See the [http://thinkwiki.org/wiki?title=Talk:Problem_with_high_pitch_noises discussion page] for further information and success reports.<br />
<br />
*Jakob Schou Pedersen: Editing the file {{path|/etc/init.d/acpid}} as described above (the last solution) worked on my T43 :-)<br />
<br />
===MS Windows: Disable CPU popup mode ===<br />
<br />
This is a generic solution for Core 2 Duo platforms --- using the RMClock utility you can disable C4 to C1/C2/C3 transition and force the CPU to go straight to C0. To do this, in RMClock settings go to: "Enable Advanced CPU settings > Chipset" and disable at least "Enable Popup Mode". Related discussion can be found here: [[http://forum.thinkpads.com/viewtopic.php?f=30&t=75283]].<br />
<br />
===Turn off CPU power saving in the BIOS===<br />
<br />
Go into the BIOS and turn off the power saving processor feature that puts it into idle mode. This should be somewhere under Config/Power - look for "CPU Power Management", the default being automatic. Set "CPU Power Management" to "Disabled" (This worked on a ThinkPad {{T21}}, {{T43}}, {{T60}}, {{X60s}}, {{X200s}} and {{Z61m}}). However, this also affects power consumption when the CPU is idle, it's similar to disabling the C4/C3 ACPI CPU power state. For example, on a Z61m 9450-3HG, a full charged battery with power management enabled in the BIOS provides the notebook with power for about 3.5h, if disabled, the battery-lifetime is only about 2h.<br />
<br />
===Disable ACPI CPU power states===<br />
<br />
Completely disable CPU ACPI power states. Discussion:<br />
<br />
*From Martin Steigerwald: I made the observation that I get at least less high pitch noises on my {{T23}} when I do not use the two ACPI modules "processor" and "thermal" (depends on the first one). I have no clue, why. Anyone with similar experiences?<br />
:Omar Yasin: I've got a {{R52}} and when I load the same ACPIO modules the high pitch noises are not as loud but I can still hear them.<br />
*Kaspar Schleiser: On my {{T23}} the noise is less loud when setting max_cstate to 2, but to completely silence it, I have to set it to "1". Is that the same as removing the "processor"-module? "cat /proc/acpi/battery/BAT0/state" does not show increased power drain.<br />
*Niko Ehrenfeuchter: I'm experiencing the same here on my {{X24}}. Removing the "processor" module also stops the pitch noise, which does ONLY occur when setting the CPU to maximum speed (using cpufreq). On low speed it's completely silent, even having loaded the processor module.<br />
<br />
*Rolf Adelsberger: I can confirm this: the high pitch noise is only remarkable (at least with my ears ;-) ) if the processor speed is set to maximum frequency.<br />
<br />
*Stefan Baums: My {{X41}} produced a high-pitched crackle from the processor vent on the left. Changing HZ did nothing, and the 'processor' module could not easily be removed from the system (Ubuntu 5.04). What solved the problem for me was adding {{bootparm|idle|halt}} to the boot command line. Unfortunately, this solution only lasts until the first hibernation or suspend - when the computer ({{X41}}) resumes, the high-pitched crackle is back.<br />
<br />
* The {{bootparm|idle|halt}} solution combined with setting <code>#define HZ 100</code> in the kernel fixes the problem on a {{T43}}.<br />
<br />
* jhatch: {{bootparm|idle|halt}} plus <code>#define HZ 100</code> also worked on my {{T43}}. It still reverts back to noisy after a suspend/resume though. This needs to be fixed...<br />
<br />
===Use both C-States (sleep modes) and P-States (frequency scaling)===<br />
*Max Gaukler: I had the problem with a "beeping" noise of my {{R60}} on battery. When using powertop I recognised that it went into C3 (deep sleep mode), but it was always running at the highest possible frequency. I followed the instructions in [[How_to_make_use_of_Dynamic_Frequency_Scaling|How to make use of Dynamic Frequency Scaling]] and the noise disappeared except for a short time during boot until frequency scaling has been loaded.<br />
<br />
===Change the timer interrupt frequency===<br />
<br />
Change the "HZ" kernel constants to alter the frequency of timer interrupts. Discussion:<br />
<br />
{{NOTE|The timer interrupt frequency (HZ) in current Linux kernels is directly tied to the kernel task scheduler. Lower frequencies provide larger time-slices and thus also higher latencies (which may kill latency-sensitive applications like audio processing). 100Hz ended up as the recommended "server" setting (because it increases disk/CPU throughput in a latency-insensitive environment). Higher frequencies are better for latency-sensitive applications, and improve desktop responsivity at the cost of less processor throughput. 1000Hz ended up as the recommended "desktop" setting.}}<br />
<br />
*Andreas Karnahl: i've read in several forums it has something to do with the "idle"-state (or "C3") of the processor. There is a frequency called "timer interrupt" (or so mething like that). Since kernel 2.6x it is set to 1000 Hz by default (compared to 100 Hz in Kernel 2.4x). The exact reason i don't know, but it is safe to change this frequency to 100 Hz in kernel 2.6x (by the way, windows up to XP uses 100 Hz by default).<br />Just do the following:<br /><br />
: In {{path|[path to kernel-sources]/include/asm-i386/param.h}} find the line<br />
:: <code>#define HZ 1000</code><br />
: and change the value of HZ to 100: <br />
:: <code>#define HZ 100</code><br />
:Then recompile the kernel.<br />After i changed it on my ThinkPad {{A30}} (under SuSE 9.2 and 9.3) and recompiling the kernel the high pitch noise is gone away.<br />
<br />
* Omar Yasin: Worked on my {{R52}}, thanks.<br />
<br />
* [[User:Thinker|Thinker]]: In modern kernels this constant is in the kernel configuration {{kernelconf|CONFIG_HZ|Processor type and features||Timer Frequency|||||}}.<br />
<br />
* [[User:sklnd|sklnd]]: As of 2.6.21, enabling a tickless kernel (CONFIG_NO_HZ) seems to fix the sound issue on the X60. This also has the added benefit of causing the kernel to wake up less, which will improve battery life.<br />
<br />
===Prevent idling===<br />
<br />
Indirectly avoid power saving states by making sure the CPU is rarely idle:<br />
<br />
* Paul RIVIER: Here is a really simple workaround. C3 / C4 states are mainly called when the cpu freq is higher than required, for example if your cpufreqd is lazy to slow down the frequency but quick to raise it. That is why I use powernowd with the builtin "passive" mode, which is lazy for raising frequency, but quick to go back to the lowest. Now I don't hear them as often as before, as I avoid C3/C4 states at high frequency.<br />
<br />
* The problem also occurs on my {{X41}} with 2.6.11. Setting up [[How to make use of Dynamic Frequency Scaling|frequency scaling]] with the <code>ondemand</code> governor makes things a lot better, as the processor does not stay with the maximum frequency when in idle mode. It can be still heard sometimes, though.<br />
<br />
* On a {{T43}} the noise was gone after dropping cpufreqd and switching to the ondemand governor - maybe because of the high sampling rate? (used the default: 10ms)<br />
<br />
===Change the processor voltage===<br />
<br />
Reducing the processor voltage (when possible) may decrease or eliminate the noise. On one ThinkPad {{T43}}, [[Pentium M undervolting and underclocking|undervolting the Pentium M processor]] eliminated the high-pitched noise. Compared to the other solutions this has the benefit of lower power consumption, both due to the undervolting itself and because there is no need to forbid high APCI CPU power saving modes.<br />
<br />
===Kernel BIOS options===<br />
<br />
Adding acpi_sleep=s3_bios and pci=bios as boot parameters significantly reduced the pitch noise on a T61. Seems to be the best solution so far, without losing battery capacity. If ondemand governor is enabled as well, the noise is almost gone.--[[User:Mozz|Mozz]] 13:14, 18 January 2008 (CET)<br />
<br />
===Kernel Update===<br />
<br />
The recent kernel update in Ubuntu 8.04 from 2.6.24-19 to 2.6.24-21 made the noise disappear on my T61. With the old kernel the sound was very audible when running on battery power, although setting the kernel BIOS options as specified in the paragraph above made it somewhat bearable. Now I can barely hear anything with the default startup options, even with my ear close to the laptop.<br />
<br />
==Solutions for screen brightness related sounds==<br />
<br />
===Disable BIOS brightness control===<br />
<br />
The sound starts when on batteries as the BIOS automatically reduces screen brightness. To disable this, simply switch Config>Display>Brightness from<br />
Normal to High. See also [[User:Piccobello/Hissing sound on battery|here]].<br />
<br />
==Other solutions==<br />
<br />
===Disable UltraBay===<br />
*Naheed Vora: My {{T41}} (2373-268) started to give high pitch noise ocassionally, when I upgraded to 2.6.11 kernel. I tried to unload lot of modules but finally figured out that disabling bay stops the noise. If you have [[ibm-acpi]], do (need a cleaner solution): {{cmduser|echo eject >/proc/acpi/ibm/bay}} .<br />
<br />
===Disable IrDA===<br />
*Mike Perry: I was able to cure an intermittent high-pitched whine on both my {{X24}} and {{X40}} by disabling the Infrared port.<br />
<br />
===Disable the Linuxant Modem Driver===<br />
*Joern Heissler: I made another experience. I played around with linuxant conexant [[Modem Devices|modem]] drivers. After loading them I got some noise on my {{T42p}}.<br />
<br />
===Media Player paused===<br />
*Eilif Muller: On my {{R52}} the high-pitched noises go away if I load XMMS, play something then pause it.<br />
*Jacob: On my {{T43}} DGU it goes away if I open mplayerc.exe and press play then pause it. This is the high-pitched noise that only shows up when I'm on battery.<br />
*butcom: On my {{X60 Tablet}}, this tip works in Windows as well with Media Player Classic or Windows Media Player. Just open either program, start playing any music file and pause it and the screeching noise stops.<br />
<br />
''I'd guess that the above tip works as when xmms or similar is running, it is uncompressing compressed audio/video, which is a processor intensive action. Keeping this paused means that the app won't 'let go' of the processor, forcing it to stay up and running, which stops it entering the higher powersave modes.''<br />
<br />
===nice yes===<br />
<br />
Run the command: <br />
{{cmduser|nice yes > /dev/null}}.<br />
<br />
This is a good way to test whether the processor is causing the interference, since it forces the CPU to stay at full power. Of course, this will make your system get warm, and probably turn on the fan, as well as eating power.<br />
<br />
===Upgrade BIOS===<br />
On a ThinkPad {{X60s}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 1.06 eliminated the high pitch noise when running on battery.<br />
<br />
On a ThinkPad {{X61}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 2.21 reduces the noise. It's not completely eliminated though.<br />
<br />
On a ThinkPad {{R60}}, [[BIOS_Upgrade|upgrading the BIOS]] to version 2.19 eliminated the voice also.<br />
<br />
===Disable USB===<br />
On one {{T43}} and one {{X60}}, (partially) disabling USB using {{cmdroot|rmmod uhci_hcd}} significantly reduced the noise. Also, on a {{T60}} this trick worked well, doing ''rmmod/modprobe'' twice wiped the noise permanently.<br />
<br />
This is likely a CPU-induced noise case, as disabling USB UHCI will reduce a lot the amount of busmaster activity while the computer is idle, and thus has a direct effect on the need for ACPI C-state transitions from C3/C4 to C2 or lower states in a {{T43}} or {{X60}}.<br />
<br />
*syscrash: Plugging in my USB mouse has completely solved the problem for me.<br />
*lorien: Plugging USB mouse helped me too {{T61}}<br />
*telofy: Disabling USB "solved" the problem; so does disabling the CPU idle setting in the BIOS on my X200s.<br />
<br />
===Suspend USB===<br />
*Stefan Ott: On my X41, the noise seems to have stopped since I enabled "USB selective suspend/resume and wakeup" (CONFIG_USB_SUSPEND).<br />
*babrodtk: This approach worked with an R60 as well.<br />
<br />
===Turn off fan===<br />
On a ThinkPad {{T60p}}, changing the fan speed or turning off the fan using TP Fan Control eliminated the high pitch noise.</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Tp_smapi&diff=55264Tp smapi2014-01-17T03:51:26Z<p>Maikel: /* Installation on Debian */ typo</p>
<hr />
<div>{| width="100%"<br />
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__<br />
|style="vertical-align:top" |<br />
The <tt>tp_smapi</tt> kernel module exposes some features of the ThinkPad hardware/firmware via a <tt>sysfs</tt> interface. Currently, the main implemented functionality is control of battery charging and extended battery status. The tp_smapi software package also includes an improved version of the [[HDAPS]] driver. The underlying hardware interfaces are [[SMAPI support for Linux|SMAPI]] and direct access to the embedded controller.<br />
<br />
This driver uses undocumented features and direct hardware access, so it may work unreliably or even damage your hardware; but so far no such damage has been reported.<br />
<br />
If you are installing on a recent Thinkpad that has an Ivy Bridge processor (X230, T430, T530, etc.), tp_smapi will not work. Use thinkpad-acpi.<br />
|}<br />
<br />
===Features===<br />
*<tt>tp_smapi</tt> driver<br />
**Battery charge/discharge control<br />
**Battery status information<br />
*<tt>hdaps</tt> driver (compared with the standard <tt>hdaps</tt> driver)<br />
**Improved stability<br />
**Improved model support<br />
**Improved functionality<br />
<br />
===Project Homepage / Availability===<br />
* Project page: http://tpctl.sourceforge.net/<br />
* Download page: http://sourceforge.net/projects/tpctl/files/tp_smapi, a newer version 0.41 is available in a fork at https://github.com/evgeni/tp_smapi which is also available in Debian<br />
* You need to download only the <i>tp_smapi</i> package.<br />
<br />
===Installation===<br />
====Installation from source====<br />
You will need the kernel headers and makefiles corresponding to your current kernel version. On {{Fedora}}, this means {{cmdroot|yum install kernel-devel-$(uname -r)}} .<br />
<br />
:{{cmdroot|tar xzvf tp_smapi-0.40.tgz}}<br />
:{{cmdroot|cd tp_smapi-0.40}}<br />
<br />
Then, either compile and load the driver within the current working directory (for testing):<br />
:{{cmdroot|make load}}<br />
OR 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 matching the current kernel).<br />
Again, either load the driver within the current working directory:<br />
:{{cmdroot|1=make load HDAPS=1}}<br />
OR install into the kernel's module path:<br />
:{{cmdroot|1=make install HDAPS=1}}<br />
<br />
To prepare a stand-alone patch against the current kernel tree (including<br />
a patch against <tt>hdaps</tt> and new <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 />
====Installation in Gentoo====<br />
The {{Gentoo}} portage system carries a [http://packages.gentoo.org/package/app-laptop/tp_smapi tp_smapi package], which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.<br />
<br />
If you use the [[HDAPS]] driver, do this first:<br />
<br />
* Disable the <tt>hdaps</tt> module in your kernel configuration (Device Drivers &rarr; Hardware Monitoring Support &rarr; IBM Hard Drive Active Protection System)<br />
* Rebuild and install the kernel<br />
* Add the <tt>hdaps</tt> use flag in {{path|/etc/make.conf}}<br />
* {{cmdroot|rmmod hdaps}}<br />
<br />
Then:<br />
* {{cmdroot|emerge tp_smapi}} (or install tp_smapi with hdaps support manually, as above)<br />
* {{cmdroot|echo "tp_smapi" >> /etc/modules.autoload.d/kernel-2.6}}<br />
* {{cmdroot|echo "hdaps" >> /etc/modules.autoload.d/kernel-2.6}}<br />
<br />
Then reboot, or run:<br />
* {{cmdroot|modprobe tp_smapi}}<br />
* {{cmdroot|modprobe hdaps}}<br />
<br />
'''NOTE:''' If {{cmdroot|modprobe}} fails and dmesg says something about <tt>__stack_chk_fail()</tt>, you probably just compiled your modules with <tt>-fstack-protector</tt> and/or <tt>-fstack-protector-all</tt> without having a kernel that supports it. You can either configure your kernel to have <tt>CC_STACKPROTECTOR</tt> enabled (in ''Processor type and features'' if you use {{cmdroot|make menuconfig}}) or edit your <tt>make.conf</tt> (or, if you're using paludis, your <tt>/etc/paludis/bashrc</tt>) and remove <tt>-fstack-protector</tt> and <tt>-fstack-protector-all</tt> from your <tt>CFLAGS</tt>. If you choose to enable it in the kernel, be aware that you need a patched GCC for it (and I do not know if the gcc in stage3 is patched).<br />
<br />
<br />
====Installation on Debian====<br />
You can use 'dkms' on Debian 7 stable (wheezy) or oldstable (squeeze) (kernel >=2.6.32-5). (Note: If installation seems ineffective, confirm you have the linux-headers of your kernel installed, purge tp-smapi-dkms and reinstall.)<br />
* {{cmdroot|aptitude install linux-headers tp-smapi-dkms}}<br />
<br />
=====Installation on Debian from source=====<br />
Since Debian 5 (lenny) also the [http://packages.debian.org/tp-smapi packaged module source] is available.<br />
You can build tp_smapi with module-assistant:<br />
* {{cmdroot|aptitude install tp-smapi-source}}<br />
* {{cmdroot|m-a -t a-i tp-smapi}}<br />
<br />
=====Installation on Debian 5 (lenny)=====<br />
In Debian 5 (lenny) are also the prebuilt modules for Debian kernels.<br />
If you use a stock Debian kernel, you can install the tp_smapi modules with:<br />
* {{cmdroot|apt-get install tp-smapi-modules-`uname -r`}}<br />
* in order to make sure the modules package is kept in sync with the kernel one, you may also want to install the <code>tm-smapi-modules-2.6-686</code> or <code>tm-smapi-modules-2.6-amd64</code> package, depending on your architecture<br />
<br />
====Installation on openSUSE====<br />
openSUSE provides rpm packages. Look for them at the package search: [http://software.opensuse.org/search/], search for the package named "tp_smapi".<br />
<br />
A step-by-step guide on how a relative linux newbie installed tp_smapi on a Thinkpad W500 running openSuse 11.1 using YAST Software Manager is available [http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932 here]<br />
<br />
In case you are taking the hard way around, while compiling on 11.0, make complained about not being able to locate the kernel sources. It worked for me after I did this:<br />
<pre><nowiki>cp /usr/include/linux/aio_abi.h /lib/modules/`uname -r`/build/include/linux/</nowiki></pre><br />
<br />
====Installation on Ubuntu====<br />
Ubuntu ships tp_smapi in their <tt>linux-ubuntu-modules-*</tt> package for Hardy, so you don't have to build it yourself. Please note that they have renamed tp_smapi's modified <tt>hdaps</tt> module to <tt>hdaps_ec</tt> so that the two can coexist. You should load <tt>hdaps_ec</tt>, not <tt>hdaps</tt>.<br />
<br />
Ubuntu Intrepid and Jaunty, however, lack the <tt>hdaps_ec</tt> module, as reported [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/297213 here]. It will not be included again until said [[#Bundled hdaps driver|bundled hdaps driver]] is merged into mainline.<br />
<br />
=====Installation on Ubuntu Jaunty=====<br />
I have posted my experiences [http://meandmyubuntu.blogspot.com/2009/05/getting-hdasp-to-work-on-jaunty.html here]<br />
<br />
=====Installation on Ubuntu Karmic=====<br />
Ubuntu does not ship the precompiled module tp_smapi any more. However the source code is still present in the repository. It can be installed through module-assistant :<br />
:{{cmdroot|aptitude install tp-smapi-source}}<br />
:{{cmdroot|module-assistant prepare tp-smapi}}<br />
:{{cmdroot|module-assistant auto-install tp-smapi}}<br />
:{{cmdroot|modprobe tp-smapi}}<br />
<br />
=====Installation on Ubuntu Lucid=====<br />
The Karmic solution above works well.<br />
<br />
As an alternative, one can use the dkms flavour of the packages via<br />
:{{cmdroot|aptitude install tp-smapi-dkms}}<br />
:{{cmdroot|modprobe tp_smapi}}<br />
<br />
{{HINT|This appears to be the ideal solution. A description of DKMS, from [http://linux.dell.com/projects.shtml#dkms Dell]: "DKMS stands for Dynamic Kernel Module Support. It is designed to create a framework where kernel dependent module source can reside so that it is very easy to rebuild modules as you upgrade kernels."}}<br />
<br />
====Installation on older Ubuntu/Debian====<br />
Installation on Ubuntu or Debian is quite easy, but there are a few things to look after:<br />
<br />
To get your system ready for compiling code, install the build-essentials (as root, of course, as all of the following comands; Ubuntu users have to prepend 'sudo' to every line and enter their own password when prompted):<br />
<pre><nowiki>apt-get install build-essential</nowiki></pre><br />
<br />
To get tp_smapi to work, obtain the latest source as mentioned above and unpack it. If you want to use HDAPS, you need to install the kernel source matching te kernel you are running. To do so, issue this:<br />
<pre><nowiki>uname -r</nowiki></pre><br />
This will give you the version of your current kernel. <br />
Debian users execute the following:<br />
<pre><nowiki>apt-get install linux-source-`uname -r`</nowiki></pre><br />
Ubuntu users execute the following using the kernel-version only (exclude -XX-generic; e.g. 'linux-source-2.6.20'):<br />
<pre><nowiki>apt-get install linux-source-`uname -r`</nowiki></pre><br />
<br />
Be sure to unpack the source file. The easiest way is to open Nautilus as root:<br />
<pre><nowiki>sudo nautilus</nowiki></pre><br />
Then browse to /usr/src/ and extract the source file to that directory.<br />
<br />
Now change to the tp_smapi dir:<br />
<pre><nowiki>cd tp_smapi-X.YY</nowiki></pre> (X.YY being the version-number of [[tp_smapi]])<br />
and make and install tp_smapi as instructed above.<br />
<br />
If you get an error that the kernel version isn't matching (or that you need to set KSRC/KBUILD), please check that there is a symlink from the modules dir to the kernel source:<br />
<pre><nowiki>root@localhost:~#ls -l /lib/modules/2.6.20-16-generic<br />
lrwxrwxrwx 1 root root 28 2007-02-02 08:39 build -> /usr/src/linux-source-2.6.20</nowiki></pre><br />
Create the link if the line above does not exist:<br />
<pre><nowiki>root@localhost:~#ln -s /usr/src/linux-source-2.6.20 /lib/modules/2.6.20-16-generic/build</nowiki></pre><br />
<br />
Now the following will build and install the correct modules to their locations:<br />
<pre><nowiki>make install HDAPS=1</nowiki></pre><br />
To make sure your system loads the modules at boot time, do this:<br />
<pre><nowiki>echo "tp_smapi" >> /etc/modules<br />
echo "hdaps" >> /etc/modules</nowiki></pre><br />
and update your initramfs:<br />
<pre><nowiki>update-initramfs -u</nowiki></pre><br />
<br />
To get tp_smapi running now, just load the modules:<br />
<pre><nowiki>modprobe -a tp_smapi hdaps</nowiki></pre><br />
<br />
This description was tested on Kubuntu 'Feisty Fawn' and should work on all Debian-based distros with minor tweaks.<br />
<br />
'''EDIT:''' Works on Kubuntu 7.10 ("Gutsy Gibbon"), too<br />
<br />
===Battery charge control features===<br />
{{NOTE|Not all Thinkpad ECs support these charge control features. If you get the message "Operation not supported" when trying to cat for the status of a given parameter, it means your controller does not support that feature.}}<br />
<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 and Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_treatment|increase their lifetime]].}}<br />
To prevent charging for 17 minutes (regardless of thresholds):<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 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 charging preventation:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}<br />
<br />
To force battery discharging (even if connected to AC):<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]]. For example, see the {{CodeRef|tp-bat-balance}} script.}}<br />
<br />
To cancel forced discharge:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge}}<br />
<br />
{{HINT|TPBattStat-Applet is a gnome applet for integrating battery balancing with a graphics and/or text display of both batteries in a panel. Battery balancing improves battery life by not leaving one battery empty while the other discharges. For the latest alpha release, see https://github.com/teleshoes/tpbattstat-applet}}<br />
<br />
====Making the settings permanent on reboot====<br />
<br />
If you always use the same type of battery, then you may want the same settings to be configured each time you boot the machine.<br />
<br />
If you use various types of battery, then you may want to consider writing some scripts to detect the battery type and apply the appropriate settings.<br />
<br />
=====Debian=====<br />
<br />
It is not necessary to create your own init.d script or modify /etc/rc.local - you just need the package sysfsutils:<br />
:{{cmdroot|apt-get install sysfsutils}}<br />
<br />
Now, put your desired settings in /etc/sysfs.conf:<br />
<br />
<pre><nowiki># cat >> /etc/sysfs.conf << EOF<br />
# For a LiIon battery in a Thinkpad<br />
devices/platform/smapi/BAT0/start_charge_thresh = 50<br />
devices/platform/smapi/BAT0/stop_charge_thresh = 80<br />
EOF</nowiki></pre><br />
<br />
The init script supplied by sysfsutils will load these settings on each boot.<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_percent<br />
# cat /sys/devices/platform/smapi/BAT0/remaining_running_time<br />
# cat /sys/devices/platform/smapi/BAT0/remaining_charging_time<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/barcoding<br />
# cat /sys/devices/platform/smapi/BAT0/chemistry<br />
# cat /sys/devices/platform/smapi/BAT0/serial<br />
# cat /sys/devices/platform/smapi/BAT0/manufacture_date<br />
# cat /sys/devices/platform/smapi/BAT0/first_use_date<br />
# cat /sys/devices/platform/smapi/BAT0/temperature # in milli-Celsius<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 [[#Bundled hdaps driver|Bundled hdaps driver]] below).<br />
<br />
On [[ACPI]]-enabled systems, most of above information is also available through the files under {{path|/proc/acpi/battery}}. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when [[How to use UltraBay batteries|hotswapping UltraBay batteries]].<br />
<br />
====Scripts====<br />
Some scripts can make it easier to grep the information you need from tp_smapi<br />
* [[battery.rb]]<br />
<br />
===Other features===<br />
<br />
There is also [[sysfs]] attribute for making direct SMAPI requests to the SM BIOS firmware. Don't touch it unless you really know what you're doing. Example:<br />
# echo '211a 100 0 0' > /sys/devices/platform/smapi/smapi_request; cat /sys/devices/platform/smapi/smapi_request<br />
211a 34b b2 0 0 0 'OK'<br />
The "4b" in the 2nd value, converted to decimal, is 75: the current charging stop threshold (stop_charge_thresh).<br />
<br />
===Bundled <tt>hdaps</tt> driver===<br />
<br />
The tp_smapi package includes a modified version of the <tt>hdaps</tt> Linux kernel driver used by the [[HDAPS]] system. It has remained outside the mainline kernel for a few years for several reasons, [https://lists.ubuntu.com/archives/kernel-team/2009-April/005565.html] including the upstream maintainer's assertion that the new code's anonymous author was under a NDA. (Although this would not normally expose the kernel team to litigation.) [http://lkml.org/lkml/2008/9/15/126] [http://lkml.org/lkml/2008/10/7/403] [http://lkml.org/lkml/2008/10/7/428]<br />
<br />
To use <tt>tp_smapi</tt> and <tt>hdaps</tt> concurrently, you '''must''' use the modified version.<br />
<br />
To build the modified version, simply append the <tt>HDAPS=1</tt> parameter to the <tt>make</tt> command (see [[#Installation|Installation]] above):<br />
:{{cmdroot|1=make load HDAPS=1}}<br />
or<br />
:{{cmdroot|1=make install HDAPS=1}}<br />
<br />
If you don't do that, you will not be able to load <tt>tp_smapi</tt> (and its support module <tt>thinkpad_ec</tt>) when <tt>hdaps</tt> is loaded, and vice versa. You can use <tt>rmmod</tt> to switch between these modules.<br />
<br />
Note that some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}), independently of <tt>tp_smapi</tt>.<br />
<br />
The modified <tt>hdaps</tt> has several changes:<br />
* The <tt>hdaps</tt> driver in mainline kernels conflicts with the extended battery status (they use the same IO ports). The modified <tt>hdaps</tt> coordinates this access through the bundled <tt>thinkpad_ec</tt> driver.<br />
* The modified <tt>hdaps</tt> driver fixes reliability and improves support for recent ThinkPad models (*60 and newer), since unlike the mainline driver, it correctly follows the Embedded Controller communication protocol.<br />
* Several other improvements, such as the ability to control the polling rate.<br />
<br />
===Troubleshooting===<br />
==== <tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f</tt> ====<br />
The "<tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f!</tt>" error message is printed when loading the <tt>thinkpad_ec</tt> module on some recent ThinkPad models. This occurs because the ACPI BIOS DSDT is reserving ports used by tp_smapi.<br />
<br />
As a workaround, add the <tt>force_io=1</tt> module parameter to <tt>thinkpad_ec</tt> in {{path|/etc/modprobe.conf}} (or your distribution's equivalent). Add the line:<br />
: options thinkpad_ec force_io=1<br />
<br />
For transient testing, load the modules as follows:<br />
<br />
: {{cmdroot|1=make load HDAPS=1 FORCE_IO=1}}<br />
<br />
Note: force_io option was added in tp_smapi v0.40 (released 2008-12-16).<br />
<br />
Models which need this option include: {{T400}}, {{T500}}, {{X60s}}, {{X61}}, {{X301}}<br />
<br />
More information:<br />
* http://bugzilla.kernel.org/show_bug.cgi?id=12221<br />
* http://www.nabble.com/thinkpad_ec-fails-to-load-on-Thinkpad-T500-td19932985.html<br />
<br />
==== <tt>thinkpad_ec: no ThinkPad embedded controller!</tt> ====<br />
If you get "<tt>thinkpad_ec: no ThinkPad embedded controller!</tt>" when trying to load the module on a supported model listed below, you should [[BIOS_Upgrade|upgrade your BIOS]]. Some early BIOS (like 1.x on the X31) don't handle the embedded controller.<br />
<br />
==== <tt>T60p writing to start_charge_thresh/stop_charge_thresh does not work!</tt> ====<br />
Writing to /sys/devices/platform/smapi/BAT0/start_charge_thresh succeeds, but the older value does not change. Solution: unknown. If you know a solution please update here.<br />
<br />
UPDATE: Failure to effectively change sysfs values sometimes happens at boot time (through sysfs.conf OR etc/local.start for instance) when the values have never previously been changed manually (ie using echo from a shell). Try initializing the values manually before including them in boot-time scripting.<br />
<br />
===Model-specific status===<br />
<br />
Tip: The <tt>thinkpad-acpi</tt> module reports both the BIOS and EC firmware versions when it loads.<br />
<br />
<div style="font-size: 92%"><br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|+<tt>tp_smapi</tt> feature support matrix<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====A series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{A22p}} 2629-USG<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || ||<br />
|-<br />
! {{A30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====G series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{G41}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || N/A || N/A || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====R series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{R31}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || No SMAPI BIOS<br />
|-<br />
! {{R40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50}}<br />
| {{Cunk}} || {{Cno}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{R50e}} 1834-JAG<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50e}} 1834-5US<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{R51}} 18*<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 || 3.22 || || Machine types 1829, 1830, 1831 and 1836<br />
|-<br />
! {{R51}} 28*<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || 1.29 || || Machine types 2883, 2887, 2888, 2889, 2894 and 2495<br />
|-<br />
! {{R52}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.29 || 1.06 ||<br />
|-<br />
! {{R60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cno|text=}} 1 || 0.33 || || ||<br />
|-<br />
! {{R61}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.35-test1 || 7KETA7WW 2.07 || 7KHT24WW 1.08 || Machine type 8918<br />
|-<br />
! {{R61i}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.41 || || || Machine types 7732, 8250<br />
|-<br />
! {{R400}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.40-1 || || || Machine type 7443<br />
|-<br />
! {{R500}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cunk}} || {{Cyes|text=}} 1 || 0.40-1 || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====T series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{T20}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.<br />
|-<br />
! {{T22}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.<br />
|-<br />
! {{T23}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T40}} 2373-72U<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.40 || 3.23 || 1RHT71WW-3.04 ||<br />
|-<br />
! {{T40p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.37 || 3.23 || 3.04 ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.20 || 3.04 ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.23 || 3.04 ||<br />
|-<br />
! {{T41p}} 2373-AM9<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.20 || v3.04 ||<br />
|-<br />
! {{T42}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{T42p}} 2373-KXU<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.21 || || Stop charge threshold works in Windows, but dmesg says "__get_real_thresh: cannot get stop_thresh of bat=0: Function is not supported by SMAPI BIOS".<br />
|-<br />
! {{T42p}} 2373-KUU<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{T43}} 2686<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.27 || ||<br />
|-<br />
! {{T43p}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes|text=}} 0 || || || ||<br />
|-<br />
! {{T60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.32 || || ||<br />
|-<br />
! {{T60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.34 || || ||<br />
|-<br />
! {{T60}} 1951-24G<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.36 || 1.09a || ||<br />
|-<br />
! {{T60}} 2007-FSG<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.39 || 1.10 || 1.05b ||<br />
|-<br />
! {{T60}} 1951-CZ1<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 2.23 || 1.07 ||<br />
|-<br />
! {{T60p}} 8743-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || || ||<br />
|-<br />
! {{T61}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 || || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]<br />
|-<br />
! {{T61p}} 6457-7XG<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 || || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]<br />
|-<br />
! {{T400}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 1.19 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt><br />
|-<br />
! {{T400s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 2 || 0.40 || 1.06 || || Requires <tt>invert=2</tt> paramteter to <tt>hdaps</tt><br />
|-<br />
! {{T410s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 4 || 0.40 || 1.14 || || Requires <tt>invert=4</tt> accoding to <tt>hdaps-gl</tt><br />
|-<br />
! {{T410}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 1.25 || ||<br />
|-<br />
! {{T500}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 2.07 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt><br />
|-<br />
! {{T510}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 1.12 || 1.08 || ||<br />
|-<br />
! {{T510}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 1.35 || 1.17 || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====W series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{W700}} 2757-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 2.08 || 1.05 ||<br />
|-<br />
! {{W500}} 4062-4EG<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || 0.40 || {{Cunk}} || {{Cunk}} ||<br />
|-<br />
<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====X series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{X22}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || no EC controller found<br />
|-<br />
! {{X24}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{X30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.34 || 1.09 || ||<br />
|-<br />
! {{X31}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.40 || 3.02 || ||<br />
|-<br />
! {{X32}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{X40}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 || 2.08 || 1.62 || <br />
|-<br />
! {{X41}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 || || ||<br />
|-<br />
! {{X41_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.40 || 75ET60WW (2.06 ) || 75HT20WW (1.02) ||<br />
|-<br />
! {{X60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || || 2.07 || 1.10 || 2.6.20 issue (see discussion)<br />
|-<br />
! {{X60_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.34 || 7JET25WW (1.10 ) || 7JHT13WW 1.04 || [http://luke.no-ip.org/x60tablet/ ref] [http://rad.bioinfo.ulaval.ca/hardware/x60tablet ref]<br />
|-<br />
! {{X60s}} 1704-5UG<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cno|text=}} 3 || 0.34 || 7BETD2WW 2.13 || 7BHT40WW 1.13 ||<br />
|-<br />
! {{X60s}} 1704-56G<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cno|text=}} 3 || 0.40 || 7BETD5WW 2.16 || 7BHT40WW 1.13 ||<br />
|-<br />
! {{X61}} 7673-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 6 || 0.40 || 7NETB9WW (2.19) || 7MHT25WW-1.03 ||<br />
|-<br />
! {{X61}} 7675-4KU<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.34 || 7NET30WW (1.11 ) || 7MHT24WW 1.02 ||<br />
|-<br />
! {{X61_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.32 || || ||<br />
|-<br />
! {{X61s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 3 || 0.32 || || || [http://www.slackwiki.org/ThinkPad_X61s ref] says 3 but conflicting report received<br />
|-<br />
! {{X100e}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 6XET36WW (1.20a) || 6XHT36WW (1.176000) || x100e NTS4UTX, dual-core L625 also works (NTT27MH)<br />
|-<br />
! {{X200}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 6DET40WW (2.04 ) || 7XHT22WW 1.04 ||<br />
|-<br />
! {{X200s}} 7470-X01<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6DET63WW (3.13) || 7XHT24WW 1.06 ||<br />
|-<br />
! {{X201}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 5 || 0.40 || || ECP: || It said 6 here, but see [http://www.thinkwiki.org/wiki/Talk:Tp_smapi#Wrong_HDAPS_axis_orientation_for_x201 discussion page]<br />
|-<br />
! {{X201s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6QET44WW (1.14 ) || ECP: 1.09/1.09 ||<br />
|-<br />
! {{X220}} 4290-2GW<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || 0.40 || 8DET46WW (1.16 ) || "unknown" ||<br />
|-<br />
! {{X220}} 4286-CTO<br />
| {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.41 || 8DET54WW (1.24 ) || {{Cunk}} || HDAPS works fine, don't know wich axis orientation thougth ||<br />
|-<br />
! {{X300}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.37 || 7TET25WW (1.02 ) || 7THT15WW 1.00c ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====Z series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{Z60m}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{Z60t}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{Z61m}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 || || ||<br />
|-<br />
! {{Z61t}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || || || || [https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/45014 ref]<br />
|-<br />
! {{Z61p}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====SL series and IdeaPad=====<br />
|-<br />
! colspan=12 style="text-align:left" |<br />
The ThinkPad SL series and IdeaPad series have firmware that is completely different from other ThinkPad models. Neither [[tp_smapi]] nor [[thinkpad-acpi]] support these models.<br />
|}<br />
</div><br />
<br />
<br />
SMAPI capabilities may depend on the BIOS version as well, so upgrading to the latest version of the BIOS might provide more SMAPI functions (especially true for long-lived BIOS with lots of releases, like the TP-1R).<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>" error 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 />
While at it, you may also want to add your laptop to the [[list of DMI IDs]].<br />
<br />
=====HDAPS axis orientation=====<br />
<sup>1</sup> The HDAPS axis orientation is set using the <tt>invert</tt> module parameter (at load time) or sysfs attribute (at runtime). The <tt>hdaps</tt> driver of tp_smapi supports all 8 possible sensor orientations (inversion and swapping). You can use [[HDAPS#Visualisation_of_ThinkPad_orientation|hdaps visualisation]] to check if the settings is correct.<br />
<br />
The <tt>invert</tt> parameter is an integer between 0 and 7, whose meaning is defined below. (This is confusing. Most people will find it easier to just try all 8 possibilities.)<br />
<br />
Let <tt>X</tt> and <tt>Y</tt> denote the hardware readouts. Let <tt>R</tt> denote the laptop's roll (tilt left/right), and let <tt>P</tt> denote the laptop's pitch (tilt forward/backward). The possible values are as follows:<br />
invert=0: R= X P= Y (same as mainline)<br />
invert=1: R=-X P=-Y (same as mainline)<br />
invert=2: R=-X P= Y (new)<br />
invert=3: R= X P=-Y (new)<br />
invert=4: R= Y P= X (new)<br />
invert=5: R=-Y P=-X (new)<br />
invert=6: R=-Y P= X (new)<br />
invert=7: R= Y P=-X (new)<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.<br />
* [[gkrellm-ThinkBat]] - battery status plugin for Gkrellm2<br />
* {{CodeRef|thinkpad-smapi.sh}} - script to display various SMAPI information using tp_smapi module.<br />
<br />
===See also===<br />
* https://wiki.archlinux.org/index.php/Tp_smapi#Workaround_for_Partially_Supported_Laptops<br />
<br />
== Headline text ==</div>Maikelhttps://www.thinkwiki.org/w/index.php?title=Tp_smapi&diff=55263Tp smapi2014-01-17T03:15:02Z<p>Maikel: /* Installation */ Update package info of now released Debian versions</p>
<hr />
<div>{| width="100%"<br />
|style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__<br />
|style="vertical-align:top" |<br />
The <tt>tp_smapi</tt> kernel module exposes some features of the ThinkPad hardware/firmware via a <tt>sysfs</tt> interface. Currently, the main implemented functionality is control of battery charging and extended battery status. The tp_smapi software package also includes an improved version of the [[HDAPS]] driver. The underlying hardware interfaces are [[SMAPI support for Linux|SMAPI]] and direct access to the embedded controller.<br />
<br />
This driver uses undocumented features and direct hardware access, so it may work unreliably or even damage your hardware; but so far no such damage has been reported.<br />
<br />
If you are installing on a recent Thinkpad that has an Ivy Bridge processor (X230, T430, T530, etc.), tp_smapi will not work. Use thinkpad-acpi.<br />
|}<br />
<br />
===Features===<br />
*<tt>tp_smapi</tt> driver<br />
**Battery charge/discharge control<br />
**Battery status information<br />
*<tt>hdaps</tt> driver (compared with the standard <tt>hdaps</tt> driver)<br />
**Improved stability<br />
**Improved model support<br />
**Improved functionality<br />
<br />
===Project Homepage / Availability===<br />
* Project page: http://tpctl.sourceforge.net/<br />
* Download page: http://sourceforge.net/projects/tpctl/files/tp_smapi, a newer version 0.41 is available in a fork at https://github.com/evgeni/tp_smapi which is also available in Debian<br />
* You need to download only the <i>tp_smapi</i> package.<br />
<br />
===Installation===<br />
====Installation from source====<br />
You will need the kernel headers and makefiles corresponding to your current kernel version. On {{Fedora}}, this means {{cmdroot|yum install kernel-devel-$(uname -r)}} .<br />
<br />
:{{cmdroot|tar xzvf tp_smapi-0.40.tgz}}<br />
:{{cmdroot|cd tp_smapi-0.40}}<br />
<br />
Then, either compile and load the driver within the current working directory (for testing):<br />
:{{cmdroot|make load}}<br />
OR 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 matching the current kernel).<br />
Again, either load the driver within the current working directory:<br />
:{{cmdroot|1=make load HDAPS=1}}<br />
OR install into the kernel's module path:<br />
:{{cmdroot|1=make install HDAPS=1}}<br />
<br />
To prepare a stand-alone patch against the current kernel tree (including<br />
a patch against <tt>hdaps</tt> and new <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 />
====Installation in Gentoo====<br />
The {{Gentoo}} portage system carries a [http://packages.gentoo.org/package/app-laptop/tp_smapi tp_smapi package], which follows the latest version pretty closely. On a Gentoo system, you can install and load as follows.<br />
<br />
If you use the [[HDAPS]] driver, do this first:<br />
<br />
* Disable the <tt>hdaps</tt> module in your kernel configuration (Device Drivers &rarr; Hardware Monitoring Support &rarr; IBM Hard Drive Active Protection System)<br />
* Rebuild and install the kernel<br />
* Add the <tt>hdaps</tt> use flag in {{path|/etc/make.conf}}<br />
* {{cmdroot|rmmod hdaps}}<br />
<br />
Then:<br />
* {{cmdroot|emerge tp_smapi}} (or install tp_smapi with hdaps support manually, as above)<br />
* {{cmdroot|echo "tp_smapi" >> /etc/modules.autoload.d/kernel-2.6}}<br />
* {{cmdroot|echo "hdaps" >> /etc/modules.autoload.d/kernel-2.6}}<br />
<br />
Then reboot, or run:<br />
* {{cmdroot|modprobe tp_smapi}}<br />
* {{cmdroot|modprobe hdaps}}<br />
<br />
'''NOTE:''' If {{cmdroot|modprobe}} fails and dmesg says something about <tt>__stack_chk_fail()</tt>, you probably just compiled your modules with <tt>-fstack-protector</tt> and/or <tt>-fstack-protector-all</tt> without having a kernel that supports it. You can either configure your kernel to have <tt>CC_STACKPROTECTOR</tt> enabled (in ''Processor type and features'' if you use {{cmdroot|make menuconfig}}) or edit your <tt>make.conf</tt> (or, if you're using paludis, your <tt>/etc/paludis/bashrc</tt>) and remove <tt>-fstack-protector</tt> and <tt>-fstack-protector-all</tt> from your <tt>CFLAGS</tt>. If you choose to enable it in the kernel, be aware that you need a patched GCC for it (and I do not know if the gcc in stage3 is patched).<br />
<br />
<br />
====Installation on Debian====<br />
You can use 'dkms' on Debian 7 stable (wheezy) or oldstable (squeeze) (kernel >=2.6.32-5). (Note: If installation seems ineffective, confirm your have the linux-headers of your kernel installed, purge tp-smapi-dkms and reinstall.)<br />
* {{cmdroot|aptitude install linux-headers tp-smapi-dkms}}<br />
<br />
=====Installation on Debian from source=====<br />
Since Debian 5 (lenny) also the [http://packages.debian.org/tp-smapi packaged module source] is available.<br />
You can build tp_smapi with module-assistant:<br />
* {{cmdroot|aptitude install tp-smapi-source}}<br />
* {{cmdroot|m-a -t a-i tp-smapi}}<br />
<br />
=====Installation on Debian 5 (lenny)=====<br />
In Debian 5 (lenny) are also the prebuilt modules for Debian kernels.<br />
If you use a stock Debian kernel, you can install the tp_smapi modules with:<br />
* {{cmdroot|apt-get install tp-smapi-modules-`uname -r`}}<br />
* in order to make sure the modules package is kept in sync with the kernel one, you may also want to install the <code>tm-smapi-modules-2.6-686</code> or <code>tm-smapi-modules-2.6-amd64</code> package, depending on your architecture <br />
<br />
====Installation on openSUSE====<br />
openSUSE provides rpm packages. Look for them at the package search: [http://software.opensuse.org/search/], search for the package named "tp_smapi".<br />
<br />
A step-by-step guide on how a relative linux newbie installed tp_smapi on a Thinkpad W500 running openSuse 11.1 using YAST Software Manager is available [http://forums.opensuse.org/hardware/laptop/417254-tp_smapi-lenovo-thinkpad-t400-t500-w500-step-step.html#post2005932 here]<br />
<br />
In case you are taking the hard way around, while compiling on 11.0, make complained about not being able to locate the kernel sources. It worked for me after I did this:<br />
<pre><nowiki>cp /usr/include/linux/aio_abi.h /lib/modules/`uname -r`/build/include/linux/</nowiki></pre><br />
<br />
====Installation on Ubuntu====<br />
Ubuntu ships tp_smapi in their <tt>linux-ubuntu-modules-*</tt> package for Hardy, so you don't have to build it yourself. Please note that they have renamed tp_smapi's modified <tt>hdaps</tt> module to <tt>hdaps_ec</tt> so that the two can coexist. You should load <tt>hdaps_ec</tt>, not <tt>hdaps</tt>.<br />
<br />
Ubuntu Intrepid and Jaunty, however, lack the <tt>hdaps_ec</tt> module, as reported [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/297213 here]. It will not be included again until said [[#Bundled hdaps driver|bundled hdaps driver]] is merged into mainline.<br />
<br />
=====Installation on Ubuntu Jaunty=====<br />
I have posted my experiences [http://meandmyubuntu.blogspot.com/2009/05/getting-hdasp-to-work-on-jaunty.html here]<br />
<br />
=====Installation on Ubuntu Karmic=====<br />
Ubuntu does not ship the precompiled module tp_smapi any more. However the source code is still present in the repository. It can be installed through module-assistant :<br />
:{{cmdroot|aptitude install tp-smapi-source}}<br />
:{{cmdroot|module-assistant prepare tp-smapi}}<br />
:{{cmdroot|module-assistant auto-install tp-smapi}}<br />
:{{cmdroot|modprobe tp-smapi}}<br />
<br />
=====Installation on Ubuntu Lucid=====<br />
The Karmic solution above works well.<br />
<br />
As an alternative, one can use the dkms flavour of the packages via<br />
:{{cmdroot|aptitude install tp-smapi-dkms}}<br />
:{{cmdroot|modprobe tp_smapi}}<br />
<br />
{{HINT|This appears to be the ideal solution. A description of DKMS, from [http://linux.dell.com/projects.shtml#dkms Dell]: "DKMS stands for Dynamic Kernel Module Support. It is designed to create a framework where kernel dependent module source can reside so that it is very easy to rebuild modules as you upgrade kernels."}}<br />
<br />
====Installation on older Ubuntu/Debian====<br />
Installation on Ubuntu or Debian is quite easy, but there are a few things to look after:<br />
<br />
To get your system ready for compiling code, install the build-essentials (as root, of course, as all of the following comands; Ubuntu users have to prepend 'sudo' to every line and enter their own password when prompted):<br />
<pre><nowiki>apt-get install build-essential</nowiki></pre><br />
<br />
To get tp_smapi to work, obtain the latest source as mentioned above and unpack it. If you want to use HDAPS, you need to install the kernel source matching te kernel you are running. To do so, issue this:<br />
<pre><nowiki>uname -r</nowiki></pre><br />
This will give you the version of your current kernel. <br />
Debian users execute the following:<br />
<pre><nowiki>apt-get install linux-source-`uname -r`</nowiki></pre><br />
Ubuntu users execute the following using the kernel-version only (exclude -XX-generic; e.g. 'linux-source-2.6.20'):<br />
<pre><nowiki>apt-get install linux-source-`uname -r`</nowiki></pre><br />
<br />
Be sure to unpack the source file. The easiest way is to open Nautilus as root:<br />
<pre><nowiki>sudo nautilus</nowiki></pre><br />
Then browse to /usr/src/ and extract the source file to that directory.<br />
<br />
Now change to the tp_smapi dir:<br />
<pre><nowiki>cd tp_smapi-X.YY</nowiki></pre> (X.YY being the version-number of [[tp_smapi]])<br />
and make and install tp_smapi as instructed above.<br />
<br />
If you get an error that the kernel version isn't matching (or that you need to set KSRC/KBUILD), please check that there is a symlink from the modules dir to the kernel source:<br />
<pre><nowiki>root@localhost:~#ls -l /lib/modules/2.6.20-16-generic<br />
lrwxrwxrwx 1 root root 28 2007-02-02 08:39 build -> /usr/src/linux-source-2.6.20</nowiki></pre><br />
Create the link if the line above does not exist:<br />
<pre><nowiki>root@localhost:~#ln -s /usr/src/linux-source-2.6.20 /lib/modules/2.6.20-16-generic/build</nowiki></pre><br />
<br />
Now the following will build and install the correct modules to their locations:<br />
<pre><nowiki>make install HDAPS=1</nowiki></pre><br />
To make sure your system loads the modules at boot time, do this:<br />
<pre><nowiki>echo "tp_smapi" >> /etc/modules<br />
echo "hdaps" >> /etc/modules</nowiki></pre><br />
and update your initramfs:<br />
<pre><nowiki>update-initramfs -u</nowiki></pre><br />
<br />
To get tp_smapi running now, just load the modules:<br />
<pre><nowiki>modprobe -a tp_smapi hdaps</nowiki></pre><br />
<br />
This description was tested on Kubuntu 'Feisty Fawn' and should work on all Debian-based distros with minor tweaks.<br />
<br />
'''EDIT:''' Works on Kubuntu 7.10 ("Gutsy Gibbon"), too<br />
<br />
===Battery charge control features===<br />
{{NOTE|Not all Thinkpad ECs support these charge control features. If you get the message "Operation not supported" when trying to cat for the status of a given parameter, it means your controller does not support that feature.}}<br />
<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 and Li-Polymer batteries partially charged, in order to [[Maintenance#Battery_treatment|increase their lifetime]].}}<br />
To prevent charging for 17 minutes (regardless of thresholds):<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 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 charging preventation:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes}}<br />
<br />
To force battery discharging (even if connected to AC):<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]]. For example, see the {{CodeRef|tp-bat-balance}} script.}}<br />
<br />
To cancel forced discharge:<br />
:{{cmdroot|echo 0 > /sys/devices/platform/smapi/BAT0/force_discharge}}<br />
<br />
{{HINT|TPBattStat-Applet is a gnome applet for integrating battery balancing with a graphics and/or text display of both batteries in a panel. Battery balancing improves battery life by not leaving one battery empty while the other discharges. For the latest alpha release, see https://github.com/teleshoes/tpbattstat-applet}}<br />
<br />
====Making the settings permanent on reboot====<br />
<br />
If you always use the same type of battery, then you may want the same settings to be configured each time you boot the machine.<br />
<br />
If you use various types of battery, then you may want to consider writing some scripts to detect the battery type and apply the appropriate settings.<br />
<br />
=====Debian=====<br />
<br />
It is not necessary to create your own init.d script or modify /etc/rc.local - you just need the package sysfsutils:<br />
:{{cmdroot|apt-get install sysfsutils}}<br />
<br />
Now, put your desired settings in /etc/sysfs.conf:<br />
<br />
<pre><nowiki># cat >> /etc/sysfs.conf << EOF<br />
# For a LiIon battery in a Thinkpad<br />
devices/platform/smapi/BAT0/start_charge_thresh = 50<br />
devices/platform/smapi/BAT0/stop_charge_thresh = 80<br />
EOF</nowiki></pre><br />
<br />
The init script supplied by sysfsutils will load these settings on each boot.<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_percent<br />
# cat /sys/devices/platform/smapi/BAT0/remaining_running_time<br />
# cat /sys/devices/platform/smapi/BAT0/remaining_charging_time<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/barcoding<br />
# cat /sys/devices/platform/smapi/BAT0/chemistry<br />
# cat /sys/devices/platform/smapi/BAT0/serial<br />
# cat /sys/devices/platform/smapi/BAT0/manufacture_date<br />
# cat /sys/devices/platform/smapi/BAT0/first_use_date<br />
# cat /sys/devices/platform/smapi/BAT0/temperature # in milli-Celsius<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 [[#Bundled hdaps driver|Bundled hdaps driver]] below).<br />
<br />
On [[ACPI]]-enabled systems, most of above information is also available through the files under {{path|/proc/acpi/battery}}. However, the ACPI interface does not include the instantaneous power and cycle count readouts, and does not work well when [[How to use UltraBay batteries|hotswapping UltraBay batteries]].<br />
<br />
====Scripts====<br />
Some scripts can make it easier to grep the information you need from tp_smapi<br />
* [[battery.rb]]<br />
<br />
===Other features===<br />
<br />
There is also [[sysfs]] attribute for making direct SMAPI requests to the SM BIOS firmware. Don't touch it unless you really know what you're doing. Example:<br />
# echo '211a 100 0 0' > /sys/devices/platform/smapi/smapi_request; cat /sys/devices/platform/smapi/smapi_request<br />
211a 34b b2 0 0 0 'OK'<br />
The "4b" in the 2nd value, converted to decimal, is 75: the current charging stop threshold (stop_charge_thresh).<br />
<br />
===Bundled <tt>hdaps</tt> driver===<br />
<br />
The tp_smapi package includes a modified version of the <tt>hdaps</tt> Linux kernel driver used by the [[HDAPS]] system. It has remained outside the mainline kernel for a few years for several reasons, [https://lists.ubuntu.com/archives/kernel-team/2009-April/005565.html] including the upstream maintainer's assertion that the new code's anonymous author was under a NDA. (Although this would not normally expose the kernel team to litigation.) [http://lkml.org/lkml/2008/9/15/126] [http://lkml.org/lkml/2008/10/7/403] [http://lkml.org/lkml/2008/10/7/428]<br />
<br />
To use <tt>tp_smapi</tt> and <tt>hdaps</tt> concurrently, you '''must''' use the modified version.<br />
<br />
To build the modified version, simply append the <tt>HDAPS=1</tt> parameter to the <tt>make</tt> command (see [[#Installation|Installation]] above):<br />
:{{cmdroot|1=make load HDAPS=1}}<br />
or<br />
:{{cmdroot|1=make install HDAPS=1}}<br />
<br />
If you don't do that, you will not be able to load <tt>tp_smapi</tt> (and its support module <tt>thinkpad_ec</tt>) when <tt>hdaps</tt> is loaded, and vice versa. You can use <tt>rmmod</tt> to switch between these modules.<br />
<br />
Note that some of the battery status is also visible through ACPI ({{path|/proc/acpi/battery/*}}), independently of <tt>tp_smapi</tt>.<br />
<br />
The modified <tt>hdaps</tt> has several changes:<br />
* The <tt>hdaps</tt> driver in mainline kernels conflicts with the extended battery status (they use the same IO ports). The modified <tt>hdaps</tt> coordinates this access through the bundled <tt>thinkpad_ec</tt> driver.<br />
* The modified <tt>hdaps</tt> driver fixes reliability and improves support for recent ThinkPad models (*60 and newer), since unlike the mainline driver, it correctly follows the Embedded Controller communication protocol.<br />
* Several other improvements, such as the ability to control the polling rate.<br />
<br />
===Troubleshooting===<br />
==== <tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f</tt> ====<br />
The "<tt>thinkpad_ec: cannot claim io ports 0x1600-0x161f!</tt>" error message is printed when loading the <tt>thinkpad_ec</tt> module on some recent ThinkPad models. This occurs because the ACPI BIOS DSDT is reserving ports used by tp_smapi.<br />
<br />
As a workaround, add the <tt>force_io=1</tt> module parameter to <tt>thinkpad_ec</tt> in {{path|/etc/modprobe.conf}} (or your distribution's equivalent). Add the line:<br />
: options thinkpad_ec force_io=1<br />
<br />
For transient testing, load the modules as follows:<br />
<br />
: {{cmdroot|1=make load HDAPS=1 FORCE_IO=1}}<br />
<br />
Note: force_io option was added in tp_smapi v0.40 (released 2008-12-16).<br />
<br />
Models which need this option include: {{T400}}, {{T500}}, {{X60s}}, {{X61}}, {{X301}}<br />
<br />
More information:<br />
* http://bugzilla.kernel.org/show_bug.cgi?id=12221<br />
* http://www.nabble.com/thinkpad_ec-fails-to-load-on-Thinkpad-T500-td19932985.html<br />
<br />
==== <tt>thinkpad_ec: no ThinkPad embedded controller!</tt> ====<br />
If you get "<tt>thinkpad_ec: no ThinkPad embedded controller!</tt>" when trying to load the module on a supported model listed below, you should [[BIOS_Upgrade|upgrade your BIOS]]. Some early BIOS (like 1.x on the X31) don't handle the embedded controller.<br />
<br />
==== <tt>T60p writing to start_charge_thresh/stop_charge_thresh does not work!</tt> ====<br />
Writing to /sys/devices/platform/smapi/BAT0/start_charge_thresh succeeds, but the older value does not change. Solution: unknown. If you know a solution please update here.<br />
<br />
UPDATE: Failure to effectively change sysfs values sometimes happens at boot time (through sysfs.conf OR etc/local.start for instance) when the values have never previously been changed manually (ie using echo from a shell). Try initializing the values manually before including them in boot-time scripting.<br />
<br />
===Model-specific status===<br />
<br />
Tip: The <tt>thinkpad-acpi</tt> module reports both the BIOS and EC firmware versions when it loads.<br />
<br />
<div style="font-size: 92%"><br />
{| border="1" cellspacing="0" cellpadding="2"<br />
|+<tt>tp_smapi</tt> feature support matrix<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====A series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{A22p}} 2629-USG<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || ||<br />
|-<br />
! {{A30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====G series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{G41}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || N/A || N/A || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====R series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{R31}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || No SMAPI BIOS<br />
|-<br />
! {{R40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50}}<br />
| {{Cunk}} || {{Cno}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{R50e}} 1834-JAG<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50e}} 1834-5US<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{R50p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{R51}} 18*<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 || 3.22 || || Machine types 1829, 1830, 1831 and 1836<br />
|-<br />
! {{R51}} 28*<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || 1.29 || || Machine types 2883, 2887, 2888, 2889, 2894 and 2495<br />
|-<br />
! {{R52}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.29 || 1.06 ||<br />
|-<br />
! {{R60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cno|text=}} 1 || 0.33 || || ||<br />
|-<br />
! {{R61}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.35-test1 || 7KETA7WW 2.07 || 7KHT24WW 1.08 || Machine type 8918<br />
|-<br />
! {{R61i}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.41 || || || Machine types 7732, 8250<br />
|-<br />
! {{R400}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} ||{{Cyes}} || {{Cyes|text=}} 1 || 0.40-1 || || || Machine type 7443<br />
|-<br />
! {{R500}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} ||{{Cunk}} || {{Cyes|text=}} 1 || 0.40-1 || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====T series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{T20}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.<br />
|-<br />
! {{T22}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || Has SMAPI BIOS but no function is supported. EC LPC3 protocol fails.<br />
|-<br />
! {{T23}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T40}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T40}} 2373-72U<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.40 || 3.23 || 1RHT71WW-3.04 ||<br />
|-<br />
! {{T40p}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.37 || 3.23 || 3.04 ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.20 || 3.04 ||<br />
|-<br />
! {{T41}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 3.23 || 3.04 ||<br />
|-<br />
! {{T41p}} 2373-AM9<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.20 || v3.04 ||<br />
|-<br />
! {{T42}}<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{T42p}} 2373-KXU<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || 3.21 || || Stop charge threshold works in Windows, but dmesg says "__get_real_thresh: cannot get stop_thresh of bat=0: Function is not supported by SMAPI BIOS".<br />
|-<br />
! {{T42p}} 2373-KUU<br />
| {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{T43}} 2686<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.33 || 1.27 || ||<br />
|-<br />
! {{T43p}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes|text=}} 0 || || || ||<br />
|-<br />
! {{T60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.32 || || ||<br />
|-<br />
! {{T60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.34 || || ||<br />
|-<br />
! {{T60}} 1951-24G<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.36 || 1.09a || ||<br />
|-<br />
! {{T60}} 2007-FSG<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.39 || 1.10 || 1.05b ||<br />
|-<br />
! {{T60}} 1951-CZ1<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 2.23 || 1.07 ||<br />
|-<br />
! {{T60p}} 8743-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.32 || || ||<br />
|-<br />
! {{T61}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 || || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]<br />
|-<br />
! {{T61p}} 6457-7XG<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 1 || 0.32 || || || [http://ubuntuforums.org/showthread.php?p=3146719 ref]<br />
|-<br />
! {{T400}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 1.19 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt><br />
|-<br />
! {{T400s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 2 || 0.40 || 1.06 || || Requires <tt>invert=2</tt> paramteter to <tt>hdaps</tt><br />
|-<br />
! {{T410s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 4 || 0.40 || 1.14 || || Requires <tt>invert=4</tt> accoding to <tt>hdaps-gl</tt><br />
|-<br />
! {{T410}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 1.25 || ||<br />
|-<br />
! {{T500}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 1 || 0.40 || 2.07 || || Requires <tt>force_io=1</tt> parameter to <tt>thinkpad_ec</tt><br />
|-<br />
! {{T510}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 1.12 || 1.08 || ||<br />
|-<br />
! {{T510}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 1.35 || 1.17 || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====W series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{W700}} 2757-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 2.08 || 1.05 ||<br />
|-<br />
! {{W500}} 4062-4EG<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || 0.40 || {{Cunk}} || {{Cunk}} ||<br />
|-<br />
<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====X series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{X22}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || N/A || N/A || || || || no EC controller found<br />
|-<br />
! {{X24}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cunk}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{X30}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.34 || 1.09 || ||<br />
|-<br />
! {{X31}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || 0.40 || 3.02 || ||<br />
|-<br />
! {{X32}}<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cyes}} || N/A || N/A || || || ||<br />
|-<br />
! {{X40}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 || 2.08 || 1.62 || <br />
|-<br />
! {{X41}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.32 || || ||<br />
|-<br />
! {{X41_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.40 || 75ET60WW (2.06 ) || 75HT20WW (1.02) ||<br />
|-<br />
! {{X60}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || || 2.07 || 1.10 || 2.6.20 issue (see discussion)<br />
|-<br />
! {{X60_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 3 || 0.34 || 7JET25WW (1.10 ) || 7JHT13WW 1.04 || [http://luke.no-ip.org/x60tablet/ ref] [http://rad.bioinfo.ulaval.ca/hardware/x60tablet ref]<br />
|-<br />
! {{X60s}} 1704-5UG<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cunk}} || {{Cno|text=}} 3 || 0.34 || 7BETD2WW 2.13 || 7BHT40WW 1.13 ||<br />
|-<br />
! {{X60s}} 1704-56G<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cno|text=}} 3 || 0.40 || 7BETD5WW 2.16 || 7BHT40WW 1.13 ||<br />
|-<br />
! {{X61}} 7673-CTO<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 6 || 0.40 || 7NETB9WW (2.19) || 7MHT25WW-1.03 ||<br />
|-<br />
! {{X61}} 7675-4KU<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.34 || 7NET30WW (1.11 ) || 7MHT24WW 1.02 ||<br />
|-<br />
! {{X61_Tablet}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 || 0.32 || || ||<br />
|-<br />
! {{X61s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 3 || 0.32 || || || [http://www.slackwiki.org/ThinkPad_X61s ref] says 3 but conflicting report received<br />
|-<br />
! {{X100e}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || 0.40 || 6XET36WW (1.20a) || 6XHT36WW (1.176000) || x100e NTS4UTX, dual-core L625 also works (NTT27MH)<br />
|-<br />
! {{X200}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 7 || 0.40 || 6DET40WW (2.04 ) || 7XHT22WW 1.04 ||<br />
|-<br />
! {{X200s}} 7470-X01<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6DET63WW (3.13) || 7XHT24WW 1.06 ||<br />
|-<br />
! {{X201}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 6 / 5 || 0.40 || || ECP: || It said 6 here, but see [http://www.thinkwiki.org/wiki/Talk:Tp_smapi#Wrong_HDAPS_axis_orientation_for_x201 discussion page]<br />
|-<br />
! {{X201s}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cno|text=}} 5 || 0.40 || 6QET44WW (1.14 ) || ECP: 1.09/1.09 ||<br />
|-<br />
! {{X220}} 4290-2GW<br />
| {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || {{Cno}} || 0.40 || 8DET46WW (1.16 ) || "unknown" ||<br />
|-<br />
! {{X220}} 4286-CTO<br />
| {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cno}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.41 || 8DET54WW (1.24 ) || {{Cunk}} || HDAPS works fine, don't know wich axis orientation thougth ||<br />
|-<br />
! {{X300}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || 0.37 || 7TET25WW (1.02 ) || 7THT15WW 1.00c ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====Z series=====<br />
|-<br />
{{tp_smapi/model_status_table_header}}<br />
|-<br />
! {{Z60m}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{Z60t}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || {{Cyes}} || {{Cunk}} || {{Cunk}} || || || ||<br />
|-<br />
! {{Z61m}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes|text=}} 0 || 0.32 || || ||<br />
|-<br />
! {{Z61t}}<br />
| {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || || || || [https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/45014 ref]<br />
|-<br />
! {{Z61p}}<br />
| {{Cyes}} || {{Cyes}} || {{Cunk}} || {{Cyes}} || {{Cyes}} || {{Cyes}} || {{Cunk}} || || || ||<br />
|-<br />
! colspan=12 style="text-align:center;background:#efefef;" |<br />
<br />
=====SL series and IdeaPad=====<br />
|-<br />
! colspan=12 style="text-align:left" |<br />
The ThinkPad SL series and IdeaPad series have firmware that is completely different from other ThinkPad models. Neither [[tp_smapi]] nor [[thinkpad-acpi]] support these models.<br />
|}<br />
</div><br />
<br />
<br />
SMAPI capabilities may depend on the BIOS version as well, so upgrading to the latest version of the BIOS might provide more SMAPI functions (especially true for long-lived BIOS with lots of releases, like the TP-1R).<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>" error 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 />
While at it, you may also want to add your laptop to the [[list of DMI IDs]].<br />
<br />
=====HDAPS axis orientation=====<br />
<sup>1</sup> The HDAPS axis orientation is set using the <tt>invert</tt> module parameter (at load time) or sysfs attribute (at runtime). The <tt>hdaps</tt> driver of tp_smapi supports all 8 possible sensor orientations (inversion and swapping). You can use [[HDAPS#Visualisation_of_ThinkPad_orientation|hdaps visualisation]] to check if the settings is correct.<br />
<br />
The <tt>invert</tt> parameter is an integer between 0 and 7, whose meaning is defined below. (This is confusing. Most people will find it easier to just try all 8 possibilities.)<br />
<br />
Let <tt>X</tt> and <tt>Y</tt> denote the hardware readouts. Let <tt>R</tt> denote the laptop's roll (tilt left/right), and let <tt>P</tt> denote the laptop's pitch (tilt forward/backward). The possible values are as follows:<br />
invert=0: R= X P= Y (same as mainline)<br />
invert=1: R=-X P=-Y (same as mainline)<br />
invert=2: R=-X P= Y (new)<br />
invert=3: R= X P=-Y (new)<br />
invert=4: R= Y P= X (new)<br />
invert=5: R=-Y P=-X (new)<br />
invert=6: R=-Y P= X (new)<br />
invert=7: R= Y P=-X (new)<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.<br />
* [[gkrellm-ThinkBat]] - battery status plugin for Gkrellm2<br />
* {{CodeRef|thinkpad-smapi.sh}} - script to display various SMAPI information using tp_smapi module.<br />
<br />
===See also===<br />
* https://wiki.archlinux.org/index.php/Tp_smapi#Workaround_for_Partially_Supported_Laptops<br />
<br />
== Headline text ==</div>Maikel