[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/fstabAnd 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.localAnd 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.localAnd 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.
@AMartin: Thanks for your comment about the location of the "rc.local" file (which is located at "/etc/rc.local" in Ubuntu).
ReplyDeleteI 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?
ReplyDeleteHi... I wrote this some days ago but I can't find a solution...
ReplyDeleteHi...
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
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?
ReplyDeleteIf not, what changes do I need to make in order to get this working on my Thinkpad W500?
@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,
ReplyDeleteRM
Good job :P
ReplyDeleteIt 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
I have a Dell Vostro 3500 with i5 460 and Nvidia 310 ...
ReplyDeleteI'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.
Thanks.
ReplyDeleteI 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.
Many thanks for this contribution -- my acer 4820TG (integrated intel + radeon 5650) now works nicely under ubuntu 10.10. Great job :-)
ReplyDeleteHi 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.
ReplyDeleteGuys, 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?
ReplyDeletehi 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
ReplyDeletecan any one help
i am using ubuntu 10.10
ReplyDeleteHi 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:
ReplyDeletecat: /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? :)
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.
ReplyDeleteThanks
Hi.
ReplyDeleteI 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).
This script works very well for switching graphics on my HP Pavilion dm4t (Radeon 5470 / Intel).
ReplyDeleteIn 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
Hello,
ReplyDeleteSomething not clear for me. Do we need to install restricted driver ?
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! ;)
ReplyDeleteHi 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.
DeleteNow 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.
ReplyDeleteI 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.
@josean1968: Great idea, thanks, I'll take it into account for the next update of the HowTo!
ReplyDelete@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).
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.
ReplyDeleteI have a mobility 5650 and the 4200 chip setup..
ReplyDeleteI'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
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.
ReplyDeleteAfter 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
@josean1968-I have the same setup with my dv7. I think you'll like what I've done with the init script.
ReplyDelete@jsphslgr-While your solution might be OK, it would be better to do that when shutting down or rebooting, not just logging off.
@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;).
ReplyDeleteI am happy to say that it is working well now though.
Al
Here is the url to the archive:
ReplyDeletehttp://tinyurl.com/6959x3s
Enjoy,
Al
@BigBopper:
ReplyDeleteFinally, 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
@Andreas
ReplyDeleteYou'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
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.
ReplyDeleteThe backlight still stays on, even when the screen is supposed to be shutoff.
Al
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..
ReplyDeleteSo 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!
ReplyDeleteI'll repeat everyone else's "Thank You!". Worked flawlessly on Ubuntu 10.10 x64 (TimelineX 4820TG).
ReplyDelete@BigBopper: Thank you very much for your contribution with KDE, I'll add that part on the script for the next update.
ReplyDelete@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
Did you have any luck with the proprietary drivers?
ReplyDeleteIn 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.
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:
ReplyDelete[: 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,
The < == ": :Pwr:" ] > in the script should be replaced by < = ": :Pwr:" ] >. That worked for me.
DeleteSo 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.
ReplyDeleteI am much happier now;)
Al
I have the same problem like Chris.
ReplyDeleteI 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).
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.
ReplyDeleteAl
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
ReplyDelete0: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?
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)).
ReplyDeleteI'm using kubuntu 11.04 on a Dell l502x (xps), which has integrated intel graphics and discrete nvidia (540m).
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:
ReplyDelete[: 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.
see reply above
Delete@Mario Mey
ReplyDeleteInstall the latest drivers from ATI, they support hybrid graphics.
I have a Thinkpad W500 with Intel 4500MHD and ATI HD 3650
ReplyDeleteswitchable 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.
Hello,
ReplyDeleteCould 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
Hi. i tried using your script. But it throws me an Error saying
ReplyDeletehelloworld@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]
sudo bash ~/.switch_between_cards.sh
DeleteHey 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...
ReplyDeleteand @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 ;)
FEDORA 16 x64
ReplyDeleteChoose 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
have it done
ReplyDeleteIn FC16 there is alternative to gnome-session-save:
gnome-session-quit --logout
It was very nice article and it is very useful to Linux learners.We also provide Linux online training
ReplyDeleteanda 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
ReplyDeleteasikqq
dewaqq
sumoqq
interqq
pionpoker
bandar ceme terbaik
hobiqq
paito warna
forum prediksi
Perbaikan dalam sistem kartu kredit telah menghilangkan beberapa masalah terakhir yang biasa kita lihat tentang penolakan kartu kredit sebelumnya
ReplyDelete98toto
What is online gambling? | DrMCD
ReplyDeleteIf 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.
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
ReplyDeleteKarayolu yurtdışı kargo
ReplyDeleteDenizyolu yurtdışı kargo
Havayolu yurtdışı kargo
Demiryolu yurtdışı kargo
Avusturya yurtdışı kargo
5LVLİ4