Getting maximum battery time from an ASUS eeePC 1015pn

Well, of course the easisest would be to buy a fatter battery, but that would kind of kill the idea of having a really portable and sleak little machine, mine has the smallest battery, only 4400mAh and that’s not much.
How about increasing battery time on this little baby from around 4 hours to 5.5 hours? Possible? indeed, this machine has hybrid ION graphics, i.e. it has two graphics cards, one Nvidia discret card and one Intel gpu integrated with the Atom cpu. Installing OpenSUSE 11.4 32 bit on this netbook will give you a system running on the Nvidia card by default, with 4 hours battery time, I’ll show you howe to make it possible to run it for up to 5.5 hours on the Intel graphics gpu and still have the possibillity to switch it to run on the Nvidia gpu for perfomance.

What you’ll need to do first is simple enough, enable the Packman repo, if you haven’t already, and install the package DKMS. If you didn’t install the pattern linux kernel development at install do run the following command:

zypper in -t pattern devel_kernel

Now exit root and run the following command, from your home or desktop folder:

git clone https://github.com/MrMEEE/bumblebee.git

So we have a folder bumblebee but we arn’t gonna use bumblebee in this HOWTO, just cd to bumblebee/stages, once there su to root and do the following:

chmod +x acpicall.OPENSUSE
./acpicall.OPENSUSE

You’ve just finished the installation of the module acpi_call, that was easy, wasn’t it? Now fire up yast, click on system>etc/sysconfig-editor>System>Kernel>MODULES_LOADED_ON_BOOT, add acpi_call and click Ok.

Now just one final step, su to root and run vim /etc/init.d/halt.local, or if you’re more comfortable with gedit run gnomesu gedit, forgive me if you’re on KDE it’s probably just as easy, then add the following line:

echo "\OSGS 0x01" > /proc/acpi/call

The above line is what sets which graphics mode the machine will run in 01 is intel mode, 02 is Nvidia mode and 03 is Optimus mode, whenever you wish to set Nvidia back change the mode back to 02 before you reboot, but don’t try with any other values, I can’t guaratee what will happen, TAKE CARE!
We are almost finished, just to spare us an extra reboot, su to root and do the following:

modprobe acpi_call

And to give you an example, before you reboot make sur to be on battery and do the following, notice the present rate value and compare to what you get after reboot:

cat /proc/acpi/battery/BAT0/state

Now reboot!

Issue with step 2


html> git clone https://github.com/MrMEEE/bumblebee.git
Cloning into bumblebee...
fatal: https://github.com/MrMEEE/bumblebee.git/info/refs not found: did you run git update-server-info on the server?


I see, things have changed a lot, bumblebee doesn’t use acpi_call anymore, you can still get it from here:

GitHub - mkottman/acpi_call: A linux kernel module that enables calls to ACPI methods through /proc/acpi/call. Now with support for Integer, String and Buffer parameters.

I still have a copy of the installation script acpicall.OPENSUSE, copy it from here:

KERNEL_TYPE=`uname -r | cut -f3 -d"-"`

INSTALLED=`zypper --no-refresh info kernel-$KERNEL_TYPE-devel | grep Installed: | cut -f2 -d' '`
if  "$INSTALLED" != "Yes" ] ; then
  echo "Do you want me to install the kernel-devel and kernel-$KERNEL_TYPE-devel packages"
  echo "needed for the acpi_call build (y/n) ?"
  read answer
  case "$answer" in
  y|Y)
    if  "$INSTALLED" != "Yes" ] ; then
      zypper install kernel-$KERNEL_TYPE-devel
      if  $? -ne 0 ]; then
	echo
	echo "Package manager failed to install needed packages..."
	echo
	exit 21
      fi
    fi
    zypper update
  ;;
  n|N)
    echo "Packages will NOT be installed."
  ;;
  *)
  ;;
  esac
fi

INSTALLED=`zypper --no-refresh info gcc | grep Installed: | cut -f2 -d' '`
if  "$INSTALLED" != "Yes" ] ; then
  echo "Do you want me to install the git, make and gcc packages"
  echo "needed for the acpi_call build (y/n) ?"
  read answer
  case "$answer" in
  y|Y)
    if  "$INSTALLED" != "Yes" ] ; then
      zypper install git-core make gcc
      if  $? -ne 0 ]; then
	echo
	echo "Package manager failed to install needed packages..."
	echo
	exit 21
      fi
    fi
    zypper update
  ;;
  n|N)
    echo "Packages will NOT be installed."
  ;;
  *)
  ;;
  esac
fi

INSTALLED=`zypper --no-refresh info dkms | grep Installed: | cut -f2 -d' '`
if  "$INSTALLED" != "Yes" ] ; then
  echo "Do you want me to install the dkms package needed for the acpi_call build (y/n) ?"
  read answer
  case "$answer" in
  y|Y)
    VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f3 -d" "`
    zypper --plus-repo http://packman.inode.at/suse/openSUSE_$VERSION/Extra install dkms
    if  $? -ne 0 ]; then
      echo
      echo "Package manager failed to install needed package..."
      echo
      exit 21
    fi
    zypper update
  ;;
  n|N)
    echo "Package will NOT be installed."
  ;;
  *)
  ;;
  esac
fi

ACPICALLVERSION=1.0

if  `dkms status |grep acpi_call | wc -l` -gt 0 ]; then
 echo 
 echo "acpi_call module already installed, do you want to update/reinstall? (y/n)"
 echo
 read answer

 case "$answer" in
  y | Y )
   dkms uninstall -m acpi_call -v `dkms status |grep acpi_call |cut -f2 -d, |cut -f1 -d:`   
   dkms remove -m acpi_call -v `dkms status |grep acpi_call |cut -f2 -d, |cut -f1 -d:` --all
   rm -rf /usr/src/acpi_call*
   cd /tmp
   git clone http://github.com/mkottman/acpi_call.git
   mv acpi_call /usr/src/acpi_call-$ACPICALLVERSION

   echo 'PACKAGE_NAME="acpi_call"
   PACKAGE_VERSION="'$ACPICALLVERSION'"
   CLEAN="make clean"
   BUILT_MODULE_NAME[0]="acpi_call"
   DEST_MODULE_NAME[0]="acpi_call"
   MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir
   PWD=$dkms_tree/acpi_call/1.0/build" 
   DEST_MODULE_LOCATION[0]="/updates/dkms/"
   AUTOINSTALL="yes"' > /usr/src/acpi_call-$ACPICALLVERSION/dkms.conf

   dkms add -m acpi_call -v $ACPICALLVERSION
   dkms build -m acpi_call -v $ACPICALLVERSION
   dkms install -m acpi_call -v $ACPICALLVERSION

   cd "$BUMBLEBEEPWD"
  ;;

  *)
  
  ;;
 esac 
else

 rm -rf /usr/src/acpi_call*
 cd /tmp
 git clone http://github.com/mkottman/acpi_call.git
 mv acpi_call /usr/src/acpi_call-$ACPICALLVERSION

 echo 'PACKAGE_NAME="acpi_call"
 PACKAGE_VERSION="'$ACPICALLVERSION'"
 CLEAN="make clean"
 BUILT_MODULE_NAME[0]="acpi_call"
 DEST_MODULE_NAME[0]="acpi_call"
 MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir
 PWD=$dkms_tree/acpi_call/1.0/build"
 DEST_MODULE_LOCATION[0]="/updates/dkms/"
 AUTOINSTALL="yes"' > /usr/src/acpi_call-$ACPICALLVERSION/dkms.conf

 dkms add -m acpi_call -v $ACPICALLVERSION
 dkms build -m acpi_call -v $ACPICALLVERSION
 dkms install -m acpi_call -v $ACPICALLVERSION

 cd "$BUMBLEBEEPWD"
fi

Put it in the acpi_call folder and execute it. If you intend to use acpi_call in the future back up all this, they’re only useful on the 1015pn so they might disappear.
Besides this I don’t put any code into halt.local anymore, I use this in /etc/init.d/boot.local to get full glx support for both graphics systems:

#!/bin/sh
# Read what graphics mode we are in.
modprobe acpi_call
echo "\AMW0.DSTS 0x90013" > /proc/acpi/call
mode=$(cat /proc/acpi/call)
	
    case $mode in
# We are in Intel mode.	
      0x30001)	
# Make sure to get rid of nVidia extensions for this session.
	
if  -e /usr/lib/xorg/modules/updates/extensions/libglx.so ]; then
	/bin/rm /usr/lib/xorg/modules/updates/extensions/libglx.so
fi 
if  -e /usr/X11R6/lib/libGL.so.1 ]; then
	/bin/rm /usr/X11R6/lib/libGL.so.1
fi
# Set bios to boot in Intel mode for next session.	
	echo "\OSGS 0x01" > /proc/acpi/call
	
	;;
# We are in nVidia mode.	
      0x30002) 
# Restore nVidia extensions for this session.
	
	/bin/ln -s /usr/lib/xorg/modules/updates/extensions/libglx.so.* /usr/lib/xorg/modules/updates/extensions/libglx.so
	/sbin/ldconfig /usr/X11R6/lib
# Set bios to boot in nVidia mode for next session.
	echo "\OSGS 0x02" > /proc/acpi/call	
        
	;;
# We are in Optimus mode.	
      0x30003) 
# Make sure to get rid of nVidia extensions for this session. This will give direct rendering on the Intel chip, the nVidia card will only run in the background, eating your battery and produce heat. It is however possible to turn off the nVidia card in this mode, but watch out it may be turned on when the system returns from sleep mode, so better stick to Intel mode.
# Turn it off here.
#echo "\_SB.PCI0.P0P4.DGPU.DOFF" > /proc/acpi/call
	
	/bin/rm /usr/lib/xorg/modules/updates/extensions/libglx.so
	/bin/rm /usr/X11R6/lib/libGL.so.1
# Set bios to boot in Optimus mode for next session.
	echo "\OSGS 0x03" > /proc/acpi/call	
        
	;;

    esac 


To prevent ldconfig from restoring the nvidia symlinks I edit out the line “/usr/X11R6/lib” in /etc/ld.so.conf.d/nvidia-gfxG02.conf for 12.1 and in /etc/ld.so.conf for 11.4. Probably those changes are overwritten at a nvidia driver update.

Good luck!