daitj / gnome-display-brightness-ddcutil

Display brightness slider for gnome shell using ddcutil backend
GNU General Public License v3.0
306 stars 37 forks source link

Stuck at "Initializing" even though ddcutil was configured correctly #122

Closed BuonHobo closed 11 months ago

BuonHobo commented 11 months ago

Describe the bug I followed the steps to configure ddcutil and I even tried the cache file in .cache/ddcutil_detect but the extension is always stuck on "Initializing"

To Reproduce Steps to reproduce the behavior: I just followed the steps in the readme

Journal logs

Dec 05 22:46:06 desktop gnome-shell[5241]: Enabling extension quicksettings-audio-devices-hider@marcinjahn.com
Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           Adding to panel
Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           Add keyboard shortcuts
Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           ddcutil brief info:
                                           Display 1
                                              I2C bus:          /dev/i2c-6
                                              DRM connector:    card1-DP-1
                                              Monitor:          SAM:LC34G55T:HNTW802109

Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           ddcutil brief info found bus line:
                                               I2C bus:          /dev/i2c-6
Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           ddcutil reading display state for bus: 6
Dec 05 22:46:07 desktop gnome-shell[5241]: display-brightness-ddcutil extension:
                                           ddcutil reading display status for bus: 6 is: VCP D6 SNC x00
Dec 05 22:46:08 desktop gnome-shell[5241]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed

Screenshots \

Desktop (please complete the following information):

daitj commented 11 months ago

Try disabling and enabling the extension from "Extensions" application or from shell gnome-extensions-app.

See what happens, I cannot see anything fishy from the logs.

ashimregme commented 11 months ago

Does this command work? ddcutil getvcp 10. It should output current and max value of your screen's brightness.

Also, check if these two lines in file /etc/udev/rules.d/60-ddcutil-i2c.rules are commented. If so, uncomment them.

SUBSYSTEM=="i2c-dev", KERNEL=="i2c-[0-9]*", ATTRS{class}=="0x030000", TAG+="uaccess" 
KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"

After rebooting, the extension should work fine.

BuonHobo commented 11 months ago

Disabling and enabling the extension didn't work.

ddcutil getvcp 10 returned VCP code 0x10 (Brightness ): current value = 25, max value = 100.

I am confident that ddcutil is configured correctly because I also have wluma running on my computer. It is a tool that uses the webcam as a light sensor and adjusts the screen brightness automatically.

I also tried disabling wluma in case they are conflicting but it doesn't change anything. My user is also in the i2c group as it is supposed to be.

On Arch the default configuration is with two files, but the result is the same:

❯ cat /usr/lib/udev/rules.d/60-ddcutil-i2c.rules
SUBSYSTEM=="i2c-dev", KERNEL=="i2c-[0-9]*", ATTRS{class}=="0x030000", TAG+="uaccess" 

❯ cat /usr/lib/udev/rules.d/45-i2c-tools.rules 
# Assigns the i2c devices to group i2c, and gives that group RW access:
KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"

(I also tried putting the file suggested by @ashimregme in /etc/udec/rules.d/ but nothing changed anyway)

I will also attach more info in case you find it useful.

❯ ddcutil detect
Display 1
   I2C bus:  /dev/i2c-6
   DRM connector:           card1-DP-1
   EDID synopsis:
      Mfg id:               SAM - Samsung Electric Company
      Model:                LC34G55T
      Product code:         28954  (0x711a)
      Serial number:        HNTW802109
      Binary serial number: 810437704 (0x304e4c48)
      Manufacture year:     2023,  Week: 34
   VCP version:         2.0
❯ udevadm info --name /dev/i2c-6 --query all

P: /devices/pci0000:00/0000:00:03.1/0000:2d:00.0/0000:2e:00.0/0000:2f:00.0/drm/card1/card1-DP-1/i2c-6/i2c-dev/i2c-6
M: i2c-6
R: 6
U: i2c-dev
D: c 89:6
N: i2c-6
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:03.1/0000:2d:00.0/0000:2e:00.0/0000:2f:00.0/drm/card1/card1-DP-1/i2c-6/i2c-dev/i2c-6
E: DEVNAME=/dev/i2c-6
E: MAJOR=89
E: MINOR=6
E: SUBSYSTEM=i2c-dev
E: USEC_INITIALIZED=5397016
E: ID_PATH=pci-0000:2f:00.0
E: ID_PATH_TAG=pci-0000_2f_00_0
E: ID_FOR_SEAT=i2c-dev-pci-0000_2f_00_0
E: TAGS=:seat:uaccess:
E: CURRENT_TAGS=:seat:uaccess:
❯ udevadm test /devices/pci0000:00/0000:00:03.1/0000:2d:00.0/0000:2e:00.0/0000:2f:00.0/drm/card1/card1-DP-1/i2c-6/i2c-dev/i2c-6
# Some stuff I commented out
Reading rules file: /usr/lib/udev/rules.d/96-e2scrub.rules
Reading rules file: /usr/lib/udev/rules.d/99-fuse3.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
sd-device: Failed to chase symlinks in "/devices/pci0000:00/0000:00:03.1/0000:2d:00.0/0000:2e:00.0/0000:2f:00.0/drm/card1/card1-DP-1/i2c-6/i2c-dev/i2c-6".
i2c-6: /usr/lib/udev/rules.d/45-i2c-tools.rules:2 GROUP 963
i2c-6: /usr/lib/udev/rules.d/45-i2c-tools.rules:2 MODE 0660
i2c-6: /usr/lib/udev/rules.d/71-seat.rules:74 Importing properties from results of builtin command 'path_id'
i2c-6: /usr/lib/udev/rules.d/73-seat-late.rules:16 RUN 'uaccess'
i2c-6: Preserve permissions of /dev/i2c-6, uid=0, gid=963, mode=0660
i2c-6: Failed to create symlink '/dev/char/89:6' to '/dev/i2c-6': Permission denied
i2c-6: Failed to create device symlink '/dev/char/89:6': Permission denied
DEVPATH=/devices/pci0000:00/0000:00:03.1/0000:2d:00.0/0000:2e:00.0/0000:2f:00.0/drm/card1/card1-DP-1/i2c-6/i2c-dev/i2c-6
DEVNAME=/dev/i2c-6
MAJOR=89
MINOR=6
ACTION=add
SUBSYSTEM=i2c-dev
TAGS=:uaccess:seat:
CURRENT_TAGS=:uaccess:seat:
ID_PATH=pci-0000:2f:00.0
ID_PATH_TAG=pci-0000_2f_00_0
ID_FOR_SEAT=i2c-dev-pci-0000_2f_00_0
run: 'uaccess'
Unload kernel module index.
Unloaded link configuration context.

There might be something useful in the last output?

BuonHobo commented 11 months ago

Even though that log says that it could not create the symlink, I verified that the symlink actually does exist:

❯ stat /dev/char/89:6
  File: /dev/char/89:6 -> ../i2c-6
  Size: 8           Blocks: 0          IO Block: 4096   symbolic link
Device: 0,5 Inode: 749         Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-12-09 10:05:48.654130617 +0100
Modify: 2023-12-09 09:51:36.581495009 +0100
Change: 2023-12-09 09:51:36.581495009 +0100
Birth: 2023-12-09 09:51:36.581495009 +0100
daitj commented 11 months ago

It looks like you have ddcutil running well, that shouldn't be the issue. I think you can stop debugging that. Since getvcp works well.

Could you post your gnome-shell logs, enable verbose debugging in this extension's settings and then from Extensions application disable and enable this extension.

Also make sure you have other extensions disabled so they are not interfering with this extension.

BuonHobo commented 11 months ago

I managed to get it working by trying to toggle "Disable Display State Check" on. I don't really know what it did. I'll paste the logs with it on and off.

OFF

Dec 09 10:47:07 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           Adding to system menu
Dec 09 10:47:07 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           Add keyboard shortcuts
Dec 09 10:47:07 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil brief info:
                                           Display 1
                                              I2C bus:          /dev/i2c-6
                                              DRM connector:    card1-DP-1
                                              Monitor:          SAM:LC34G55T:HNTW802109

Dec 09 10:47:07 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil brief info found bus line:
                                               I2C bus:          /dev/i2c-6
Dec 09 10:47:07 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil reading display state for bus: 6
Dec 09 10:47:08 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil reading display status for bus: 6 is: VCP D6 SNC x00

ON

Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           Adding to system menu
Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           Add keyboard shortcuts
Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil brief info:
                                           Display 1
                                              I2C bus:          /dev/i2c-6
                                              DRM connector:    card1-DP-1
                                              Monitor:          SAM:LC34G55T:HNTW802109

Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil brief info found bus line:
                                               I2C bus:          /dev/i2c-6
Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil reading display state for bus: 6
Dec 09 10:46:15 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           ddcutil reading display status for bus: 6 is: VCP D6 SNC x00
Dec 09 10:46:17 desktop gnome-shell[1239]: display-brightness-ddcutil extension:
                                           Reloading widgets

It's basically the same, the only difference is that turning it on manages to get it to the final "Reloading widgets" log.

I hope I showed you the correct logs, I did it by enabling verbose debugging, disabling and reenabling the extension from "Extensions" and then running journalctl --no-pager -b /usr/bin/gnome-shell

daitj commented 11 months ago

I am sorry, I should have noticed that in your first post. Your monitor is not responding correctly for VCP code D6 (ddcutil getvcp D6) which is for display state. It should be 0x01 when it is ON. You need to disable the display state check like you have figured out already.