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
82 stars 10 forks source link

[BUG] External monitors update brightness starting from 0 instead of actual value. #68

Closed NICHOLAS85 closed 3 years ago

NICHOLAS85 commented 3 years ago

Clight version the issue has been seen with:

https://github.com/FedeDP/Clight/commit/da42d65c16cc0d8fefc64f20e1c0be7b5fc0ce00

Clightd version the issue has been seen with:

77fa37ae73b7910b4910b5d6b4906131706239f5

Used distribution:

Bedrock Linux 0.7.20beta1 (Poki), Debian Testing stratum

Describe the bug On capture, external monitors transition from 0 to new value, regardless of what value they were set at before capture. In the log you can see a laptop screen and an external monitor both updating, the external monitor starting from 0 instead of its previous value.

clight.log ``` Clight * Software version: 4.3 * Global config dir: /etc/default * Global data dir: /usr/share/clight * Starting time: Sat Feb 6 21:29:20 2021 Starting options: ### GENERIC ### * Verbose (debug): Enabled * ResumeDelay: 0 ### BACKLIGHT ### * Smooth trans: Enabled * Smooth steps: 0.02 * Smooth timeout: 30 * Daily timeouts: AC 900 BATT 1800 * Nightly timeout: AC 2700 BATT 5400 * Event timeouts: AC 300 BATT 600 * Backlight path: Unset * Shutter threshold: 0.00 * Autocalibration: Enabled * Pause on lid closed: Enabled * Capture on lid opened: Enabled ### SENSOR ### * Captures: AC 5 BATT 5 * Device: video0 * Settings: 10094849=1,10094850=500 ### KEYBOARD ### * Dim: Disabled * Threshold: 0.90 * Timeouts: AC 10 BATT 10 ### GAMMA ### * Smooth trans: Enabled * Smooth steps: 50 * Smooth timeout: 300 * Daily screen temp: 6500 * Nightly screen temp: 4200 * Long transition: Enabled * Ambient gamma: Disabled ### DAYTIME ### * User position: Unset * User set sunrise: Unset * User set sunset: Unset * Event duration: 1800 ### DIMMER ### * Smooth trans: ENTER: Enabled, EXIT: Enabled * Smooth steps: ENTER: 0.05, EXIT: 0.05 * Smooth timeout: ENTER: 30, EXIT: 30 * Timeouts: AC 200 BATT 100 * Backlight pct: 0.06 ### DPMS ### * Timeouts: AC 2700 BATT 900 ### SCREEN ### * Timeouts: AC 60 BATT -1 * Contrib: 0.10 * Samples: 10 ### INHIBIT ### * Docked: Disabled * PowerManagement: Disabled (I)[21:29:20]{main.c:127} Clightd found, version: 5.2. (I)[21:29:20]{main.c:157} '/home/nicholas/.local/share/clight/modules.d/inhibit_md' loaded. (I)[21:29:20]{main.c:157} '/home/nicholas/.local/share/clight/modules.d/trendlog' loaded. (I)[21:29:20]{backlight.c:410} AC curve: y = -0.047881 + 0.140997x + -0.003759x^2 BL ^ | * | ** | * | * | * | | * | * | * |* *---------->BR (I)[21:29:20]{backlight.c:410} BATT curve: y = -0.023965 + 0.079628x + 0.001078x^2 BL ^ | | * | | *** | * | | * | | ** |** *---------->BR (I)[21:29:20]{keyboard.c:126} Keyboard backlight calibration supported. (I)[21:29:20]{trendlog.c:47} Logging AmbientBr and BlPct into /home/nicholas/.cache/clight-trendlog/ (W)[21:29:20]{interface.c:399} Failed to create org.freedesktop.ScreenSaver dbus interface: Unknown error -1 (I)[21:29:20]{interface.c:400} Fallback at monitoring requests to org.freedesktop.ScreenSaver name owner. (D)[21:29:20]{timer.c:34} Disarmed timerfd on fd 44. (I)[21:29:20]{upower.c:54} AC cable connected. (I)[21:29:20]{upower.c:65} Laptop lid opened. (D)[21:29:20]{interface.c:445} Emitting 'AcState' property (D)[21:29:20]{timer.c:32} Set timeout of 0s 1ns on fd 47. (D)[21:29:20]{interface.c:445} Emitting 'LidState' property (D)[21:29:20]{timer.c:32} Set timeout of 60s 0ns on fd 47. (D)[21:29:20]{location.c:95} 35.84 -78.85 loaded from cache file. (D)[21:29:20]{my_math.c:248} Loc distance: 35.84,-78.85 -> 91.00,181.00 : 3730.01 km. (I)[21:29:20]{location.c:62} New location received: 35.84, -78.85. (D)[21:29:20]{timer.c:32} Set timeout of 0s 1ns on fd 48. (D)[21:29:20]{interface.c:445} Emitting 'Location' property (I)[21:29:20]{daytime.c:175} Next alarm due to: Sun Feb 7 06:42:00 2021 (D)[21:29:20]{timer.c:32} Set timeout of 33160s 0ns on fd 48. (D)[21:29:20]{interface.c:445} Emitting 'Sunrise' property (D)[21:29:20]{interface.c:445} Emitting 'Sunset' property (D)[21:29:20]{interface.c:445} Emitting 'DayTime' property (I)[21:29:20]{gamma.c:177} Normal transition to 4200 gamma temp. (D)[21:29:20]{timer.c:32} Set timeout of 0s 1ns on fd 49. (D)[21:29:20]{backlight.c:283} Sensor '/dev/video0' is now available. (D)[21:29:20]{backlight.c:489} Resumed as a sensor is now available. (D)[21:29:20]{interface.c:445} Emitting 'NextEvent' property (D)[21:29:20]{inhibit_md.c:117} New temp: 4200, Saved temp: 6500, Step: 50, Timeout: 300 (D)[21:29:20]{interface.c:445} Emitting 'Temp' property (D)[21:29:20]{inhibit_md.c:117} New temp: 4200, Saved temp: 4200, Step: 4200, Timeout: 0 (D)[21:29:20]{interface.c:445} Emitting 'SensorAvail' property (D)[21:29:20]{backlight.c:297} Captured [5/5] from '/dev/video0'. Ambient brightness: 0.727340. (I)[21:29:22]{backlight.c:323} Ambient brightness: 0.727 -> Backlight pct: 0.779. (D)[21:29:22]{timer.c:32} Set timeout of 2700s 0ns on fd 49. (D)[21:29:22]{interface.c:445} Emitting 'Temp' property (D)[21:29:22]{interface.c:445} Emitting 'AmbientBr' property (D)[21:29:22]{interface.c:445} Emitting 'BlPct' property (D)[21:29:22]{interface.c:445} Emitting 'KbdPct' property (D)[21:29:22]{location.c:174} 35.92 -79.05 received from Geoclue2. (D)[21:29:22]{backlight.c:503} Backlight level updated: 0.02. (D)[21:29:22]{backlight.c:503} Backlight level updated: 0.91. (D)[21:29:22]{my_math.c:248} Loc distance: 35.92,-79.05 -> 35.84,-78.85 : 12.59 km. (D)[21:29:22]{validations.c:10} Failed to validate location request. (D)[21:29:22]{interface.c:445} Emitting 'BlPct' property (D)[21:29:22]{interface.c:445} Emitting 'BlPct' property (D)[21:29:22]{backlight.c:503} Backlight level updated: 0.91. (D)[21:29:22]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.04. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.89. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.06. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.87. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.08. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.85. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.10. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:23]{backlight.c:503} Backlight level updated: 0.83. (D)[21:29:23]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.12. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.81. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.14. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.79. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.16. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.78. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:24]{backlight.c:503} Backlight level updated: 0.18. (D)[21:29:24]{interface.c:445} Emitting 'BlPct' property (D)[21:29:25]{backlight.c:503} Backlight level updated: 0.20. (D)[21:29:25]{interface.c:445} Emitting 'BlPct' property (D)[21:29:25]{backlight.c:503} Backlight level updated: 0.22. (D)[21:29:25]{interface.c:445} Emitting 'BlPct' property (D)[21:29:25]{backlight.c:503} Backlight level updated: 0.24. (D)[21:29:25]{interface.c:445} Emitting 'BlPct' property (D)[21:29:25]{backlight.c:503} Backlight level updated: 0.26. (D)[21:29:25]{interface.c:445} Emitting 'BlPct' property (D)[21:29:26]{backlight.c:503} Backlight level updated: 0.28. (D)[21:29:26]{interface.c:445} Emitting 'BlPct' property (D)[21:29:26]{backlight.c:503} Backlight level updated: 0.30. (D)[21:29:26]{interface.c:445} Emitting 'BlPct' property (D)[21:29:26]{backlight.c:503} Backlight level updated: 0.32. (D)[21:29:26]{interface.c:445} Emitting 'BlPct' property (D)[21:29:26]{backlight.c:503} Backlight level updated: 0.34. (D)[21:29:26]{interface.c:445} Emitting 'BlPct' property (D)[21:29:27]{backlight.c:503} Backlight level updated: 0.36. (D)[21:29:27]{interface.c:445} Emitting 'BlPct' property (D)[21:29:27]{backlight.c:503} Backlight level updated: 0.38. (D)[21:29:27]{interface.c:445} Emitting 'BlPct' property (D)[21:29:27]{backlight.c:503} Backlight level updated: 0.40. (D)[21:29:27]{interface.c:445} Emitting 'BlPct' property (D)[21:29:27]{backlight.c:503} Backlight level updated: 0.42. (D)[21:29:27]{interface.c:445} Emitting 'BlPct' property (D)[21:29:28]{backlight.c:503} Backlight level updated: 0.44. (D)[21:29:28]{interface.c:445} Emitting 'BlPct' property (D)[21:29:28]{backlight.c:503} Backlight level updated: 0.46. (D)[21:29:28]{interface.c:445} Emitting 'BlPct' property (D)[21:29:28]{backlight.c:503} Backlight level updated: 0.48. (D)[21:29:28]{interface.c:445} Emitting 'BlPct' property (D)[21:29:28]{backlight.c:503} Backlight level updated: 0.50. (D)[21:29:28]{interface.c:445} Emitting 'BlPct' property (D)[21:29:28]{backlight.c:503} Backlight level updated: 0.52. (D)[21:29:28]{interface.c:445} Emitting 'BlPct' property (D)[21:29:29]{backlight.c:503} Backlight level updated: 0.54. (D)[21:29:29]{interface.c:445} Emitting 'BlPct' property (D)[21:29:29]{backlight.c:503} Backlight level updated: 0.56. (D)[21:29:29]{interface.c:445} Emitting 'BlPct' property (D)[21:29:29]{backlight.c:503} Backlight level updated: 0.58. (D)[21:29:29]{interface.c:445} Emitting 'BlPct' property (D)[21:29:29]{backlight.c:503} Backlight level updated: 0.60. (D)[21:29:29]{interface.c:445} Emitting 'BlPct' property (D)[21:29:30]{backlight.c:503} Backlight level updated: 0.62. (D)[21:29:30]{interface.c:445} Emitting 'BlPct' property (D)[21:29:30]{backlight.c:503} Backlight level updated: 0.64. (D)[21:29:30]{interface.c:445} Emitting 'BlPct' property (D)[21:29:30]{backlight.c:503} Backlight level updated: 0.66. (D)[21:29:30]{interface.c:445} Emitting 'BlPct' property (D)[21:29:30]{backlight.c:503} Backlight level updated: 0.68. (D)[21:29:30]{interface.c:445} Emitting 'BlPct' property (D)[21:29:31]{backlight.c:503} Backlight level updated: 0.70. (D)[21:29:31]{interface.c:445} Emitting 'BlPct' property (D)[21:29:31]{backlight.c:503} Backlight level updated: 0.72. (D)[21:29:31]{interface.c:445} Emitting 'BlPct' property (D)[21:29:31]{backlight.c:503} Backlight level updated: 0.74. (D)[21:29:31]{interface.c:445} Emitting 'BlPct' property (D)[21:29:31]{backlight.c:503} Backlight level updated: 0.76. (D)[21:29:31]{interface.c:445} Emitting 'BlPct' property (D)[21:30:20]{bus.c:181} get_screen_brightness(): Unknown object '/org/clightd/clightd/Screen'. ```
NICHOLAS85 commented 3 years ago

This seems to have occured as a result of commit 075c65f283972bc4f3c1f31f80647ed388ae1cab

NICHOLAS85 commented 3 years ago

Additionally, I am occasionally seeing the message (D)[21:30:20]{bus.c:181} get_screen_brightness(): Unknown object '/org/clightd/clightd/Screen'. appear in my logs

FedeDP commented 3 years ago

Hi! Thanks for opening the bug report. The issue should be fixed in latest Clightd. Moreover, latest Clight only follows first backlight interface received emitted signals; ie: with 2+ monitors, it won't follow all of them but just the first monitor on which it receives a signal Backlight.Chaned. This prevents multiple bl_upd messages to be sent. Note that after first time Clight takes control of screens backlight, afterwards most probably screens will always have same backlight set. Ie: the only problem solved here is when each monitor starts on system boot with different backlight levels.

FedeDP commented 3 years ago

Additionally, I am occasionally seeing the message (D)[21:30:20]{bus.c:181} get_screen_brightness(): Unknown object '/org/clightd/clightd/Screen'. appear in my logs

That is weird! Never seen it; Clightd was killed maybe?

FedeDP commented 3 years ago

Ok i left a segfault in that commit :D can you try once again?

Additionally, I am occasionally seeing the message (D)[21:30:20]{bus.c:181} get_screen_brightness(): Unknown object '/org/clightd/clightd/Screen'. appear in my logs

I expect this message to also disappear.

NICHOLAS85 commented 3 years ago

Looks like this issue and the Unknown object '/org/clightd/clightd/Screen'. messages have gone away with the latest updates!