联想 ThinkPad X1 Yoga OLED 亮度

联想 ThinkPad X1 Yoga OLED 亮度

我在我的 X1 Yoga OLED 上运行 16.04。

我根本无法改变屏幕亮度,它似乎一直处于最大亮度。我试过:

  • Fn+ F5/F6
  • xbacklight -set 50(和 100、和 0、和 20、...)/xbacklight -dec 10

我在 Xorg 中使用 GNOME Shell。

希望这份软件和版本列表有用,如果您需要更多,请在评论中告诉我。

gnome-shell 3.18.5-0ubuntu0.1
tlp         0.9-1~xenial
tp-smapi    0.41-1

答案1

OLED 屏幕没有背光。因此常规方法不起作用。通过以下方式调整屏幕亮度:

xrandr --output eDP1 --brightness .5  # dim to half 

xrandr --output eDP1 --brightness 1  # no dimming

该数字可以是 0 到 1 之间的任意数字

答案2

我一直在寻找一种在按下亮度按钮时运行 xrandr 命令的方法。我为此创建了自定义 acpi 事件(有关更多信息,请参见此处:https://help.ubuntu.com/community/LaptopSpecialKeys)。这仍然是一个 hack,没有合适的解决方案,但它对我有用:

我创建了三个文件,/etc/acpi/events/yoga-brightness-up:

event=video/brightnessup BRTUP 00000086
action=/etc/acpi/yoga-brightness.sh up

和 /etc/acpi/events/yoga-brightness-down:

event=video/brightnessdown BRTDN 00000087
action=/etc/acpi/yoga-brightness.sh down

最后是 /etc/acpi/yoga-brightness.sh:

#!/bin/sh

# Where the backlight brightness is stored
BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


test -d "$BR_DIR" || exit 0

MIN=0
MAX=$(cat "$BR_DIR/max_brightness")
VAL=$(cat "$BR_DIR/brightness")

if [ "$1" = down ]; then
    VAL=$((VAL-71))
else
    VAL=$((VAL+71))
fi

if [ "$VAL" -lt $MIN ]; then
    VAL=$MIN
elif [ "$VAL" -gt $MAX ]; then
    VAL=$MAX
fi

PERCENT=`echo "$VAL / $MAX" | bc -l`

export XAUTHORITY=/home/ivo/.Xauthority  # CHANGE "ivo" TO YOUR USER
export DISPLAY=:0.0

echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
xrandr --output eDP-1 --brightness $PERCENT

echo $VAL > "$BR_DIR/brightness"

它受到文件 asus-keyboard-backlight.sh 和以下信息的启发:https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901针对 xrandr 根访问问题。

不要忘记通过输入以下命令重新启动 acpi

sudo service acpid reload

我希望这有帮助 ;-)

答案3

平滑的亮度控制

更新:我已经上传提供脚本来自动执行此操作到 Github。

此脚本基于以下解决方法伊沃·布洛希利格。我不想让我昂贵的笔记本电脑看起来很廉价,所以我需要亮度值之间的平滑过渡,以便与非 Linux 同事竞争。

这是为配备 OLED 面板的联想 ThinkPad X1 Yoga(第二代)上的 Linux Mint 18.3 和 Ubuntu 16.04.3 创建并测试的。

/etc/acpi/events/oled-brightness-up(644):

event=video/brightnessup BRTUP 00000086
action=/etc/acpi/oled-brightness.sh up

/etc/acpi/events/oled-brightness-down(644):

event=video/brightnessdown BRTDN 00000087
action=/etc/acpi/oled-brightness.sh down

/etc/acpi/oled-brightness.sh(755):

#!/bin/bash
# Smooth brightness control
# Change "redsandro" in the line below to your username
export XAUTHORITY=/home/redsandro/.Xauthority
export DISPLAY=:0.0

OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

MIN=0
MAX=1.2

if [ "$1" == "up" ]; then
    VAL=`echo "scale=1; $CURR+0.1" | bc`
else
    VAL=`echo "scale=1; $CURR-0.1" | bc`
fi

if (( `echo "$VAL < $MIN" | bc -l` )); then
    VAL=$MIN
elif (( `echo "$VAL > $MAX" | bc -l` )); then
    VAL=$MAX
else
    if [ "$1" == "up" ]; then
        for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
    else
        for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
    fi
fi

# Set Intel backlight to fake value
# to sync OSD brightness indicator to actual brightness
INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
if [ -d "$INTEL_PANEL" ]; then
    PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
    INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
    INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
    INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
    echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
fi

删除所有以前的亮度处理程序,最后执行sudo service acpid reload

答案4

我在 Ubuntu MATE 17.04 中做了与上述类似的事情:

  1. cat $MYDIR/scrbr.property=0.5 (scrbr = 屏幕亮度)
  2. 创建了一个脚本scrbr.sh

```

#!/bin/bash

ACTION=$1

PROP_FILE=$MYDIR/scrbr.property
BRIGHT=$(cat $PROP_FILE)

if [[ "$ACTION" == "--up" ]]; then
        SYM="+"
elif [[ "$ACTION" == "--down" ]]; then
        SYM="-"
fi

BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

# Not less than 0
[[ $BRIGHT == -* ]] && BRIGHT=0

echo $BRIGHT > $PROP_FILE

xrandr --output eDP-1 --brightness $BRIGHT
  1. 将键重新映射WinKey + Upscrbr.sh --up,并且 也同样如此--down

  2. 利润。

相关内容