Update 18/03/2014: I'm sad to announce I no longer have this computer nor any PC with hybrid graphics... My ASUSM51Ta passed away, so I no longer could compile kernels and test things on hybrid graphics. As far as I know this technology is already supported more easily Hybrid Graphics Wiki.

First of all, this HowTo is intended to people like me with almost no knowledge about compiling and patching kernels. Also to people that may want to share their experience using the vga_switcheroo (now included in kernel 2.6.35 onwards) from David Airlie with their own machines with switchable graphics.


If you want to test this HowTo on your computer, please post your experience at the mailing list of https://launchpad.net/%7Ehybrid-graphics-linux

For more info about hybrid graphics consult:
http://linux-hybrid-graphics.blogspot.com/


Notes:





GNU/Linux used: Fedora / Ubuntu
Machine: ASUS M51Ta
Graphic card configuration:
- Integrated: 01:05.0 VGA compatible controller: ATI Technologies Inc RS780M/RS780MN [Radeon HD 3200 Graphics]
- Discrete: 02:00.0 VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3650



[10/11/2010] Fedora 14 / Ubuntu 10.10 + vga_switcheroo + switch scripts

(0) Install Fedora 14 / Ubuntu 10.10, install needed packages & download icons

(0.1) Burn a CD or make a bootable USB with your fabourite distribution and install it on your laptop.


Fedora 14





Ubuntu 10.10




(0.2) Install the following packages from the command line and download icons:


$ sudo yum update
$ sudo yum install wget gxmessage libnotify-bin
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYqzYlP-BgyTv19LpPlAhqZfODsNZB-eyiNOf6e__FS8AOudy-wIEhyLXMLVnSndIkv9rrii3Sy58mJnx8O3IlrdrY5nr4Rf7CHhbqlaRsH5vLIkr1xB3Kg_TTkWmBHogBu-HOEcGX-8w/s800/hardware_down.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdTtB-ginD408jKwWn5eKv7_Yf1MJ0I2H4yVP-Ot8z633v34txixBOxVh4AoetVM5MJBi80bBMH3D9zdIHdBEtLsIbaLHDHA2RG2YbVcHj_I_VJslyKq9g448x18PjX_JDxuwk4GGvpQ/s800/hardware_up.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMiEkJp62CAGJtyiocxgdnnK4_doiE4BvQ15Rpuzo9k3IWw4HHz8cxGmKpmncXAXE0r0w8Nyo4cKmbUbijmwl2rzxgA6j_N061o9kvkv9PKtsc3ZcaZWWTrgxAXfNCj934IBCYdDapqHc/s800/hardware.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGcHDeXc2UtTpphrPGhwCabFs-k9Rg_nzwgUO2G-LSOSrvd-oYDK5hNHyDS7F9_yj-7VAEZeFRPhe4TlfmMV68FODmDyEelcLTLG_PUOPgA70p-UTdFDTnCNa3LeHKS-e-5Kox4O9VG3E/s800/switch_before_shutdown.png



$ sudo apt-get update
$ sudo apt-get install wget gxmessage libnotify-bin
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYqzYlP-BgyTv19LpPlAhqZfODsNZB-eyiNOf6e__FS8AOudy-wIEhyLXMLVnSndIkv9rrii3Sy58mJnx8O3IlrdrY5nr4Rf7CHhbqlaRsH5vLIkr1xB3Kg_TTkWmBHogBu-HOEcGX-8w/s800/hardware_down.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdTtB-ginD408jKwWn5eKv7_Yf1MJ0I2H4yVP-Ot8z633v34txixBOxVh4AoetVM5MJBi80bBMH3D9zdIHdBEtLsIbaLHDHA2RG2YbVcHj_I_VJslyKq9g448x18PjX_JDxuwk4GGvpQ/s800/hardware_up.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMiEkJp62CAGJtyiocxgdnnK4_doiE4BvQ15Rpuzo9k3IWw4HHz8cxGmKpmncXAXE0r0w8Nyo4cKmbUbijmwl2rzxgA6j_N061o9kvkv9PKtsc3ZcaZWWTrgxAXfNCj934IBCYdDapqHc/s800/hardware.png
$ wget -P /home/"$USER"/.local/share/icons/ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGcHDeXc2UtTpphrPGhwCabFs-k9Rg_nzwgUO2G-LSOSrvd-oYDK5hNHyDS7F9_yj-7VAEZeFRPhe4TlfmMV68FODmDyEelcLTLG_PUOPgA70p-UTdFDTnCNa3LeHKS-e-5Kox4O9VG3E/s800/switch_before_shutdown.png


(1) Mount "none" partition on fstab (just on Fedora, Ubuntu does it by default)


$ sudo gedit /etc/fstab
And add the following line:
none                    /sys/kernel/debug debugfs defaults 0 0


(2) Change switch file permissions every time computer initiates


$ sudo gedit /etc/rc.d/rc.local
And add the following lines:

chown "username" /sys/kernel/debug/vgaswitcheroo/switch # change "username" with your user name
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


$ sudo gedit /etc/rc.local
And add the following lines:

chown "username" /sys/kernel/debug/vgaswitcheroo/switch # change "username" with your user name
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


(3) Reboot & copy and run script to switch between graphic cards

switch_between_cards.sh

#!/bin/bash
# "switch_between_cards.sh" script by RM, with useful changes from LoLL
# version 20101107

pci_integrated=$(lspci | grep VGA | sed -n '1p' | cut -f 1 -d " ")
pci_discrete=$(lspci | grep VGA | sed -n '2p' | cut -f 1 -d " ")

integrated=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_integrated | grep -o -P ':.:...:')
discrete=$(cat /sys/kernel/debug/vgaswitcheroo/switch | grep $pci_discrete | grep -o -P ':.:...:')

name_integrated=$(lspci | grep VGA | sed -n '1p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")

name_discrete=$(lspci | grep VGA | sed -n '2p' | sed -e "s/.* VGA compatible controller[ :]*//g" | sed -e "s/ Corporation//g" | sed -e "s/ Technologies Inc//g" | sed -e 's/\[[0-9]*\]: //g' | sed -e 's/\[[0-9:a-z]*\]//g' | sed -e 's/(rev [a-z0-9]*)//g' | sed -e "s/ Integrated Graphics Controller//g")

if [ "$integrated" = ":+:Pwr:" ]
then
integrated_condition="(*) - Power ON"
elif [ "$integrated" = ": :Pwr:" ]
then
integrated_condition="( ) - Power ON"
elif [ "$integrated" = ": :Off:" ]
then
integrated_condition="( ) - Power OFF"
fi

if [ "$discrete" = ":+:Pwr:" ]
then
discrete_condition="(*) - Power ON"
elif [ "$discrete" = ": :Pwr:" ]
then
discrete_condition="( ) - Power ON"
elif [ "$discrete" = ": :Off:" ]
then
discrete_condition="( ) - Power OFF"
fi

gxmessage -center \
-buttons "_Cancel":1,"switch to _Integrated":101,"switch to _Discrete":102 \
-wrap \
-title "Choose Hybrid Graphic Card" \
"Choose Hybrid Graphic Card
=================
Integrated: $integrated_condition : $name_integrated
Discrete: $discrete_condition : $name_discrete"


whichCard=$?

case "$whichCard" in

1)
echo "Exit"
;;
101)
if [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$integrated" == ": :Pwr:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
if [ "$DESKTOP_SESSION" = "openbox" ]
then
killall -u "$USER"
elif [ "$DESKTOP_SESSION" = "gnome" ]
then
gnome-session-save --logout
fi
elif [ "$integrated" == ": :Off:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "switching to $name_integrated"
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
if [ "$DESKTOP_SESSION" = "openbox" ]
then
killall -u "$USER"
elif [ "$DESKTOP_SESSION" = "gnome" ]
then
gnome-session-save --logout
fi
elif [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Off:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_down.png" "already switched to $name_integrated"
fi
;;
102)
if [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
if [ "$DESKTOP_SESSION" = "openbox" ]
then
killall -u "$USER"
elif [ "$DESKTOP_SESSION" = "gnome" ]
then
gnome-session-save --logout
fi
elif [ "$integrated" == ": :Pwr:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
elif [ "$integrated" == ":+:Pwr:" ] && [ "$discrete" == ": :Off:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "switching to $name_discrete"
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
if [ "$DESKTOP_SESSION" = "openbox" ]
then
killall -u "$USER"
elif [ "$DESKTOP_SESSION" = "gnome" ]
then
gnome-session-save --logout
fi
elif [ "$integrated" == ": :Off:" ] && [ "$discrete" == ":+:Pwr:" ]
then
notify-send -t 5000 --icon="/home/$USER/.local/share/icons/hardware_up.png" "already switched to $name_discrete"
fi
;;
esac


(4) OPTIONAL: Script to turn off laptop

This next script is used to turn off the computer. Because, in my case, if I turn off the computer without switching on both cards (specially when the integrated card is on and the discrete card is off), the fan runs at full speed when I turn it on again, stoping only after rebooting. Hence, to avoid this, this other launcher can be used to turn off the computer:

switch_before_shutdown.sh

#!/bin/bash

if [ "$DESKTOP_SESSION" = "openbox" ]
then
gxmessage "Are you sure you want to shut down your computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"L_ock screen":101,"_Log out":102,"_Reboot":103,"_Shut down":104

case $? in

1)
echo "Exit";;
101)
xscreensaver-command -lock;;
102)
killall openbox;;
103)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch;
gnome-terminal -e 'sudo shutdown -r now';;
104)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
gnome-terminal -e 'sudo shutdown -h now';;
esac

elif [ "$DESKTOP_SESSION" = "gnome" ]
then

gxmessage "Are you sure you want to shut down your computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"L_ock screen":101,"_Log out":102,"_Reboot":103,"_Shut down":104

case $? in

1)
echo "Exit";;
101)
gnome-screensaver-command -l;;
102)
gnome-session-save --logout;;
103)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch;
gnome-terminal -e 'sudo shutdown -r now';;
104)
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
gnome-terminal -e 'sudo shutdown -h now';;
esac

fi


I tested this HowTo on my laptop with Fedora 14 (x64) and Ubuntu 10.10 (x32). Please write me if you find any errors or have any sugestion to modify and improve this HowTo.



59 comments:

  1. @AMartin: Thanks for your comment about the location of the "rc.local" file (which is located at "/etc/rc.local" in Ubuntu).

    ReplyDelete
  2. I have Ubuntu 10.10 on an aspire laptop which has intel and nvidia graphics card. I am still seeking a way to turn on the nvidia graphics card. There is no /sys/kernel/debug/vgaswitcheroo directory on my machine. The only reference to switcheroo is some header files. I can't find a module to load or anything else that might force it to appear. Is there some magic I don't know about?

    ReplyDelete
  3. Hi... I wrote this some days ago but I can't find a solution...
    Hi...
    I have a Laptop HP Pavalion Dv6-3031ss, it have an ATI Radeon HD 5470 and an Intel HD.... by default, when Linux start the active card is the Intel HD, I don't know if the ATI is powered or not. I use Kubuntu Maverick 10.10 as OS. My first problem is that to slow and that is for the Video Card because KDE use a lot of video features. So I need to turn off my Intel Card and work with the ATI card....
    Here are the results of my tests...

    lmgarcess@Drake:~$ sudo acpidump > acpidump.txt && sudo acpixtract acpidump.txt && iasl -d DSDT.dat && ls -l DSDT.dsl
    Acpi table [DSDT] - 61269 bytes written to DSDT.dat
    Acpi table [SSDT] - 2545 bytes written to SSDT1.dat
    Acpi table [SSDT] - 6726 bytes written to SSDT2.dat

    Intel ACPI Component Architecture
    AML Disassembler version 20090521 [Jun 30 2009]
    Copyright (C) 2000 - 2009 Intel Corporation
    Supports ACPI Specification Revision 3.0a

    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)
    ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................< wbr>...........................................................................................................................................................................................................
    Parsing completed

    Found 8 external control methods, reparsing with new information
    Fallo de segmentación

    lmgarcess@Drake:~/acpi_call$ sudo insmod acpi_call.ko
    lmgarcess@Drake:~/acpi_call$ ./test_off.sh
    Trying \_SB.PCI0.P0P1.VGA._OFF: failed
    Trying \_SB.PCI0.P0P2.VGA._OFF: failed
    Trying \_SB_.PCI0.OVGA.ATPX: failed
    Trying \_SB_.PCI0.OVGA.XTPX: failed
    Trying \_SB.PCI0.P0P2.PEGP._OFF: failed
    Trying \_SB.PCI0.P0P1.PEGP._OFF: failed
    Trying \_SB.PCI0.MXR0.MXM0._OFF: failed
    Trying \_SB.PCI0.PEG1.GFX0._OFF: failed
    Trying \_SB.PCI0.PEG1.GFX0.DOFF: failed
    Trying \_SB.PCI0.XVR0.Z01I.DGOF: failed
    Trying \_SB.PCI0.PEGR.GFX0._OFF: failed
    Trying \_SB.PCI0.PEG.VID._OFF: failed
    Trying \_SB.PCI0.P0P2.DGPU._OFF: failed
    Trying \_SB.PCI0.IXVE.IGPU.DGOF: failed
    Trying \_SB.PCI0.RP00.VGA._PS3: failed
    Trying \_SB.PCI0.RP00.VGA.P3MO: failed
    Trying \_SB.PCI0.GFX0.DSM._T_0: failed
    Trying \_SB.PCI0.LPC.EC.PUBS._OFF: failed
    Trying \_SB.PCI0.P0P2.NVID._OFF: failed

    lmgarcess@Drake:~/acpi_call$ sudo dmidecode -s system-product-name
    HP Pavilion dv6 Notebook PC

    lmgarcess@Drake:~/acpi_call$ sudo dmidecode -s system-version
    049E100000243110000020000

    lmgarcess@Drake:~/acpi_call$ lspci -vnnn | perl -lne 'print if /^\d+\:.+(\[\S+\:\S+\])/' | grep VGA
    00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA controller])
    01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Manhattan [Mobility Radeon HD 5000 Series] [1002:68e0] (prog-if 00 [VGA controller])

    I really need a solution because I don't want to use Windows any more... I have been using Linux since 2007 but just like a normal user. I tried to recompile Linux kernel but it doesn't work either...
    Please I need to figure out how to solve this as soon as posible...
    Figure out that on the instruction iasl -d DSDT.dat I had a Segmentation Failed....
    Cheer and hopping to heard from you soon...
    Luis
    contact me at lmgarcess@gmail.com

    ReplyDelete
  4. Is this procedure applicable to the "Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method" hardware configuration detailed in David Airlies (git.kernel.org) post that you linked above?

    If not, what changes do I need to make in order to get this working on my Thinkpad W500?

    ReplyDelete
  5. @monikersupreme: I guess it will work just fine with your Thinkpad W500, you just have to follow the HowTo. Please let me know if it worked. Best,
    RM

    ReplyDelete
  6. Good job :P
    It work perfectly on Linux Mint x64 V10
    I have a intel i5 for the integrated chip
    and a ATI HD for the Discrete

    sorry for my bad English

    ReplyDelete
  7. I have a Dell Vostro 3500 with i5 460 and Nvidia 310 ...
    I'm using ubuntu 10.10 x86_64

    I did all those steps ... this work fine but the vga switch dont change for my discrete nvidia 310 !

    after the logout and login the system remains the same, but should change to nvidia 310.

    ReplyDelete
  8. Thanks.

    I will try this when I get my Asus EeePC 1215N. I was so glad that there is some sort of GUI for this stuff. I want to use Linux without all the hassle.

    ReplyDelete
  9. Many thanks for this contribution -- my acer 4820TG (integrated intel + radeon 5650) now works nicely under ubuntu 10.10. Great job :-)

    ReplyDelete
  10. Hi congrats on the success on UBUNTU. I am having Acer Aspire Timelinex 4820 TG with Intel/ATI combinatio. I want to know what modifications are necessary to make this script run on Kubuntu10.10.

    ReplyDelete
  11. Guys, did you tried it at Ausu 1215n? Its a big discussion around. If switched solution will not work at Asus1215n, will I be able to use only discrete NVIDIA graphic card?

    ReplyDelete
  12. hi guy i follwed the steps on my hp laptop 3150sa, 64 bit. no luck yet. when i switch to high perfomance graphics i am loosing compiz as it is before

    can any one help

    ReplyDelete
  13. i am using ubuntu 10.10

    ReplyDelete
  14. Hi there, I'm using Ubuntu 10.10 x86 on a Asus TM8371G (Intel + ATI 4330) fresh install.. I installed the switcheroo, worked first time - I think, but when I installed the ATI restricted drivers it stopped working when I run the script it now comes up with:

    cat: /sys/kernel/debug/vgaswitcheroo/switch: No such file or directory
    cat: /sys/kernel/debug/vgaswitcheroo/switch: No such file or directory

    Highly confused! I'm assuming the ATI restricted drivers did something to it? Also, when I try and launch CCC it says that there isn't any devices in use. So I'm assuming that it's not -actually- on or loaded, double confused.. It is appearing in lspci though.

    Any ideas anyone? :)

    ReplyDelete
  15. Note re: above, that should be Acer TM8371G... Just installed the latest updates, and still not working... tried running aticonfig --initial, screws up X saying no screens available... If anyone wants to drop me an email with any pointers that'd be ace.. as I'm currently on holiday, and messing about with this whilst my girlfriend\friends are getting ready, waiting for them etc, so I will be seldom checking the thread, but have my phone on, my address is rich dot cunningham at gmail dot com.

    Thanks

    ReplyDelete
  16. Hi.
    I have the same problem that richod has.
    After 'Restricted Drivers' instalation, there is no more vgaswitcheroo...
    Also this switch has to be active throught grub/kernel flag (modeset = 1).

    ReplyDelete
  17. This script works very well for switching graphics on my HP Pavilion dm4t (Radeon 5470 / Intel).

    In Ubuntu 10.10 (the only version of Ubuntu I've tried on this machine) I had a similar problem in shutdown where if I did not send the "Power ON" command to the card that was not in use the computer would freeze on shutdown.

    I used this switch before shutdown script for awhile (actually, I hybridized it with the card switching script), but I did not think that it was such an elegant solution.

    I found that if you are using GDM you can simply place

    echo ON > /sys/kernel/debug/vgaswitcheroo/switch

    in the GDM PostSession script at /etc/gdm/PostSession/Default and it will have the same effect. Similar solutions are available if you use KDM or WDM. My file looks like:

    #!/bin/sh
    echo ON > /sys/kernel/debug/vgaswitcheroo/switch;
    exit 0

    ReplyDelete
  18. Hello,

    Something not clear for me. Do we need to install restricted driver ?

    ReplyDelete
  19. The script works perfectly on my MSI GE600 and on MSI GE700, as I've read about it on Polish Ubuntu Forum. I'm using Linux Mint 10 but on Ubuntu 10.10 it also works well. The only thing I'm sad about is that the "(4) OPTIONAL: Script to turn off laptop" doesn't work for me. At the startup fans goes mad until I'll log in on Linux or Windows. My question is, what can I do with it? Sorry for my English and many thanks for these scripts! ;)

    ReplyDelete
    Replies
    1. Hi have the problem. I run ubuntu 12.04 on hp pavilion dv6. There is something in the script which makes it not run. Not permissions and ownership.

      Delete
  20. Now my HP dv7 (core i3 + ATI graphics) works flawlessly with Ubuntu 10.10 64 bits. I can power off the ATI card reducing power consumption.

    I would suggest you to put the shutdown code as a script in runlevels 0 (halt) and 6 (reboot). This is how I did that:

    $ sudo "echo ON > /sys/kernel/debug/vgaswitcheroo/switch" > /etc/init.d/hybrid_graphics_on
    $ sudo ln /etc/init.d/hybrid_graphics_on /etc/rc0.d/S01hybrid-on
    $ sudo ln /etc/init.d/hybrid_graphics_on /etc/rc6.d/S01hybrid-on

    This way, you can shutdown / reboot as always and the system will invoke the necessary script to power on both graphic cards.

    ReplyDelete
  21. @josean1968: Great idea, thanks, I'll take it into account for the next update of the HowTo!
    @Philippe & others: This HowTo works for open source drivers, do not install restricted drivers (at least until now they do not work well with hybrid graphics).

    ReplyDelete
  22. Using 10,10 amd64 on a Samsung Q330 notebook the system apparently freezes at login window. No keyboard, no mouse, no good. If I push the main switch button, shutdown window appears and tries to shutdown after the timeout period but it never finishes.

    ReplyDelete
  23. I have a mobility 5650 and the 4200 chip setup..

    I've tried everything, but when i run your script, it does this:

    bash: syntax error near unexpected token `fi'
    khesahn@khesahn-Notebook:~$ ;;
    bash: syntax error near unexpected token `;;'
    khesahn@khesahn-Notebook:~$ esac

    ReplyDelete
  24. Since I run a KDE4 based system, I spent some time working on the switch_between_cards.sh script to add the necessary KDE4 stuff.
    After I got all that working I figured that it was really unnecessary for me since I will be running with the discrete graphic all the time, besides, when switching to the integrated card the system would freeze. So I created an init.d script that will turn on the discrete graphics before X starts, then turn off the unused card, and also turn on both cards when shutting down or rebooting.

    Once I get them uploaded to my website, I'll post a link to an archive of the 3 files and a ToInstall.txt file with a few instructions needed to follow.

    Al

    ReplyDelete
  25. @josean1968-I have the same setup with my dv7. I think you'll like what I've done with the init script.
    @jsphslgr-While your solution might be OK, it would be better to do that when shutting down or rebooting, not just logging off.

    ReplyDelete
  26. @Roberto Martinez-Thanks so much for these easy to follow instructions. You'll find that I took your scripts a bit further with adding the KDE4 stuff. Without your guide I wouldn't have spent the last 4 days working on getting it right for me;).
    I am happy to say that it is working well now though.
    Al

    ReplyDelete
  27. Here is the url to the archive:
    http://tinyurl.com/6959x3s
    Enjoy,
    Al

    ReplyDelete
  28. @BigBopper:

    Finally, that looks like the perfect solution, I also don't care about switching the cards and i'd rather disable the ATI altogether (Acer Aspire TimelineX 3820TG, ATI Radeon HD 5650, Ubuntu10.10).

    My only problem is that i run Gnome and your bash command just returns a long list of

    $ sudo insserv start_with_discrete.sh
    insserv: warning: script 'K20acpi-support' missing LSB tags and overrides
    The script you are attempting to invoke has been converted to an Upstart
    job, but lsb-header is not supported for Upstart jobs.
    insserv: warning: script 'rsyslog' missing LSB tags and overrides
    insserv: Default-Start undefined, assuming empty start runlevel(s) for script `rsyslog'
    insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `rsyslog'

    ...repeated for all kinds of scripts.

    You would make my day (and a that of a lot of other Gnome users) if you could tell me how to modify your script for Gnome.


    Thanks already for your work on this issue!

    Cheers
    Andreas

    ReplyDelete
  29. @Andreas
    You're welcome.
    As far as Gnome goes though, I would be very little help, as I have been a KDE user since version 1.?
    I would think that my script should work with a Debian Squeeze based system, not necessarily Ubuntu though, as the don't always follow Debian rules. Looking back, it appears that I failed to mention that it works with Debian, sorry. But if it is Debian, it shouldn't really matter whether its KDE or Gnome.
    The error you've shared is referring to the acpi-support script and the rsyslog script, not mine. It looks to me that invoking my script triggers checking of others, which is where it appears to be causing the errors. I'm not a guru when it comes to init.d scripts, not even close. When I started Googling on how to get a script to run when booting, is when I ran into the init.d stuff, and it also showed that the rc.local file is being depricated, so that is not the best place to put startup stuff.

    I have noticed one issue tonight, though. When the screen is supposed to shut down after 10 minutes, it does go black, but the backlight is still on. Any thoughts on that anyone?

    Al

    ReplyDelete
  30. I've done a bit more work on the scripts, as well as added another to just turn on and off the cards without switching between them or shutting down the desktop. I discovered that when just running the discrete I lost the ability to dim or brighten the screen, and just turning on the integrated card gave me back that ability.
    The backlight still stays on, even when the screen is supposed to be shutoff.

    Al

    ReplyDelete
  31. It seems to work good with intel/ATI cards, but still not working with intel/nvidia cards. Same on my notebook Asus N53JN with intel/nvidia 335 gt. I read though that someone is working on it to put the code into the kernel so that in the near future everybody with nvidia cards could switch from intel to nvidia. Hope that soon I'll be able to do that..

    ReplyDelete
  32. So I've been trying this for well over two hours now to no avail. Lenovo Ideapad Y460. When I'm prompted to switch graphics I click and nothing happens, I can't find the GUI for this either...new to Linux but I need to turn my discrete card off for it to be useful to me. Help!

    ReplyDelete
  33. I'll repeat everyone else's "Thank You!". Worked flawlessly on Ubuntu 10.10 x64 (TimelineX 4820TG).

    ReplyDelete
  34. @BigBopper: Thank you very much for your contribution with KDE, I'll add that part on the script for the next update.
    @ALL: As you could read on Phoronix (http://www.phoronix.com/scan.php?page=news_item&px=OTI3Mg) from Catalys 11.4 onwards, there is PowerXpress support under Linux. Although this blog is for open-source drivers, I'll be testing this closed driver from AMD on Ubuntu 11.04 as soon as possible and I'll be posting results here. Best,
    RM

    ReplyDelete
  35. Did you have any luck with the proprietary drivers?
    In ubuntu natty i'm having some issues during startup, mos of the times it freezes after grub, the only way to boot is adding radeon.modeset=0, but this makes the gpu unusable.

    Nice blog.

    ReplyDelete
  36. I have a HP Pavillion DV6-3143US and I have the ATI Radeon HD 5650/Intel Integrated graphics card. I have used the tutorial on how to switch between discreet and integrated cards and everytime I run the shell script I get this message:

    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator

    Regardless of which card I select. Any help would be much appreciated! Thanks,

    ReplyDelete
    Replies
    1. The < == ": :Pwr:" ] > in the script should be replaced by < = ": :Pwr:" ] >. That worked for me.

      Delete
  37. So I just installed the newly released ATI v11.4 drivers, and everything seems to be working fine. In order to switch between graphics cards, you need to reboot.
    I am much happier now;)

    Al

    ReplyDelete
  38. I have the same problem like Chris.
    I updated to Natty Narwhal and since then I cannot switch anymore. Also I have to start the script with gksu to be able to even launch it, because I can't own the rights of the /sys/kernel/debug/vgaswitcheroo/switch directory to the current user anymore (the command for that seems to have change!? http://ubuntuforums.org/showthread.php?p=10724927 ).

    So I end up with both cards running and not being able to turn off any of those (or to switch).

    ReplyDelete
  39. OK, so I've discovered the new ATI drivers aren't working completely. I can switch to the onboard graphics card fine, but when I switch back to the discrete card, I just get a blinking cursor in the upper left of the screen. I then reinstalled the ATI drivers, and it all works again now. I'm not overly concerned though, because I would have been using the discrete card most of the time anyhow. I guess I will be using it all of the time now.

    Al

    ReplyDelete
  40. Thanks for your great how to. It works for my Lenovo Ideapad Y460, well partially. Im able to turn off the discrete graphic and use only the integrated

    0:DIS: :Off:0000:01:00.0
    1:IGD:+:Pwr:0000:00:02.0

    but if i try to switch from the integrate to the discrete card all I got is to turn on the discrete card but the change is not done and the integrate card is still on so both are turn on and I continue using the integrate instead than the discrete.

    0:DIS: :Pwr:0000:01:00.0
    1:IGD:+:Pwr:0000:00:02.0

    Any one knows why this happen and how can I fix it in case i just want to use the discrete card?

    ReplyDelete
  41. Like eoga I can power on and off the discrete graphics, but attempting to switch to the discrete graphics does nothing (though there have been a couple of interesting blips: I had an external monitor connected via HDMI which came out of sleep mode when I first attempted switching to discrete (but then there was no signal and it turned itself off again); and once when restarting the external monitor displayed the shutting down screen (when it switches to a low-res mode)).

    I'm using kubuntu 11.04 on a Dell l502x (xps), which has integrated intel graphics and discrete nvidia (540m).

    ReplyDelete
  42. I have a HP DV6-3160us with a 4250 and 5650 ATI cards. I tried the script but, when I choose the discrette card from the options, I have:

    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator
    [: 120: :+:Pwr:: unexpected operator

    I want to use the 5650 card! That's why I bought it.

    Ubuntu 11.04.

    ReplyDelete
  43. @Mario Mey
    Install the latest drivers from ATI, they support hybrid graphics.

    ReplyDelete
  44. I have a Thinkpad W500 with Intel 4500MHD and ATI HD 3650
    switchable graphics. I am running Debian testing, and I had to
    modify the shutdown and setup scripts to always use the
    integrated graphics. Otherwise, when the machine restarts, it
    tries to use the ATI card and fails with an error like

    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] radeon_suspend_kms+0x76/0x1ad [radeon]
    PGD 155255067 PUD 155254067 PMD 0
    Oops: 0000 [#2] SMP

    This looks like the same bug as in

    https://launchpad.net/bugs/756552
    https://launchpad.net/bugs/750493
    https://launchpad.net/bugs/756555

    To be explicit, the contents of /etc/rc.local is

    #!/bin/sh -e
    chown boo /sys/kernel/debug/vgaswitcheroo/switch
    echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

    exit 0

    and the contents of /etc/init.d/hybrid_graphics_on is

    echo ON > /sys/kernel/debug/vgaswitcheroo/switch
    echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch

    That file is symlinked to

    /etc/rc0.d/S01hybrid-on

    and

    /etc/rc6.d/S01hybrid-on

    The switching script works great as is.

    ReplyDelete
  45. Hello,

    Could you help me,

    I have a Vostro 3550 with an Intel GPU and an ATI HD Radeon 6630M GPU, running Ubuntu 11.04. I would like for now when my laptop boot, only start with Intel Card because the ATI Card I could not installed the driver yet, I am still working because the propietary driver is not compatible yet!

    Now, when the laptop boots and start with the ATI card, I get a black screen and cant login in the system.

    Also, when I active the propietary driver with jockey function for Ubuntu, the switcheroo disapear, I can't find the "switch" file.

    Thank you for your help

    ReplyDelete
  46. Hi. i tried using your script. But it throws me an Error saying
    helloworld@ubuntu:~$ bash ~/.switch_between_cards.sh
    cat: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
    cat: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied

    I will appreciate much needed help. Basically i will be more than happy even if i have to sacrifice the Radeon HD card. and it is never functional.

    My LSPCI output reads as:
    helloworld@ubuntu:~$ lspci | grep -i vga
    00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
    01:00.0 VGA compatible controller: ATI Technologies Inc NI Seymour [AMD Radeon HD 6470M]

    ReplyDelete
    Replies
    1. sudo bash ~/.switch_between_cards.sh

      Delete
  47. Hey Piyush Verma: You are owner of "switch"? look at the rc.local if the line "echo OFF > /sys/kernel/debug/vgaswitcheroo/switch" is in it...

    and @all i'am using Ubuntu 11.10

    i got no messages when i am switching so i have to change the script a bit:

    >>andy@localhost:~$ echo $DESKTOP_SESSION
    >>ubuntu

    changing:

    elif [ "$DESKTOP_SESSION" = "gnome" ] to elif [ "$DESKTOP_SESSION" = "ubuntu" ]

    ...sorry for my bad english ;)

    ReplyDelete
  48. FEDORA 16 x64

    Choose Hybrid Graphic Card
    =================
    Integrated: (*) - Power ON : Intel 2nd Generation Core Processor Family
    Discrete: ( ) - Power ON : ATI NI Seymour [AMD Radeon HD 6470M]

    enjoy@localhost$ ./switch_between_cards.sh
    ./switch_between_cards.sh: line 91: /sys/kernel/debug/vgaswitcheroo/switch: Permission denied
    ./switch_between_cards.sh: line 97: gnome-session-save: command not found

    in my system there is tno gnome-session-save.. there's only gnome-session, gnome-session-properties and gnome-session-quit

    what's the solution in my and other people with gnome shell? thanks

    ReplyDelete
  49. have it done
    In FC16 there is alternative to gnome-session-save:
    gnome-session-quit --logout

    ReplyDelete
  50. It was very nice article and it is very useful to Linux learners.We also provide Linux online training

    ReplyDelete
  51. anda harus juga memerhatikan kartu pemain beda. Jangan pernah terkecoh dengan kartu bandar saja karna bandar itu juga adalah bettor seperti anda. Cobalah perhatikan kartu punya pemain di samping
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terbaik
    hobiqq
    paito warna
    forum prediksi

    ReplyDelete
  52. Perbaikan dalam sistem kartu kredit telah menghilangkan beberapa masalah terakhir yang biasa kita lihat tentang penolakan kartu kredit sebelumnya
    98toto

    ReplyDelete
  53. What is online gambling? | DrMCD
    If you are looking 동두천 출장샵 to gamble, you'll need to online gambling is a popular gambling 서산 출장마사지 market. it includes 남양주 출장마사지 sports 충주 출장샵 betting, 제주도 출장마사지 casino, poker, blackjack and other games.

    ReplyDelete
  54. You have a nice content, keep sharing such relavent content. For more digital growth and business growth, please check Digiperform's digital marketing course in Lucknow

    ReplyDelete

Followers