Login Main site Create account

04.03.2005 08:50

Getting Smart Battery System (SBS) on an Acer Travelmate 4000 Series Laptop to work with Linux


Yesterday I found an interesting sourceforge-project (sbs-linux [EN]) that deals with supporting the Smart Battery System (SBS) found in some laptops.
As I have some Acer Travelmate 4001LCi laptops at work as platform for my thinclient installation, I always wanted to know the state of my battery. All other laptops work fine with my xbattbar modification, but this model doesn't.

To keep it short: It works now.
Here are the steps one needs to go to get this working:

  1. Download the latest sbs-cm tgz-archive from http://sourceforge.net/projects/sbs-linux

  2. Download the Intel iasl compiler from http://developer.intel.com/technology/iapc/acpi/downloads.htm

  3. To compile this compiler you need "bison" and "flex" installed (Note for Debian users: you need the "flex-old" package instead of "flex", otherwise the compilation doesn't succeed).
    vi-dsdt:~# tar xfz acpica-unix-20050211.tar.gz
    vi-dsdt:~# cd acpica-unix-20050211/compiler
    vi-dsdt:~/acpica-unix-20050211/compiler# make
    
    If everything is fine, you should have a binary file called "iasl" in this directory. Copy it anywhere to your $PATH or remind where it's located.

  4. Extract the current DSDT from your running kernel
    vi-dsdt:~# cp /proc/acpi/dsdt dsdt.dat
    
  5. Decompile dsdt.dat with iasl
    vi-dsdt:~# iasl -d dsdt.dat
    
    Intel ACPI Component Architecture
    ASL Optimizing Compiler / AML Disassembler version 20050211 [Mar  3 2005]
    Copyright (C) 2000 - 2005 Intel Corporation
    Supports ACPI Specification Revision 3.0
    
    Loading Acpi table from file dsdt.dat
    Acpi table [DSDT] successfully installed and loaded
    Pass 1 parse of [DSDT]
    Pass 2 parse of [DSDT]
    Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)
    ...........................................................................
    ...........................................................................
    ...........................................................................
    ...........................................................................
    Parsing completed
    Disassembly completed, written to "dsdt.dsl"
    vi-dsdt:~#
    

    Now you should get a file called "dsdt.dsl" in your CWD.

  6. Patch dsdt.dsl with the patches from sbs-cm (verify, that all .asl files and the diff file of your choice is in the same directory as dsdt.dsl)
    vi-dsdt:~# ls
    Acer4xxx-DSDT.aml        dsdt.dat  iasl           sbs-cm-2b.asl  tc
    acer-tm4xxx-sbs-cm.diff  dsdt.dsl  sbs-cm-1b.asl  smbus-cm.asl
    vi-dsdt:~# patch <acer-tm4xxx-sbs-cm.diff
    patching file dsdt.dsl
    vi-dsdt:~#  
    
  7. Compile the modified dsdt.dsl with iasl
    vi-dsdt:~# iasl dsdt.dsl
    
    Intel ACPI Component Architecture
    ASL Optimizing Compiler / AML Disassembler version 20050211 [Mar  3 2005]
    Copyright (C) 2000 - 2005 Intel Corporation
    Supports ACPI Specification Revision 3.0
    
    dsdt.dsl   245:     Method (_WAK, 1, NotSerialized)
    Warning  2026 -                ^ Reserved method must return a value (_WAK)
    
    dsdt.dsl  4404:                         Method (_STA, 0, NotSerialized)
    Warning  2019 -                                    ^ Not all control paths return a value (_STA)
    
    dsdt.dsl  4404:                         Method (_STA, 0, NotSerialized)
    Warning  2026 -                                    ^ Reserved method must return a value (_STA)
    
    smbus-cm.asl    84:         Method (_SBI, 0, NotSerialized)
    Warning  2033 -  Unknown reserved name ^  (_SBI)
    
    smbus-cm.asl   144:         Method (_SBR, 3, NotSerialized)
    Warning  2033 -  Unknown reserved name ^  (_SBR)
    
    smbus-cm.asl   234:         Method (_SBW, 5, NotSerialized)
    Warning  2033 -  Unknown reserved name ^  (_SBW)
    
    smbus-cm.asl   311:         Method (_SBA, 0, NotSerialized)
    Warning  2033 -  Unknown reserved name ^  (_SBA)
    
    ASL Input:  dsdt.dsl - 4939 lines, 232406 bytes, 2907 keywords
    AML Output: DSDT.aml - 24793 bytes 707 named objects 2200 executable opcodes
    
    Compilation complete. 0 Errors, 7 Warnings, 0 Remarks, 779 Optimizations
    vi-dsdt:~#
    

    As you can see, there are several warnings which means, that the patch provided by sbs-cm is not fully applicable to the DSDT of this laptop. So I corrected some of these warnings by hand for my DSDT. If your warnings are similar to mine, you may use my acer-tm4001LCi-sbs-cm.diff instead of the acer-tm4xxx-sbs-cm.diff provided by the sbs-cm package.
    With this patch, all warnings (except for the 2033 warnings) are cleaned. If you have any idea of how to get rid of the last four messages, please send me an e-mail.

  8. After completion you should have a "DSDT.aml" file in your CWD. Now you have to add this DSDT to your kernel by either compiling it into your kernel or by using an initrd. I decided the initrd-method, because I already have an initrd for bootsplash and so I only had to append the modified DSDT to my initrd.
    vi-dsdt:~# echo -n "INITRDDSDT123DSDT123" >>/boot/initrd.splash
    vi-dsdt:~# cat DSDT.aml >>/boot/initrd.splash
    vi-dsdt:~#
    
    The "-n" is mandatory in this place, unlike mentioned in other documentations! If you omit the "-n" your DSDT will not be found at boot-time.

  9. Adding DSDT in intrd support to your kernel
    Apply the apropriate patch from http://gaugusch.at/kernel.shtml to your kernel source and enable the new option CONFIG_ACPI_CUSTOM_DSDT_INITRD at the ACPI options. (local copy of the patch for 2.6.9 to 2.6.11). As mentioned on another webresource, you should also apply acpi-ec-nospinlock-2.6.10.diff to prevent your kernel from going crazy when polling ACPI battery state every few seconds.
    Recompile your kernel, install it and reboot.

  10. If everything worked fine, you should get a message like this one in your dmesg log:
    vi-dsdt:~# dmesg | grep Looking
    ACPI: Looking for DSDT in initrd... found (at offset 0x32f14).
    vi-dsdt:~#
    
Additional Links with detailed information about this topic:
Currently no comments to this entry (http://tuxx-home.at/archives/2005/03/04/T08_50_23/index.html)


Your comment (HTML tags will be stripped !!):

To verify You are not a bot, type down text from this image.

Your try: