Score:3

XPS 9510 with OLED screen no brightness control with Ubuntu 21.04

cn flag

I just run Ubuntu 21.04 in live mode to test before a full installation on an XPS 15 9510 with the OLED screen, but I cannot control the screen brightness, I know there is an issue with OLED screens from many years ago, nonetheless I thought at this point it was already solved. Dell provides a temporary workaround via the terminal, but it is not very practical:

https://www.dell.com/support/kbdoc/en-uk/000129708/can-t-change-the-oled-s-brightness-on-precision-xps-systems-once-you-ve-installed-ubuntu-linux

Any suggestion on how to solve this? Thanks

in flag
OLED support has been merged into the Linux Kernel version 5.12, which doesn’t really help as 21.04 uses 5.11. If you’re willing to manually update your kernel, you could try that. Otherwise you may need to wait until 21.10 is released in October (or use the daily builds)
logicito avatar
cn flag
I did that, I am using 5.13.12 and it is working fine
Score:2
sa flag

I've created a script that enables you to create custom keyboard shortcuts using the suggested Dell solution for adjusting screen brightness:

https://gist.github.com/lagerone/1568ea6fbb98fd90a3495f9e51e26c8c

You might need to modify it, as the script assumes the laptop screen name is eDP-1. Run xrandr to find out your screen name and modify this line accordingly:

subprocess.run(["xrandr", "--output", "eDP-1", "--brightness", str(adjusted_level)])

Here's the full script:

#!/usr/bin/python3

import logging
import os
import subprocess
import sys
from typing import Literal

logging.basicConfig(level=logging.DEBUG)

FILE_PATH = os.path.join(
    os.path.dirname(os.path.realpath(__file__)), ".screen-brightness"
)


def read_current_level() -> float:
    if not os.path.isfile(FILE_PATH):
        return 1
    with open(
        file=FILE_PATH,
        mode="r",
        encoding="utf-8",
    ) as file:
        current_level = file.readline().strip()
        return float(current_level)


def save_level(level: float) -> None:
    with open(
        file=FILE_PATH,
        mode="w",
        encoding="utf-8",
    ) as file:
        file.write(str(level))


def adjust_level(method: Literal["up", "down"]) -> None:
    adjuster = 0.05 if method == "up" else -0.05
    current_level = read_current_level()
    adjusted_level = current_level + adjuster
    if adjusted_level > 1:
        adjusted_level = 1
    if adjusted_level < 0.2:
        adjusted_level = 0.2
    logging.debug(f"Setting screen brightness to {adjusted_level}.")
    subprocess.run(["xrandr", "--output", "eDP-1", "--brightness", str(adjusted_level)])
    save_level(level=adjusted_level)


if __name__ == "__main__":
    METHOD = sys.argv[1] if len(sys.argv) > 1 else "up"
    adjust_level(method=METHOD)
lacostenycoder avatar
se flag
This is really good and works better than the OLED Dimmer Gnome extension, thanks!
e-info128 avatar
in flag
But ubuntu use wayland, xrandr is not work.
Score:0
in flag

I had the same issue on my Precision 5550 craptop which is pretty much the same as the XPS 9500. In the latest Fedora 38 with latest 1.22 BIOS, my brightness keys work. That is kernel 6.2.12-300.fc38.x86_64 so it's well possible that with a recent kernel on Ubuntu and the latest BIOS, it works on the 9510 too.

Score:-1
pl flag

Visit monitor-brightness !! My laptop's screen is OLED too. I write a code that connects backlight value, e.g. backlight bar(brightness key).

monitor-brightness

Auto-Start Installation

git clone https://github.com/tw-yshuang/monitor-brightness.git
cd ./monitor-brightness
sudo make

If you use make to install, it can auto-start when you logging-in next time.

e-info128 avatar
in flag
The repo works only with intel class. Does not work on AMD Radeon and LG Oled.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.