<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrz</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrz"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Andrz"/>
	<updated>2026-05-13T01:54:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Problem_with_e1000:_EEPROM_Checksum_Is_Not_Valid&amp;diff=36577</id>
		<title>Problem with e1000: EEPROM Checksum Is Not Valid</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Problem_with_e1000:_EEPROM_Checksum_Is_Not_Valid&amp;diff=36577"/>
		<updated>2008-02-25T17:16:27Z</updated>

		<summary type="html">&lt;p&gt;Andrz: /* Solutions */ Added Auke Kok's patches.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Description ==&lt;br /&gt;
On certain ThinkPads, [[e1000]] driver for [[Ethernet_Controllers#Intel_Gigabit_.2810.2F100.2F1000.29|Intel Gigabit controller]] fails to load with the following error message in /var/log/messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e1000: 0000:02:00.0: e1000_probe: The EEPROM Checksum Is Not Valid&lt;br /&gt;
e1000: probe of 0000:02:00.0 failed with error -5 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem is caused by a power savings feature obstructing normal operation, and causes the first bytes read from the EEPROM to be corrupt, resulting in a random or invalid MAC address (but no other data corruption). The EEPROM checksum test traps the problem and the driver refuses to load.&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
Try to reload the e1000 module until the ethernet is pluged in, and the hardware have a chance to detect a link.&lt;br /&gt;
&lt;br /&gt;
=== Use e1000e---Kernel Patch ===&lt;br /&gt;
Auke Kok published two patches in October 2007 that help solve both the &amp;quot;corrupted&amp;quot; EEPROM read and bad latency.&lt;br /&gt;
One of the patches moves many network cards over to the e1000e (e1000 for PCI-Express) module. The second disables some PCIe power management features that were the cause for the bad EEPROM read and some stability issues.&lt;br /&gt;
 [http://kerneltrap.org/mailarchive/linux-netdev/2007/10/31/374579 &amp;lt;nowiki&amp;gt;[PATCH 3/4] e1000/e1000e: Move PCI-Express device IDs over to e1000e&amp;lt;/nowiki&amp;gt;]&lt;br /&gt;
 [http://kerneltrap.org/mailarchive/linux-netdev/2007/10/31/374573 &amp;lt;nowiki&amp;gt;[PATCH 2/4] e1000e: Disable L1 ASPM power savings for 82573 mobile variants&amp;lt;/nowiki&amp;gt;]&lt;br /&gt;
Refer to [http://www.linuxhq.com/patch-howto.html LinuxHQ] on how to apply kernel patches.&lt;br /&gt;
&lt;br /&gt;
=== From Lenovo ===&lt;br /&gt;
Lenovo provides a [http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&amp;amp;lndocid=MIGR-67166 script] that uses 'ethtool' command to update the card's settings. They say it is for SLED 10 but the Linux flavor shouldn't really matter. For some users, neither of the circumventions listed below help, but this script does!&lt;br /&gt;
&lt;br /&gt;
=== Via module parameter ===&lt;br /&gt;
&lt;br /&gt;
In recent kernels (at least with 2.6.22, maybe also in 2.6.21) there is a kernel module option to make the module ignore the error.&lt;br /&gt;
&lt;br /&gt;
Load the module like this &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
modprobe e1000 eeprom_bad_csum_allow=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might also apply that parameter via modprobe.d or if you are using Debian/Ubuntu as append-line in your bootloader: e1000.eeprom_bad_csum_allow=1&lt;br /&gt;
&lt;br /&gt;
=== From Mat's Blog ===&lt;br /&gt;
The fundamental solution is explained at [http://www.matinfo.ch/blog/archive/2007/01/26/intel-nic-pxe-e05-error.html Mat's Blog]&lt;br /&gt;
which directs the reader to Intel's site to download [http://downloadcenter.intel.com/detail_desc.aspx?agr=Y&amp;amp;ProductID=412&amp;amp;DwnldID=8242&amp;amp;lang=eng PROBOOT.EXE].&lt;br /&gt;
Extract files from PROBOOT.EXE onto a bootable DOS device. Boot from it. Then run the command &amp;quot;IBAUTIL -DEFCFG&amp;quot;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
After IBAUTIL -DEFCFG, you may have your mac address changed. Then you can update it with the real one with a dos binary to put an a bootable cd : EEUPDATE.EXE&lt;br /&gt;
For example, EEUPDATE /NIC=1 /MAC=XX:XX:XX:XX:XX:XX. Then, no more &amp;quot;invalid mac address&amp;quot; message using linux and no need to use MACAddressChanger for windows :)&lt;br /&gt;
&lt;br /&gt;
Where you can find this magic tool : ftp://ftp.extensa.ru/Drivers/DESKTOPS/Ver_x900/BIOS_XP/AMT/&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Circumvention ==&lt;br /&gt;
&lt;br /&gt;
* Upgrade your BIOS&lt;br /&gt;
&lt;br /&gt;
Lenovo has published newer BIOS revisions that appear to fix the issue for some users. The BIOS upgrade turns off &amp;quot;Deep smart power down&amp;quot; which has been known to cause issues at initialization time (the driver can re-enable the issue later if you desire, the feature works correctly then).&lt;br /&gt;
&lt;br /&gt;
* Insert a cable&lt;br /&gt;
&lt;br /&gt;
Inserting a linked network cable bypasses the problem.&lt;br /&gt;
&lt;br /&gt;
* Take the checksum twice&lt;br /&gt;
&lt;br /&gt;
This [http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1474679&amp;amp;group_id=42302&amp;amp;atid=447449 bug report] describes a fix -- take the checksum twice.  First time will report a bad checksum, second will work (the problem seems to be triggered by some power-saving technology).  This requires a tweak to the driver source and a rebuild of your kernel.  This is much better than a previous &amp;quot;fix&amp;quot; published here that disabled checksum checking entirely.&lt;br /&gt;
&lt;br /&gt;
I updated the patch above to 2.6.22:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -urN linux-2.6.22-suspend2-r1.orig/drivers/net/e1000/e1000_main.c linux-2.6.22-suspend2-r1/drivers/net/e1000/e1000_main.c&lt;br /&gt;
--- linux-2.6.22-suspend2-r1.orig/drivers/net/e1000/e1000_main.c        2007-08-17 23:32:04.000000000 +0200&lt;br /&gt;
+++ linux-2.6.22-suspend2-r1/drivers/net/e1000/e1000_main.c     2007-09-05 16:39:11.000000000 +0200&lt;br /&gt;
@@ -999,16 +999,18 @@&lt;br /&gt;
                goto err_eeprom;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
-       /* before reading the EEPROM, reset the controller to&lt;br /&gt;
-        * put the device in a known good starting state */&lt;br /&gt;
-&lt;br /&gt;
-       e1000_reset_hw(&amp;amp;adapter-&amp;gt;hw);&lt;br /&gt;
-&lt;br /&gt;
-       /* make sure the EEPROM is good */&lt;br /&gt;
-&lt;br /&gt;
        if (e1000_validate_eeprom_checksum(&amp;amp;adapter-&amp;gt;hw) &amp;lt; 0) {&lt;br /&gt;
-               DPRINTK(PROBE, ERR, &amp;quot;The EEPROM Checksum Is Not Valid\n&amp;quot;);&lt;br /&gt;
-               goto err_eeprom;&lt;br /&gt;
+               /* before reading the EEPROM, reset the controller to&lt;br /&gt;
+                * put the device in a known good starting state */&lt;br /&gt;
+               &lt;br /&gt;
+               e1000_reset_hw(&amp;amp;adapter-&amp;gt;hw);&lt;br /&gt;
+&lt;br /&gt;
+               /* make sure the EEPROM is good */&lt;br /&gt;
+&lt;br /&gt;
+               if (e1000_validate_eeprom_checksum(&amp;amp;adapter-&amp;gt;hw) &amp;lt; 0) {&lt;br /&gt;
+                       DPRINTK(PROBE, ERR, &amp;quot;The EEPROM Checksum Is Not Valid\n&amp;quot;);&lt;br /&gt;
+                       goto err_eeprom;&lt;br /&gt;
+               }&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        /* copy the MAC address out of the EEPROM */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[User:Ra|Ra]] 15:28, 5 September 2007 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Remove/add kernel module&lt;br /&gt;
&lt;br /&gt;
Removing and adding the kernel module is a possible work-around. As root, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# modprobe -r e1000&lt;br /&gt;
# modprobe e1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On some occasions, the commands have to be run twice before eth0 becomes useable.&lt;br /&gt;
On some X60s this will not work at all.&lt;br /&gt;
&lt;br /&gt;
* Disabling and re-enabling the NIC in the BIOS&lt;br /&gt;
&lt;br /&gt;
For some it fixed the issue finally, for some it helped just temporarily.&lt;br /&gt;
&lt;br /&gt;
* Hacking the kernel to carry on even if the checksum is not valid&lt;br /&gt;
&lt;br /&gt;
Although being a very ugly, hack, this works fine for me. To do that, you have to search drivers/net/e1000/e1000_main.c for the line containing the error message and then comment out the following two lines which set the error state and then jump to the error code. Although this doesn't fry the hardware for me, consider yourself warned...&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&amp;amp;lndocid=MIGR-67166 Lenovo's solution]&lt;br /&gt;
* [http://sourceforge.net/tracker/index.php?func=detail&amp;amp;aid=1474679&amp;amp;group_id=42302&amp;amp;atid=447449 bug report] submitted for e1000 driver.&lt;br /&gt;
* Discussion at [http://forums.gentoo.org/viewtopic-t-476305-highlight-e1000.html Gentoo forums]&lt;/div&gt;</summary>
		<author><name>Andrz</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=30205</id>
		<title>Code/thinkpad-smapi.sh</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Code/thinkpad-smapi.sh&amp;diff=30205"/>
		<updated>2007-06-01T12:57:40Z</updated>

		<summary type="html">&lt;p&gt;Andrz: -c option in shebang is unnecessary.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#!/bin/bash&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>Andrz</name></author>
		
	</entry>
</feed>