僅在系統從睡眠狀態恢復後更改亮度才有效
我有一台在核心 5.17 上執行 Manjaro 21.2.3 的 Lenovo Legion Slim 7 筆記型電腦(15ACH6)。
我面臨的問題是,在乾淨啟動時,我無法更改系統亮度(使用 Fn 鍵或更改
brightness
in的實際值/sys/class/backlight
)。然而,在讓系統進入睡眠狀態然後恢復之後,亮度控制工作得很好——儘管亮度級別沒有被保留。內容
/sys/class/backlight
:amdgpu_bl1 -> ../../devices/pci0000:00/0000:00:08.1/0000:05:00.0/backlight/amdgpu_bl1/ nvidia_0 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/backlight/nvidia_0/ nvidia_wmi_ec_backlight -> ../../devices/pci0000:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/603E9613-EF25-4338-A3D0-C46177516DB7/backlight/nvidia_wmi_ec_backlight/
實際亮度值寫入文件,
nvidia_wmi_ec_backlight/brightness
其他2個保持不變。載入的 nVidia 核心模組:
nvidia_uvm 2650112 0 nvidia_drm 73728 2 nvidia_modeset 1163264 3 nvidia_drm nvidia_wmi_ec_backlight 16384 0 nvidia 39133184 99 nvidia_uvm,nvidia_modeset wmi 40960 3 nvidia_wmi_ec_backlight,wmi_bmof,ideapad_laptop
在小於 5.16 的核心上,該
nvidia_wmi_ec_backlight
模組不存在,我無法更改亮度。我想知道是什麼原因導致該模組僅在從 sleep 恢復後才能正常執行。我懷疑某種競爭條件或不正確的初始化。為了理解這種行為,我應該做什麼樣的調查?
核心模組的原始碼在這裡:
nvidia-wmi-ec-backlight.c
.輸出
inxi -Fz
:System: Kernel: 5.17.0-1-MANJARO x86_64 bits: 64 Desktop: GNOME 41.3 Distro: Manjaro Linux Machine: Type: Laptop System: LENOVO product: 82K8 v: Legion S7 15ACH6 serial: <superuser required> Mobo: LENOVO model: LNVNB161216 v: NO DPK serial: <superuser required> UEFI: LENOVO v: HACN27WW date: 08/02/2021 Battery: ID-1: BAT0 charge: 64.3 Wh (90.6%) condition: 71.0/71.0 Wh (100.0%) CPU: Info: 8-core model: AMD Ryzen 9 5900HX with Radeon Graphics bits: 64 type: MT MCP cache: L2: 4 MiB Speed (MHz): avg: 1526 min/max: 400/4680 cores: 1: 1397 2: 1397 3: 1397 4: 1395 5: 1396 6: 1395 7: 1397 8: 1397 9: 1397 10: 3482 11: 1395 12: 1396 13: 1396 14: 1395 15: 1397 16: 1397 Graphics: Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] driver: nvidia v: 510.47.03 Device-2: AMD Cezanne driver: amdgpu v: kernel Device-3: Syntek Integrated Camera type: USB driver: uvcvideo Display: x11 server: X.org 1.21.1.3 driver: loaded: amdgpu,ati,nvidia unloaded: modesetting,nouveau,radeon resolution: <missing: xdpyinfo> OpenGL: renderer: AMD RENOIR (DRM 3.44.0 5.17.0-1-MANJARO LLVM 13.0.0) v: 4.6 Mesa 21.3.5 Audio: Device-1: NVIDIA driver: snd_hda_intel Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor driver: N/A Device-3: AMD Family 17h HD Audio driver: snd_hda_intel Sound Server-1: ALSA v: k5.17.0-1-MANJARO running: yes Sound Server-2: PulseAudio v: 15.0 running: yes Network: Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi IF: wlp2s0 state: up mac: <filter> Bluetooth: Device-1: Intel AX200 Bluetooth type: USB driver: btusb Report: rfkill ID: hci0 rfk-id: 4 state: down bt-service: enabled,running rfk-block: hardware: no software: yes address: see --recommends Drives: Local Storage: total: 953.87 GiB used: 169.04 GiB (17.7%) ID-1: /dev/nvme0n1 vendor: SK Hynix model: HFS001TDE9X084N size: 953.87 GiB Partition: ID-1: / size: 905.83 GiB used: 169.04 GiB (18.7%) fs: ext4 dev: /dev/nvme0n1p3 ID-2: /boot/efi size: 511 MiB used: 288 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 Swap: ID-1: swap-1 type: partition size: 32 GiB used: 0 KiB (0.0%) dev: /dev/nvme0n1p2 Sensors: System Temperatures: cpu: N/A mobo: N/A Fan Speeds (RPM): N/A Info: Processes: 452 Uptime: 8m Memory: 30.79 GiB used: 3.68 GiB (12.0%) Shell: Zsh inxi: 3.3.12
**更新:**似乎在乾淨啟動時我可以使用
amdgpu_bl1
控制器控制亮度:echo 50 | sudo tee /sys/class/backlight/amdgpu_bl1/brightness
從睡眠中恢復後,開始
nvidia_wmi_ec_backlight
負責。
我聯繫了該模組的作者 Daniel Dadap,
nvidia-wmi-ec-backlight
他提出了一個更新檔來解決我的問題。您可以在此處關注郵件列表中的討論: https ://patchwork.kernel.org/project/platform-driver-x86/patch/20220316012516.2233984-1-ddadap@nvidia.com/
作為備份,您可以使用 xrandr 從命令行控制亮度。假設輸出設備名為 DP-1(執行 xrandr 找出),它可以設置為:
xrandr --output DP-1 --brightness .8
這會將亮度設置為 80%。您還可以創建一個 Bash 函式來設置亮度,例如:
brightness() { DEV=$(xrandr |grep ' connected' |awk '{print $1}') (($1 >= 15 && $1 <= 115)) && xrandr --output "${DEV}" --brightness \ $(awk -v n="$1" 'BEGIN { printf "%.2f", n / 100 }') || echo "invalid input" }
這將接受 15 到 115 之間的值作為亮度級別(以允許輕微的過飽和伽馬):
brightness 100 # full brightness brighness 40 # 40%, very dim brightness 105 # over-saturated