Asus switcheroo

From Hybridgraphics

(Difference between revisions)
Jump to: navigation, search
(Added attached file links.)
m (Formatting)
Line 5: Line 5:
-
Script-based solution ( by eemil@gmx.com ):
+
===Script-based solution ( by eemil@gmx.com )===
The script-based system includes several files, and allows automatic
The script-based system includes several files, and allows automatic
Line 12: Line 12:
Here is how it works:
Here is how it works:
# User writes either "intel" or "nvidia" to /home/user/switcheroo.txt.
# User writes either "intel" or "nvidia" to /home/user/switcheroo.txt.
-
# Script detects this and waits for the user to log out (detected as
+
# Script detects this and waits for the user to log out (detected as user's gnome-session not running)
-
user's gnome-session not running)
+
# Turns off gdm3 (debian) or gdm (ubuntu).
# Turns off gdm3 (debian) or gdm (ubuntu).
-
# Uses the awilliam module (asus-switcheroo) to switch to the desired
+
# Uses the awilliam module (asus-switcheroo) to switch to the desired card.
-
card.
+
# Uses acpi_call to turn off nvidia if required
# Uses acpi_call to turn off nvidia if required
-
# Links appropriate version of libglx.so and libGL.so, and xorg.conf so
+
# Links appropriate version of libglx.so and libGL.so, and xorg.conf so that X and openGL apps can find them
-
that X and openGL apps can find them
+
# Starts gdm again.
# Starts gdm again.
Attached:
Attached:
* my xorg.conf files for both cards.
* my xorg.conf files for both cards.
-
* display-settings, the script that does one-shot card switching
+
* display-settings, the script that does one-shot card switching depending on switcheroo.txt, and runs at boot so that the last selected card will be used
-
depending on switcheroo.txt, and runs at boot so that the last selected
+
* graphics-switch.sh, the script that monitors switcheroo.txt and calls display-settings when no user session is running
-
card will be used
+
* graphics-switch-daemon, the script that starts graphics-switch.sh on the background at boot
-
* graphics-switch.sh, the script that monitors switcheroo.txt and calls
+
-
display-settings when no user session is running
+
-
* graphics-switch-daemon, the script that starts graphics-switch.sh on
+
-
the background at boot
+
* an example switcheroo.txt.
* an example switcheroo.txt.
Line 36: Line 29:
acpi_call:
acpi_call:
-
-In cloned acpi_call git, do
+
 
-
-Compile acpi_call
+
In cloned acpi_call git compile acpi_call, and then
-
-sudo cp acpi_call.ko into /lib/modules/$( uname -r )/kernel/drivers/acpi/.
+
<pre>sudo cp acpi_call.ko into /lib/modules/$( uname -r )/kernel/drivers/acpi/.
-
-sudo depmod -a
+
sudo depmod -a</pre>
asus-switcheroo:
asus-switcheroo:
Line 59: Line 52:
* Make sure that SESSION=your-session in the scripts (for example gnome-session or startx or ... )
* Make sure that SESSION=your-session in the scripts (for example gnome-session or startx or ... )
-
* sudo cp graphics-switch.sh graphics-switch-daemon display-settings /etc/init.d/.
+
<pre>sudo cp graphics-switch.sh graphics-switch-daemon display-settings /etc/init.d/.
-
* sudo update-rc.d display-settings defaults
+
sudo update-rc.d display-settings defaults
-
* sudo update-rc.d graphics-switch-daemon defaults
+
sudo update-rc.d graphics-switch-daemon defaults</pre>
These should run on Ubuntu and Debian,
These should run on Ubuntu and Debian,

Revision as of 11:53, 12 May 2011

The Asus Switcheroo module can be obtained at:


https://github.com/awilliam/asus-switcheroo/


Script-based solution ( by eemil@gmx.com )

The script-based system includes several files, and allows automatic switching between intel and nvidia, at least on pre-optimus UL30VT.

Here is how it works:

  1. User writes either "intel" or "nvidia" to /home/user/switcheroo.txt.
  2. Script detects this and waits for the user to log out (detected as user's gnome-session not running)
  3. Turns off gdm3 (debian) or gdm (ubuntu).
  4. Uses the awilliam module (asus-switcheroo) to switch to the desired card.
  5. Uses acpi_call to turn off nvidia if required
  6. Links appropriate version of libglx.so and libGL.so, and xorg.conf so that X and openGL apps can find them
  7. Starts gdm again.

Attached:

  • my xorg.conf files for both cards.
  • display-settings, the script that does one-shot card switching depending on switcheroo.txt, and runs at boot so that the last selected card will be used
  • graphics-switch.sh, the script that monitors switcheroo.txt and calls display-settings when no user session is running
  • graphics-switch-daemon, the script that starts graphics-switch.sh on the background at boot
  • an example switcheroo.txt.

Hopefully comprehensive installation procedure:

acpi_call:

In cloned acpi_call git compile acpi_call, and then

sudo cp acpi_call.ko into /lib/modules/$( uname -r )/kernel/drivers/acpi/.
sudo depmod -a

asus-switcheroo:

  • In cloned asus-switcheroo git, do sudo make install-ubuntu
  • Make sure that both /etc/modules and /etc/initramfs-tools/modules have the lines:

asus_switcheroo dummy_client=1 i915_jprobe

xorg.conf files:

  • IMPORTANT: If your PCI ID's are different, please modify. See lspci for the numbers.
  • sudo cp xorg.conf.intel xorg.conf.nvidia /etc/X11/.


To get nice notifications for scheduled switches: sudo apt-get install notify-osd

Finally, my scripts:

  • Make sure that U=your-user-name in the scripts
  • Make sure that SESSION=your-session in the scripts (for example gnome-session or startx or ... )
sudo cp graphics-switch.sh graphics-switch-daemon display-settings /etc/init.d/.
sudo update-rc.d display-settings defaults
sudo update-rc.d graphics-switch-daemon defaults

These should run on Ubuntu and Debian, tested on Linux Mint Debian. Change the user (U=user) to your user.

Attachments:

asus-switcheroo display-settings

asus-switcheroo graphics-switch.sh

asus-switcheroo graphics-switch-daemon

asus-switcheroo xorg.conf.intel

asus-switcheroo xorg.conf-nvidia

asus-switcheroo switcheroo.txt

-- Eemil

Personal tools