<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Code%2Fthinkpad-smapi.sh</id>
	<title>Code/thinkpad-smapi.sh - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Code%2Fthinkpad-smapi.sh"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;action=history"/>
	<updated>2026-05-16T20:05:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=62648&amp;oldid=prev</id>
		<title>ThinkGNU: William confirmed via email that; &quot;As for your request, sure, I will license it to you under GPLv3 or later.&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=62648&amp;oldid=prev"/>
		<updated>2025-04-13T09:31:59Z</updated>

		<summary type="html">&lt;p&gt;William confirmed via email that; &amp;quot;As for your request, sure, I will license it to you under GPLv3 or later.&amp;quot;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 09:31, 13 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# This file is licensed under the GPL &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;v2&lt;/del&gt;. E-mail me if you have any ideas of&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# This file is licensed under the GPL &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;version 3, or (at your option) any later version&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;# &lt;/del&gt;other licenses to use (BSD&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, GPL v3&lt;/del&gt;, Public Domain, etc.), I'm open :)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;# &lt;/ins&gt;E-mail me if you have any ideas of other licenses to use (BSD, Public Domain, etc.), I'm open :)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# IDEAS&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# IDEAS&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key c1thinkwiki:diff::1.12:old-62573:rev-62648 --&gt;
&lt;/table&gt;</summary>
		<author><name>ThinkGNU</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=62573&amp;oldid=prev</id>
		<title>ThinkGNU: Put script in pre block.</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=62573&amp;oldid=prev"/>
		<updated>2025-04-11T07:53:44Z</updated>

		<summary type="html">&lt;p&gt;Put script in pre block.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 07:53, 11 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l325&quot; &gt;Line 325:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 326:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; fi&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; fi&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fi&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key c1thinkwiki:diff::1.12:old-30205:rev-62573 --&gt;
&lt;/table&gt;</summary>
		<author><name>ThinkGNU</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=30205&amp;oldid=prev</id>
		<title>Andrz: -c option in shebang is unnecessary.</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=30205&amp;oldid=prev"/>
		<updated>2007-06-01T12:57:40Z</updated>

		<summary type="html">&lt;p&gt;-c option in shebang is unnecessary.&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 12:57, 1 June 2007&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;-c&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# This file is licensed under the GPL v2. E-mail me if you have any ideas of&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# This file is licensed under the GPL v2. E-mail me if you have any ideas of&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Andrz</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=28781&amp;oldid=prev</id>
		<title>WilliamPoetra at 06:53, 17 March 2007</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=28781&amp;oldid=prev"/>
		<updated>2007-03-17T06:53:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;#!/bin/bash -c&lt;br /&gt;
# Copyright (C) 2007 William Poetra Yoga Hadisoeseno &amp;lt;williampoetra@gmail.com&amp;gt;&lt;br /&gt;
# This file is licensed under the GPL v2. E-mail me if you have any ideas of&lt;br /&gt;
# other licenses to use (BSD, GPL v3, Public Domain, etc.), I'm open :)&lt;br /&gt;
&lt;br /&gt;
# IDEAS&lt;br /&gt;
# - make an ncurses interface, and also maybe gtk+ and qt&lt;br /&gt;
# - add option to enable modifying the charge control variables&lt;br /&gt;
&lt;br /&gt;
TP_SMAPI_BASE=/sys/devices/platform/smapi&lt;br /&gt;
&lt;br /&gt;
# function to simplify reading from files&lt;br /&gt;
# syntax: read_file &amp;lt;variable&amp;gt; &amp;lt;filename&amp;gt; &amp;lt;check_return_value 0/1&amp;gt; &amp;lt;translate 0/1&amp;gt; [[value] [translation_string]]&lt;br /&gt;
read_file()&lt;br /&gt;
{&lt;br /&gt;
  local VARIABLE&lt;br /&gt;
  local FILENAME&lt;br /&gt;
  local CHECK_RETURN&lt;br /&gt;
  local TRANSLATE&lt;br /&gt;
  local VAL&lt;br /&gt;
  local RET&lt;br /&gt;
&lt;br /&gt;
  VARIABLE=&amp;quot;$1&amp;quot;; shift&lt;br /&gt;
  FILENAME=&amp;quot;$1&amp;quot;; shift&lt;br /&gt;
  CHECK_RETURN=&amp;quot;$1&amp;quot;; shift&lt;br /&gt;
  TRANSLATE=&amp;quot;$1&amp;quot;; shift&lt;br /&gt;
&lt;br /&gt;
  VAL=`cat &amp;quot;$FILENAME&amp;quot; 2&amp;gt; /dev/null`&lt;br /&gt;
  RET=$?&lt;br /&gt;
&lt;br /&gt;
  if [[ &amp;quot;$CHECK_RETURN&amp;quot; == &amp;quot;1&amp;quot; ]] &amp;amp;&amp;amp; [[ $RET -gt 0 ]]&lt;br /&gt;
  then&lt;br /&gt;
    RESULT=&amp;quot;[unavailable]&amp;quot;&lt;br /&gt;
  elif [ &amp;quot;$TRANSLATE&amp;quot; == &amp;quot;1&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
    RESULT=&amp;quot;unknown ($RET)&amp;quot;&lt;br /&gt;
    while [ -n &amp;quot;$1&amp;quot; ]&lt;br /&gt;
    do&lt;br /&gt;
      if [ &amp;quot;$VAL&amp;quot; == &amp;quot;$1&amp;quot; ]&lt;br /&gt;
      then&lt;br /&gt;
        RESULT=&amp;quot;$2&amp;quot;&lt;br /&gt;
        break&lt;br /&gt;
      fi&lt;br /&gt;
      shift 2&lt;br /&gt;
    done&lt;br /&gt;
  else&lt;br /&gt;
    RESULT=&amp;quot;$VAL&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  eval &amp;quot;$VARIABLE=&amp;quot;'&amp;quot;'&amp;quot;$RESULT&amp;quot;'&amp;quot;'&lt;br /&gt;
#  eval &amp;quot;$VARIABLE=$RESULT&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
give_units()&lt;br /&gt;
{&lt;br /&gt;
  local VARIABLE&lt;br /&gt;
  local UNIT&lt;br /&gt;
  local VALUE&lt;br /&gt;
  local RESULT&lt;br /&gt;
&lt;br /&gt;
  VARIABLE=&amp;quot;$1&amp;quot;&lt;br /&gt;
  UNIT=&amp;quot;$2&amp;quot;&lt;br /&gt;
  eval &amp;quot;VALUE=\$$VARIABLE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  if (echo &amp;quot;$VALUE&amp;quot; | grep -qs &amp;quot;^-\?[0-9]&amp;quot;)&lt;br /&gt;
  then&lt;br /&gt;
    RESULT=&amp;quot;$VALUE $UNIT&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    RESULT=&amp;quot;$VALUE&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  eval &amp;quot;$VARIABLE=&amp;quot;'&amp;quot;'&amp;quot;$RESULT&amp;quot;'&amp;quot;'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
replace_val()&lt;br /&gt;
{&lt;br /&gt;
  local VARIABLE&lt;br /&gt;
  local OLD_VALUE&lt;br /&gt;
  local NEW_VALUE&lt;br /&gt;
  local VALUE&lt;br /&gt;
  local RESULT&lt;br /&gt;
&lt;br /&gt;
  VARIABLE=&amp;quot;$1&amp;quot;&lt;br /&gt;
  OLD_VALUE=&amp;quot;$2&amp;quot;&lt;br /&gt;
  NEW_VALUE=&amp;quot;$3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  eval &amp;quot;VALUE=\$$VARIABLE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  if [ &amp;quot;$VALUE&amp;quot; == &amp;quot;$OLD_VALUE&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
    RESULT=&amp;quot;$NEW_VALUE&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    RESULT=&amp;quot;$VALUE&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  eval &amp;quot;$VARIABLE=&amp;quot;'&amp;quot;'&amp;quot;$RESULT&amp;quot;'&amp;quot;'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
show_help()&lt;br /&gt;
{&lt;br /&gt;
  cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
&lt;br /&gt;
  thinkpad-smapi.sh - Show SMAPI information on ThinkPad laptops, through&lt;br /&gt;
                      the exported SMAPI information by the tp_smapi module.&lt;br /&gt;
&lt;br /&gt;
  -a      Show all available information&lt;br /&gt;
  -b [n]  Show all available information for battery [n]&lt;br /&gt;
  -h      Show this help text&lt;br /&gt;
  -m      Show miscellaneous information&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
show_misc()&lt;br /&gt;
{&lt;br /&gt;
  cd $TP_SMAPI_BASE&lt;br /&gt;
&lt;br /&gt;
  read_file PCI_POWER_SAVINGS &amp;quot;enable_pci_power_saving_on_boot&amp;quot; 1 1 1 &amp;quot;enabled&amp;quot; 0 &amp;quot;disabled&amp;quot;&lt;br /&gt;
  read_file AC_ADAPTER &amp;quot;ac_connected&amp;quot; 1 1 1 &amp;quot;connected&amp;quot; 0 &amp;quot;disconnected&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
MISCELLANEOUS INFORMATION&lt;br /&gt;
=========================&lt;br /&gt;
&lt;br /&gt;
PCI power savings on boot: $PCI_POWER_SAVINGS&lt;br /&gt;
AC adapter status: $AC_ADAPTER&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
show_batt()&lt;br /&gt;
{&lt;br /&gt;
  SLOT=$1&lt;br /&gt;
  cd $TP_SMAPI_BASE/BAT$SLOT&lt;br /&gt;
&lt;br /&gt;
  TMP=`cat installed`&lt;br /&gt;
  if [ $TMP -eq 1 ]&lt;br /&gt;
  then&lt;br /&gt;
    BATT_INSTALLED=&amp;quot;yes&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    BATT_INSTALLED=&amp;quot;no&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  BATT_STATE=`cat state`&lt;br /&gt;
&lt;br /&gt;
  if [ $BATT_INSTALLED == &amp;quot;yes&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
&lt;br /&gt;
    read_file BARCODING &amp;quot;barcoding&amp;quot; 1 0&lt;br /&gt;
    read_file BATT_CHEMISTRY &amp;quot;chemistry&amp;quot; 1 0&lt;br /&gt;
    read_file DESIGN_CAPACITY &amp;quot;design_capacity&amp;quot; 1 0&lt;br /&gt;
    read_file DESIGN_VOLTAGE &amp;quot;design_voltage&amp;quot; 1 0&lt;br /&gt;
    read_file MANUFACTURE_DATE &amp;quot;manufacture_date&amp;quot; 1 0&lt;br /&gt;
    read_file BATT_FRU &amp;quot;model&amp;quot; 1 0&lt;br /&gt;
    read_file MANUFACTURER &amp;quot;manufacturer&amp;quot; 1 0&lt;br /&gt;
    read_file BATT_SERIAL &amp;quot;serial&amp;quot; 1 0&lt;br /&gt;
&lt;br /&gt;
    read_file FIRST_USE_DATE &amp;quot;first_use_date&amp;quot; 1 0&lt;br /&gt;
    read_file CYCLE_COUNT &amp;quot;cycle_count&amp;quot; 1 0&lt;br /&gt;
    read_file LAST_FULL_CAPACITY &amp;quot;last_full_capacity&amp;quot; 1 0&lt;br /&gt;
    read_file CURRENT_1MIN &amp;quot;current_avg&amp;quot; 1 0&lt;br /&gt;
    read_file POWER_1MIN &amp;quot;power_avg&amp;quot; 1 0&lt;br /&gt;
&lt;br /&gt;
    read_file CAPACITY_MWH &amp;quot;remaining_capacity&amp;quot; 1 0&lt;br /&gt;
    read_file CAPACITY_PERCENT &amp;quot;remaining_percent&amp;quot; 1 0&lt;br /&gt;
    read_file REMAINING_RUNNING_TIME &amp;quot;remaining_running_time&amp;quot; 1 0&lt;br /&gt;
    read_file CURRENT_NOW &amp;quot;current_now&amp;quot; 1 0&lt;br /&gt;
    read_file POWER_NOW &amp;quot;power_now&amp;quot; 1 0&lt;br /&gt;
    read_file BATT_TEMPERATURE &amp;quot;temperature&amp;quot; 1 0&lt;br /&gt;
    read_file BATT_VOLTAGE &amp;quot;voltage&amp;quot; 1 0&lt;br /&gt;
    read_file REMAINING_CHARGING_TIME &amp;quot;remaining_charging_time&amp;quot; 1 0&lt;br /&gt;
&lt;br /&gt;
    # fixups&lt;br /&gt;
    give_units DESIGN_CAPACITY &amp;quot;mWh&amp;quot;&lt;br /&gt;
    give_units DESIGN_VOLTAGE &amp;quot;mV&amp;quot;&lt;br /&gt;
    give_units CURRENT_NOW &amp;quot;mA&amp;quot;&lt;br /&gt;
    give_units POWER_NOW &amp;quot;mW&amp;quot;&lt;br /&gt;
    give_units CURRENT_1MIN &amp;quot;mA&amp;quot;&lt;br /&gt;
    give_units POWER_1MIN &amp;quot;mW&amp;quot;&lt;br /&gt;
    give_units LAST_FULL_CAPACITY &amp;quot;mWh&amp;quot;&lt;br /&gt;
    give_units REMAINING_RUNNING_TIME &amp;quot;min&amp;quot;&lt;br /&gt;
    give_units REMAINING_CHARGING_TIME &amp;quot;min&amp;quot;&lt;br /&gt;
    give_units CAPACITY_PERCENT &amp;quot;%&amp;quot;&lt;br /&gt;
    give_units BATT_TEMPERATURE &amp;quot;mC&amp;quot;&lt;br /&gt;
    give_units BATT_VOLTAGE &amp;quot;mV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # some more&lt;br /&gt;
    replace_val REMAINING_RUNNING_TIME &amp;quot;not_discharging&amp;quot; &amp;quot;[not discharging]&amp;quot;&lt;br /&gt;
    replace_val REMAINING_CHARGING_TIME &amp;quot;not_charging&amp;quot; &amp;quot;[not charging]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
&lt;br /&gt;
    BATT_FRU=&lt;br /&gt;
    MANUFACTURER=   &lt;br /&gt;
    BATT_SERIAL=&lt;br /&gt;
    BARCODING=&lt;br /&gt;
    BATT_CHEMISTRY=&lt;br /&gt;
    DESIGN_CAPACITY=&lt;br /&gt;
    DESIGN_VOLTAGE=&lt;br /&gt;
    MANUFACTURE_DATE=&lt;br /&gt;
&lt;br /&gt;
    FIRST_USE_DATE=&lt;br /&gt;
    CYCLE_COUNT=&lt;br /&gt;
    LAST_FULL_CAPACITY=&lt;br /&gt;
    CURRENT_1MIN=&lt;br /&gt;
    POWER_1MIN=&lt;br /&gt;
&lt;br /&gt;
    CAPACITY_MWH=&lt;br /&gt;
    CAPACITY_PERCENT=&lt;br /&gt;
    REMAINING_RUNNING_TIME=&lt;br /&gt;
    CURRENT_NOW=&lt;br /&gt;
    POWER_NOW=&lt;br /&gt;
    BATT_TEMPERATURE=&lt;br /&gt;
    BATT_VOLTAGE=&lt;br /&gt;
    REMAINING_CHARGING_TIME=&lt;br /&gt;
&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  read_file START_CHARGE_THRESH &amp;quot;start_charge_thresh&amp;quot; 1 0&lt;br /&gt;
  read_file STOP_CHARGE_THRESH &amp;quot;stop_charge_thresh&amp;quot; 1 0&lt;br /&gt;
  read_file INHIBIT_CHARGE_MIN &amp;quot;inhibit_charge_minutes&amp;quot; 1 0&lt;br /&gt;
  read_file BATT_FORCE_DISCHARGE &amp;quot;force_discharge&amp;quot; 1 1 1 &amp;quot;yes&amp;quot; 0 &amp;quot;no&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# installed*, state*, dump&lt;br /&gt;
# barcoding, chemistry, design_capacity, design_voltage, manufacture_date, model, manufacturer, serial&lt;br /&gt;
# first_use_date, cycle_count, last_full_capacity, current_avg, power_avg&lt;br /&gt;
# remaining_capacity, remaining_percent, remaining_running_time, current_now, power_now, temperature, voltage, remaining_charging_time&lt;br /&gt;
# start_charge_thresh*, stop_charge_thresh*, inhibit_charge_minutes*, force_discharge*&lt;br /&gt;
&lt;br /&gt;
  cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
BATTERY $SLOT INFORMATION&lt;br /&gt;
=====================&lt;br /&gt;
&lt;br /&gt;
Battery slot:&lt;br /&gt;
  Battery present: $BATT_INSTALLED&lt;br /&gt;
  Battery state: $BATT_STATE&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
  if [ &amp;quot;$BATT_INSTALLED&amp;quot; == &amp;quot;yes&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
    cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
Embedded info:&lt;br /&gt;
  FRU P/N: $BATT_FRU&lt;br /&gt;
  Barcoding: $BARCODING&lt;br /&gt;
  Serial number: $BATT_SERIAL&lt;br /&gt;
  OEM Manufacturer: $MANUFACTURER&lt;br /&gt;
  Chemistry: $BATT_CHEMISTRY&lt;br /&gt;
  Manufacture date: $MANUFACTURE_DATE&lt;br /&gt;
  Design capacity &amp;amp; voltage: $DESIGN_CAPACITY, $DESIGN_VOLTAGE&lt;br /&gt;
&lt;br /&gt;
Battery health:&lt;br /&gt;
  First use date: $FIRST_USE_DATE&lt;br /&gt;
  Cycle count: $CYCLE_COUNT&lt;br /&gt;
  Last full capacity: $LAST_FULL_CAPACITY&lt;br /&gt;
  Average current / power (past 1 minute): $CURRENT_1MIN, $POWER_1MIN&lt;br /&gt;
&lt;br /&gt;
Battery status:&lt;br /&gt;
  Remaining capacity: $CAPACITY_MWH mWh ($CAPACITY_PERCENT)&lt;br /&gt;
  Remaining running time: $REMAINING_RUNNING_TIME&lt;br /&gt;
  Running current &amp;amp; power: $CURRENT_NOW, $POWER_NOW&lt;br /&gt;
  Temperature: $BATT_TEMPERATURE&lt;br /&gt;
  Voltage: $BATT_VOLTAGE&lt;br /&gt;
  Remaining charging time: $REMAINING_CHARGING_TIME&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
Battery charging control:&lt;br /&gt;
  Start charging at: $START_CHARGE_THRESH %&lt;br /&gt;
  Stop charging at: $STOP_CHARGE_THRESH %&lt;br /&gt;
  Prevent charging for: $INHIBIT_CHARGE_MIN min&lt;br /&gt;
  Force battery discharge: $BATT_FORCE_DISCHARGE&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
SHOW_ALL=&lt;br /&gt;
SHOW_BATT=&lt;br /&gt;
SHOW_MISC=&lt;br /&gt;
GOT_OPTS=&lt;br /&gt;
&lt;br /&gt;
while getopts ab:hm OPT&lt;br /&gt;
do&lt;br /&gt;
  GOT_OPTS=y&lt;br /&gt;
  case ${OPT} in&lt;br /&gt;
  a) SHOW_ALL=y;;&lt;br /&gt;
  b) if [ ${OPTARG} -eq 0 -o ${OPTARG} -eq 1 ]&lt;br /&gt;
     then&lt;br /&gt;
       SHOW_BATT=${OPTARG}&lt;br /&gt;
     else&lt;br /&gt;
       SHOW_BATT=y&lt;br /&gt;
     fi&lt;br /&gt;
     ;;&lt;br /&gt;
  h) show_help&lt;br /&gt;
     exit 0&lt;br /&gt;
     ;;&lt;br /&gt;
  m) SHOW_MISC=y;;&lt;br /&gt;
  \?) show_help&lt;br /&gt;
     exit 1&lt;br /&gt;
     ;;&lt;br /&gt;
  esac&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$GOT_OPTS&amp;quot; != y ]&lt;br /&gt;
then&lt;br /&gt;
  show_help&lt;br /&gt;
  exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$SHOW_ALL&amp;quot; == y ]&lt;br /&gt;
then&lt;br /&gt;
  show_misc&lt;br /&gt;
  show_batt 0&lt;br /&gt;
  show_batt 1&lt;br /&gt;
else&lt;br /&gt;
  if [ -n &amp;quot;$SHOW_MISC&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
    show_misc&lt;br /&gt;
  fi&lt;br /&gt;
  if [ -n &amp;quot;$SHOW_BATT&amp;quot; ]&lt;br /&gt;
  then&lt;br /&gt;
    show_batt $SHOW_BATT&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>WilliamPoetra</name></author>
		
	</entry>
</feed>