3
echo OFF | sudo tee /sys/kernel/debug/vgaswitcheroo/switch

In one of the questions in this forum, someone had posted this command to switch off graphics card to save power consumption and this worked like a charm almost reducing my battery consumption to less than half of what it consumed before.

The contents of sys/kernel/debug/vgawitcheroo/switch file are

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

I want to know what this command actually does, the significance of vgaswitcheroo/switch file and what is the piping that is happening in the command. Can someone please explain this to me?

Lekensteyn
  • 174,277
Vamsi Emani
  • 2,575

1 Answers1

4

The command echo OFF | sudo tee /sys/kernel/debug/vgaswitcheroo/switch writes OFF to the special "file" /sys/kernel/debug/vgaswitcheroo/switch. For details on the difference with echo OFF > /sys/kernel/debug/vgaswitcheroo/switch, see Redirect the output using `sudo`

Entries in /sys are special. Those are not real files but an exported interface from the kernel space. In this case, vgaswitcheroo is an interface to the switcheroo code that can be used for toggling the power on hybrid graphics systems. More details on this can be found in the Ubuntu help pages: https://help.ubuntu.com/community/HybridGraphics#Using_vga_switcheroo.

If you are interested, the source code where this interface is exported is at http://lxr.linux.no/#linux+v3.3.4/drivers/gpu/vga/vga_switcheroo.c

Lekensteyn
  • 174,277