FedeDP / Clightd

A linux bus interface that lets you change screen brightness, compute captured webcam frames brightness and change screen temperature.
GNU General Public License v3.0
83 stars 10 forks source link

External monitor backlight not detected until the `clightd.service` restarted or disabled #76

Closed fitrh closed 3 years ago

fitrh commented 3 years ago

On every boot, clightd does not detected the external monitor unless the systemd service restarted or disabled and enabled again, i don't remember, but i think this is happen after i build the latest version of clightd

FedeDP commented 3 years ago

I am not sure, may be clightd is started before the monitor is detected? Ddcutil (used by clightd to manage external display) does not support monitor hotplugging. Is the monitor properly connected on boot?

fitrh commented 3 years ago

I think so, because it works before, i just realize this problem after trying the new Backlight2

FedeDP commented 3 years ago

I see: new Backlight2 API generates its api dynamically from internal/external monitor ids; this means that as soon as clightd is started, it scans all internal and external devices available at the time and creates the api. Thus ddcutil is initialized very soon during the startup.

With old Backlight api instead, list of device was first loaded the first time a SetAll/GetAll was called, thus ddcutil initialization was called very later (by a call from Clight or from a manual dbus invocation).

This is a problem i did not consider while developing Backlight2...the issue could be resolved by either having ddcutil support hotplug (i opened an issue: https://github.com/rockowitz/ddcutil/issues/202) or somewhat "intercept" the first introspection on clightd Backlight2 api and generating the api in that moment (i don't even know if this is feasible).

Luckily enough, it seems next ddcutil version will provide a way to rescan the displays (thus somewhat supporting hotplugging), thanks @rockowitz! I think that Clightd can have eg a 30s timer and rescan the displays every 30s (or may be there will be a better way, for now it is only a ddcutil release candidate).

fitrh commented 3 years ago

or somewhat "intercept" the first introspection on clightd Backlight2 api and generating the api in that moment

Yeah, this is what i think i should do before, and thanks for your explanation

FedeDP commented 3 years ago

This should now be fixed in latest master: since ddcutil 1.2.0 monitor hotplug is supported (well, you are able to redetect displays, indeed); clightd refresh external displays every 30s.