How I solved my Toshiba Linux backlight issues
Symptomatics:
I have both the Toshiba Z830 and R850 for a couple of years now. On both, I’m using the current LTS versions of KUbuntu (at the time of writing this, 14.04). Although, I’m absolutely satisfied with them, there’s a little issue regarding the backlight:
On startup, the backlight works perfectly well. I can change the settings using FN+F6/F7 without any issues. However, after putting the device into standby and waking it up again, pressing said hotkeys shows the backlight percentage dialog, but does not change the brightness.
Because Ubuntu’s SSD reboots are pretty fast Iimply didn’t care about the issue for the past few years. However, out of curiosity, I successfully fixed the issue today.
On the root cause of most backlight issues:
Once I read through the forums I noticed that although this issue is related to the toshiba_acpi
driver, a similar issue occurs with other notebook brands (like Thinkpad) as well.
The Linux/Xorg combo supports several screens at once and therefore needs to support multiple backlight device drivers to be active concurrently.
One can show the currently active drivers using sysfs as shown here:
uli@uli-z830 ~ % ls /sys/class/backlight
intel_backlight toshiba
The issue now is that the software that handles FN+F6/F7 inputs (eventually they seem to be redirected to XRandR) doesn’t inherently know the correct device to set the backlight.
As discussed on the Debian mailing list, there is a rather simple ruleset for selecting the correct backlight driver in Xorg.
When the backlight for my Toshiba hardware can’t be changed using the hotkeys, it’s possible to set the screen brightness using (root permissions required!)
root@uli-z830 ~ # echo 2000 > /sys/class/backlight/intel_backlight/brightness
2000
is — in this case — a value for a medium brightness. The range of valid values is driver-specific, however the minimum value is always 0
whereas the maximum value is always the one listed in /sys/class/backlight/intel_backlight/max_brightness
(of course, you might need to replace intel_backlight
with the name of your driver if you intend to change the brightness of a different background driver).
In the case of Toshiba notebooks, the rulesets of the software handling the hotkeys recognize either acpi_video0
or toshiba
(see below for the difference between those two) as default. However, intel_backlight
would be the correct one to use.
Although the people on the Debian mailing list discussed where to solve this, with KUbuntu 1.40 and a vanilla (self-compiled) 3.16-rc5 kernel it doesn’t work out of the box.
By default (i.e. on a fresh installation) there seems to be only the acpi_video
backlight driver. If I follow the numerous suggestion on the forum or on LinLap.com’s Z830 page and add acpi_backlight=vendor
to the GRUB2 boot command line (you can verify it worked by using cat /proc/cmdline
), that alone doesn’t work.
The central question therefore is: Where can I change the default backlight driver to use intel_backlight
?
Solving the issue:
Step 1: Fix the GRUB2 command line
EDIT: This is step is not strictly neccessary, however it is recommended.
Although I’m not sure if this is strictly neccessary to solve the underlying issue, I recommend changing the GRUB2 commandline as suggested on LinLap.com.
Currently, I use the following GRUB2 configuration (only the changed line is shown):
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop acpi_osi=Linux acpi_backlight=vendor pcie_aspm=force i915.i915_enable_rc6=1 i915.lvds_downclock=1"
While elevator=noop
changes the default IO scheduler, the other options deal with the ACPI backlight stuff and (according to LinLap.com) increase the Z830 battery life. I have not attempted verifying the battery life is improved, as I already have an excellent battery life on Linux.
Step 2: Creating xorg.conf
Even if they might work for others, the fix regarding /etc/pm/sleep.d/restore_brightness
suggested on LinLap.com did not work for me.
The excellent ArchLinux Backlight wiki page suggests to set the Backlight option in /etc/X11/xorg.conf
. However, this file does not exist on recent Ubuntu releases. If it exists in your Linux distribution, you can skip this step.
First, you need to login as root to a console that is not running inside X11 (e.g. by using Ctrl+Alt+F1
). After stopping X11 (I’m assuming you’re using kdm
as display manager — if you’re not, just replace it e.g. with lightdm
)we will create xorg.conf.new
in /root
and then move it to /etc/X11/xorg.conf
.
uli@uli-z830 ~ # X -configure #Creates /root/xorg.conf.new
uli@uli-z830 ~ # mv /root/xorg.conf.new /etc/X11/xorg.conf
If this should in any way break your display manager (i.e. service kdm start
does not work), just delete /etc/X11/xorg.conf
.
Step 3: Modifying /etc/xorg.conf
As suggested on the ArchLinux wiki and on the Debian mailing list, we now need to add a backlight option.
Open /etc/X11/xorg.conf
using your preferred editor and find the Device
section.
Look for the Driver
clause in said section. Change it to
Driver "intel"
In some cases, it might be intel
already, but for my Z830 notebook it was modeswitch
. Without modeswitch
being used as driver, the Backlight
option we’ll add will not be recognized. On my R850 however, intel
was already set.
After that you’ll need to add the backlight option line:
Option "Backlight" "intel_backlight"
The position of this line inside the driver section does not really matter — I placed it directly above the Identifier
line.
After doing that, you’ll only need to restart your display manager (e.g. service kdm start
) (or just reboot if you’re lazy). This should solve all backlight issues.
Besides making it possible for me to use the backlight control hotkeys even after waking up from a standby, I now not only have 7 different backlight settings but 10 (which can be selected using the hotkeys) or more than 4000 (which can be selected by writing a value to /sys/class/backlight/intel_backlight/brightness
).
Here’s my full working /etc/X11/xorg.conf
for my Z830 notebook for further reference:
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "built-ins"
EndSection
Section "Module"
Load "glx"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "SWcursor" # [<bool>]
#Option "kmsdev" # <str>
#Option "ShadowFB" # [<bool>]
Option "Backlight" "intel_backlight"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection