ubuntu on asus pro 36j

nvidia card

i could not get the nvidia card to work but so far i didn't need it either.. so in order for it not to waste power and decrease the battery live it can be disabled.. (this is more or less a copy of this great article at ubuntuforums.org)

sudo apt-get install git build-essential
git clone http://github.com/mkottman/acpi_call.git
cd acpi_call
make
grep rate /proc/acpi/battery/BAT0/state
--- present rate:            19913 mW
sudo insmod acpi_call.ko
sudo echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
grep rate /proc/acpi/battery/BAT0/state
--- present rate:            12558 mW

the following steps need to be executed after every kernel update:

sudo cp acpi_call.ko /lib/modules/`uname -r`/kernel/drivers/acpi/
sudo depmod

now make sure it is loaded on every start of the system:

sudo nano /etc/modules
--- add "acpi_call" as the last line and save
sudo nano /etc/rc.local
--- add "echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call" as the last line BEFORE exit 0
sudo nano /etc/modprobe.d/blacklist-nvidia.conf

enter these two lines:

blacklist nouveau
blacklist nvidia
sudo update-initramfs -u

now you should be able to reboot the system and then see the same low power consumption as right now.

auto recompile on kernel update

to keep this all working when a new kernel is installed you have to do the following steps:

cd .. && sudo mkdir -p /usr/local/src && sudo cp -r acpi_call /usr/local/src

create a new file

sudo nano /etc/kernel/postinst.d/acpi-call

and paste this into it:

#!/bin/bash

# We're passed the version of the kernel being installed
inst_kern=$1

if [ ! -e /usr/local/src/acpi_call ] ; then
    echo "acpi_call: WARNING - Failed to find source directory /usr/local/src/acpi_call.  Cannot proceed" >&2
    exit 0
fi

cd /usr/local/src/acpi_call/
rm -f acpi_call.ko
make

if [ ! -e acpi_call.ko ] ; then
    echo "acpi_call: WARNING - Failed to build.  Will not be installed in the new kernel" >&2
    exit 0
fi

cp acpi_call.ko /lib/modules/${inst_kern}/kernel/drivers/acpi/

and make it executable:

sudo chmod 755 /etc/kernel/postinst.d/acpi-call

fix suspend (ubuntu < 12.04 only)

This is only valid if you have an ubutu version older than 12.04 or if your 12.04 does not have the most recent updates. with the curren updates (August 1st 2013) the usb suspend fix is not working anymore and therefore breaks suspend once again. at least with 13.04 the usb ports suspend correctly without any further modifications, so you can skip this and only do the suspend fix for the nvidia card (see “ubuntu >= 12.04”) the other annoying thing is that suspend is not working correctly.. luckily the same article as above provides a fix for that too: create a script that will disable the usb ports and re-enable the nvidia card prior to suspending the computer.. the nvidia card needs to be re-enabled because otherwhise it will become impossible to switch it off again after two resumes.. so create a new file

sudo nano /etc/pm/sleep.d/20_custom-asus-pro36jc

and enter this script:

#!/bin/sh

BUSES="0000:00:1a.0 0000:00:1d.0"

case "${1}" in
    hibernate|suspend)
        # Switch USB buses off
        for bus in $BUSES; do
            echo -n $bus | tee /sys/bus/pci/drivers/ehci_hcd/unbind
        done
        # switch off USB 3 bus
        # comment out if usb3 is not working yet with your ubuntu version
        echo -n "0000:07:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
        # Switch nvidia card on before going to sleep, avoids the "constant on"
        # bug that occurs after 2 suspend/resume cycles (thanks kos888)
        echo '\_SB.PCI0.PEG1.GFX0._ON' > /proc/acpi/call
        ;;
    resume|thaw)
        # Switch USB buses back on and nvidia card off
        for bus in $BUSES; do
            echo -n $bus | tee /sys/bus/pci/drivers/ehci_hcd/bind
        done
        # switch that usb3 port back on:
        # comment out if usb3 is not working yet with your ubuntu version 
        echo -n "0000:07:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/bind
        echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
        ;;
esac

now make the file executable:

sudo chmod 755 /etc/pm/sleep.d/20_custom-asus-pro36jc

fix suspend ubuntu >= 12.04

haven't tested this with the current updated version of 12.04 or 12.10 but with 13.04 usb suspend works out of the box. so the only thing that's needed to do now is to turn the nvidia card on before supsend and turn it off after supsend in order not to run into any problems on resuming.. maybe that's not even necessary anymore, but i did it anyway :) so the above /etc/pm/sleep.d/20_custom-asus-pro36jc file should only contain this script:

#!/bin/sh
case "${1}" in
    hibernate|suspend)
        # Switch nvidia card on before going to sleep, avoids the "constant on"
        # bug that occurs after 2 suspend/resume cycles (thanks kos888)
        echo '\_SB.PCI0.PEG1.GFX0._ON' > /proc/acpi/call
        ;;
    resume|thaw)
        echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
        ;;
esac

make it executable as described above and you are good to go..