Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Monitors with missing Model / MCCS version fields are not detected #46

Open
Mynacol opened this issue Feb 13, 2022 · 7 comments
Open

Comments

@Mynacol
Copy link

Mynacol commented Feb 13, 2022

Steps for reproducing the issue

Having a bad monitor with unspecified Model and MCCS version :/

What is the buggy behavior?

Wluma does not detect one of my two monitors. See logs.

What is the expected behavior?

Even with broken/missing information, this monitor is able to change brightness and other parameters over DDC. Wluma should be able to support those partially broken monitors as well.

Logs

$ RUST_LOG=debug wluma
[2022-02-13T19:48:56Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                11: "normal",
                0: "night",
                7: "dark",
                16: "normal",
                20: "night",
                9: "dim",
                18: "dark",
                13: "bright",
            },
        },
        output: [
            DdcUtil(
                DdcUtilOutput {
                    name: "1908FP",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
            DdcUtil(
                DdcUtilOutput {
                    name: "W2443",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
        ],
    }
[2022-02-13T19:48:58Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 "]
[2022-02-13T19:48:58Z WARN  wluma] Skipping '1908FP' as it might be disconnected: Unable to find display
[2022-02-13T19:49:00Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 "]
[2022-02-13T19:49:00Z DEBUG wluma::brightness::ddcutil] Using display 'W2443 ' for config 'W2443'
[2022-02-13T19:49:00Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.

Version

wluma 4.1.2-1 from AUR

Environment

Still sway on Arch Linux.

Monitor information from ddcutil:

$ ddcutil detect
Display 2
   I2C bus:  /dev/i2c-5
   EDID synopsis:
      Mfg id:               DEL
      Model:                DELL 1908FP
      Product code:         16422
      Serial number:        [redacted]
      Binary serial number: [redacted] (0x[redacted])
      Manufacture year:     2008,  Week: 24
   VCP version:         2.0
$ ddcutil probe
EDID version: 1.3
Mfg id: DEL, model: DELL 1908FP, sn: [redacted]
Product code: 16422, binary serial number [redacted] (0x[redacted])

How display reports unsupported feature: DREF_DDC_USES_DDC_FLAG_FOR_UNSUPPORTED

Capabilities for display on bus /dev/i2c-5
Read cached capabilities string from /home/paul/.cache/ddcutil/capabilities
Unparsed capabilities string: type(LCD)vcp(02 04 05 08 0B 0C 0E 10 12 14(01 04 08 0B) 16 18 1A 1E 20 30 3E 52 6C 6E 70 AC AE B2 B6 C0 C8 C9 CA D6(01 02 03 04) DF) mswhql(1)
Model: Not specified
MCCS version: Not specified
VCP Features:
   Feature: 02 (New control value)
   Feature: 04 (Restore factory defaults)
   Feature: 05 (Restore factory brightness/contrast defaults)
   Feature: 08 (Restore color defaults)
   Feature: 0B (Color temperature increment)
   Feature: 0C (Color temperature request)
   Feature: 0E (Clock)
   Feature: 10 (Brightness)
   Feature: 12 (Contrast)
   Feature: 14 (Select color preset)
      Values (unparsed): 01 04 08 0B
      Values (  parsed):
         01: sRGB
         04: 5000 K
         08: 9300 K
         0b: User 1
   Feature: 16 (Video gain: Red)
   Feature: 18 (Video gain: Green)
   Feature: 1A (Video gain: Blue)
   Feature: 1E (Auto setup)
   Feature: 20 (Horizontal Position)
   Feature: 30 (Vertical Position)
   Feature: 3E (Clock phase)
   Feature: 52 (Active control)
   Feature: 6C (Video black level: Red)
   Feature: 6E (Video black level: Green)
   Feature: 70 (Video black level: Blue)
   Feature: AC (Horizontal frequency)
   Feature: AE (Vertical frequency)
   Feature: B2 (Flat panel sub-pixel layout)
   Feature: B6 (Display technology type)
   Feature: C0 (Display usage time)
   Feature: C8 (Display controller type)
   Feature: C9 (Display firmware level)
   Feature: CA (OSD)
   Feature: D6 (Power mode)
      Values (unparsed): 01 02 03 04
      Values (  parsed):
         01: DPM: On,  DPMS: Off
         02: DPM: Off, DPMS: Standby
         03: DPM: Off, DPMS: Suspend
         04: DPM: Off, DPMS: Off
   Feature: DF (VCP Version)

May support table reads:   false

Scanning all VCP feature codes for display Display_Handle[i2c: fd=3, busno=5 @0x55f13b991fd0]
VCP code 0x02 (New control value             ): <reserved code, must be ignored> (0x00)
VCP code 0x03 (Soft controls                 ): Unsupported feature code
VCP code 0x07 (Unknown feature               ): Unsupported feature code
VCP code 0x09 (Unknown feature               ): Unsupported feature code
VCP code 0x0b (Color temperature increment   ): 3000 degree(s) Kelvin
VCP code 0x0c (Color temperature request     ): 3000 + 2 * (feature 0B color temp increment) degree(s) Kelvin
VCP code 0x0d (Unknown feature               ): Unsupported feature code
VCP code 0x0e (Clock                         ): current value =     0, max value = 65535
VCP code 0x0f (Unknown feature               ): Unsupported feature code
VCP code 0x10 (Brightness                    ): current value =     0, max value =   100
VCP code 0x11 (Flesh tone enhancement        ): Unsupported feature code
VCP code 0x12 (Contrast                      ): current value =    50, max value =   100
VCP code 0x13 (Backlight control             ): Unsupported feature code
VCP code 0x14 (Select color preset           ): sRGB (sl=0x01)
VCP code 0x15 (Unknown feature               ): Unsupported feature code
VCP code 0x16 (Video gain: Red               ): current value =   100, max value =   100
VCP code 0x17 (User color vision compensation): Unsupported feature code
VCP code 0x18 (Video gain: Green             ): current value =   100, max value =   100
VCP code 0x19 (Unknown feature               ): Unsupported feature code
VCP code 0x1a (Video gain: Blue              ): current value =   100, max value =   100
VCP code 0x1b (Unknown feature               ): Unsupported feature code
VCP code 0x1c (Focus                         ): Unsupported feature code
VCP code 0x1d (Unknown feature               ): Unsupported feature code
VCP code 0x1e (Auto setup                    ): Auto setup not active (sl=0x00)
VCP code 0x1f (Auto color setup              ): Unsupported feature code
VCP code 0x20 (Horizontal Position           ): current value =     0, max value = 65535
VCP code 0x21 (Unknown feature               ): Unsupported feature code
VCP code 0x22 (Horizontal Size               ): Unsupported feature code
VCP code 0x23 (Unknown feature               ): Unsupported feature code
VCP code 0x24 (Horizontal Pincushion         ): Unsupported feature code
VCP code 0x25 (Unknown feature               ): Unsupported feature code
VCP code 0x26 (Horizontal Pincushion Balance ): Unsupported feature code
VCP code 0x27 (Unknown feature               ): Unsupported feature code
VCP code 0x28 (Horizontal Convergence        ): Unsupported feature code
VCP code 0x29 (Horizontal Convergence M/G    ): Unsupported feature code
VCP code 0x2a (Horizontal Linearity          ): Unsupported feature code
VCP code 0x2b (Unknown feature               ): Unsupported feature code
VCP code 0x2c (Horizontal Linearity Balance  ): Unsupported feature code
VCP code 0x2d (Unknown feature               ): Unsupported feature code
VCP code 0x2e (Gray scale expansion          ): Unsupported feature code
VCP code 0x2f (Unknown feature               ): Unsupported feature code
VCP code 0x30 (Vertical Position             ): current value =     0, max value = 65535
VCP code 0x31 (Unknown feature               ): Unsupported feature code
VCP code 0x32 (Vertical Size                 ): Unsupported feature code
VCP code 0x33 (Unknown feature               ): Unsupported feature code
VCP code 0x34 (Vertical Pincushion           ): Unsupported feature code
VCP code 0x35 (Unknown feature               ): Unsupported feature code
VCP code 0x36 (Vertical Pincushion Balance   ): Unsupported feature code
VCP code 0x37 (Unknown feature               ): Unsupported feature code
VCP code 0x38 (Vertical Convergence          ): Unsupported feature code
VCP code 0x39 (Vertical Convergence M/G      ): Unsupported feature code
VCP code 0x3a (Vertical Linearity            ): Unsupported feature code
VCP code 0x3b (Unknown feature               ): Unsupported feature code
VCP code 0x3c (Vertical Linearity Balance    ): Unsupported feature code
VCP code 0x3d (Unknown feature               ): Unsupported feature code
VCP code 0x3e (Clock phase                   ): current value =     0, max value = 65535
VCP code 0x3f (Unknown feature               ): Unsupported feature code
VCP code 0x40 (Key Balance                   ): Unsupported feature code
VCP code 0x41 (Vertical Parallelogram        ): Unsupported feature code
VCP code 0x42 (Horizontal Trapezoid          ): Unsupported feature code
VCP code 0x43 (Vertical Trapezoid            ): Unsupported feature code
VCP code 0x44 (Tilt (rotation)               ): Unsupported feature code
VCP code 0x45 (Unknown feature               ): Unsupported feature code
VCP code 0x46 (Top Corner                    ): Unsupported feature code
VCP code 0x47 (Unknown feature               ): Unsupported feature code
VCP code 0x48 (Top Corner Balance            ): Unsupported feature code
VCP code 0x49 (Unknown feature               ): Unsupported feature code
VCP code 0x4a (Bottom Corner                 ): Unsupported feature code
VCP code 0x4b (Unknown feature               ): Unsupported feature code
VCP code 0x4c (Bottom Corner Balance         ): Unsupported feature code
VCP code 0x4d (Unknown feature               ): Unsupported feature code
VCP code 0x4e (Unknown feature               ): Unsupported feature code
VCP code 0x4f (Unknown feature               ): Unsupported feature code
VCP code 0x50 (Unknown feature               ): Unsupported feature code
VCP code 0x51 (Unknown feature               ): Unsupported feature code
VCP code 0x52 (Active control                ): Value: 0x00
VCP code 0x53 (Unknown feature               ): Unsupported feature code
VCP code 0x54 (Performance Preservation      ): Unsupported feature code
VCP code 0x55 (Unknown feature               ): Unsupported feature code
VCP code 0x56 (Horizontal Moire              ): Unsupported feature code
VCP code 0x57 (Unknown feature               ): Unsupported feature code
VCP code 0x58 (Vertical Moire                ): Unsupported feature code
VCP code 0x59 (6 axis saturation: Red        ): Unsupported feature code
VCP code 0x5a (6 axis saturation: Yellow     ): Unsupported feature code
VCP code 0x5b (6 axis saturation: Green      ): Unsupported feature code
VCP code 0x5c (6 axis saturation: Cyan       ): Unsupported feature code
VCP code 0x5d (6 axis saturation: Blue       ): Unsupported feature code
VCP code 0x5e (6 axis saturation: Magenta    ): Unsupported feature code
VCP code 0x5f (Unknown feature               ): Unsupported feature code
VCP code 0x60 (Input Source                  ): DVI-1 (sl=0x03)
VCP code 0x61 (Unknown feature               ): Unsupported feature code
VCP code 0x62 (Audio speaker volume          ): Unsupported feature code
VCP code 0x63 (Speaker Select                ): Unsupported feature code
VCP code 0x64 (Audio: Microphone Volume      ): Unsupported feature code
VCP code 0x65 (Unknown feature               ): Unsupported feature code
VCP code 0x66 (Ambient light sensor          ): Unsupported feature code
VCP code 0x67 (Unknown feature               ): Unsupported feature code
VCP code 0x68 (Unknown feature               ): mh=0xff, ml=0xff, sh=0x00, sl=0x01
VCP code 0x69 (Unknown feature               ): Unsupported feature code
VCP code 0x6a (Unknown feature               ): Unsupported feature code
VCP code 0x6b (Backlight Level: White        ): Unsupported feature code
VCP code 0x6c (Video black level: Red        ): current value =    10, max value =   100
VCP code 0x6d (Backlight Level: Red          ): Unsupported feature code
VCP code 0x6e (Video black level: Green      ): current value =    10, max value =   100
VCP code 0x6f (Backlight Level: Green        ): Unsupported feature code
VCP code 0x70 (Video black level: Blue       ): current value =    10, max value =   100
VCP code 0x71 (Backlight Level: Blue         ): Unsupported feature code
VCP code 0x72 (Gamma                         ): Unsupported feature code
VCP code 0x73 (LUT Size                      ): Unsupported feature code (DDC NULL Message)
VCP code 0x74 (Single point LUT operation    ): Unsupported feature code (DDC NULL Message)
VCP code 0x75 (Block LUT operation           ): Unsupported feature code (DDC NULL Message)
VCP code 0x77 (Unknown feature               ): Unsupported feature code
VCP code 0x78 (EDID operation                ): Unsupported feature code (DDC NULL Message)
VCP code 0x79 (Unknown feature               ): Unsupported feature code
VCP code 0x7a (Adjust Focal Plane            ): Unsupported feature code
VCP code 0x7b (Unknown feature               ): Unsupported feature code
VCP code 0x7c (Adjust Zoom                   ): Unsupported feature code
VCP code 0x7d (Unknown feature               ): Unsupported feature code
VCP code 0x7e (Trapezoid                     ): Unsupported feature code
VCP code 0x7f (Unknown feature               ): Unsupported feature code
VCP code 0x80 (Keystone                      ): Unsupported feature code
VCP code 0x81 (Unknown feature               ): Unsupported feature code
VCP code 0x83 (Unknown feature               ): Unsupported feature code
VCP code 0x85 (Unknown feature               ): Unsupported feature code
VCP code 0x86 (Display Scaling               ): Unsupported feature code
VCP code 0x87 (Sharpness                     ): Unsupported feature code
VCP code 0x88 (Velocity Scan Modulation      ): Unsupported feature code
VCP code 0x89 (Unknown feature               ): Unsupported feature code
VCP code 0x8a (TV Color Saturation           ): Unsupported feature code
VCP code 0x8c (TV Sharpness                  ): Unsupported feature code
VCP code 0x8d (Audio Mute                    ): Unsupported feature code
VCP code 0x8e (TV Contrast                   ): Unsupported feature code
VCP code 0x8f (Audio Treble                  ): Unsupported feature code
VCP code 0x90 (Hue                           ): Unsupported feature code
VCP code 0x91 (Audio Bass                    ): Unsupported feature code
VCP code 0x92 (TV Black level/Brightness     ): Unsupported feature code
VCP code 0x93 (Audio Balance L/R             ): Unsupported feature code
VCP code 0x94 (Audio Stereo Mode             ): Unsupported feature code
VCP code 0x95 (Window Position(TL_X)         ): Unsupported feature code
VCP code 0x96 (Window Position(TL_Y)         ): Unsupported feature code
VCP code 0x97 (Window Position(BR_X)         ): Unsupported feature code
VCP code 0x98 (Window Position(BR_Y)         ): Unsupported feature code
VCP code 0x99 (Window control on/off         ): Unsupported feature code
VCP code 0x9a (Window background             ): Unsupported feature code
VCP code 0x9b (6 axis hue control: Red       ): current value =   100, max value =   100
VCP code 0x9c (6 axis hue control: Yellow    ): Unsupported feature code
VCP code 0x9d (6 axis hue control: Green     ): current value =   100, max value =   100
VCP code 0x9e (6 axis hue control: Cyan      ): Unsupported feature code
VCP code 0x9f (6 axis hue control: Blue      ): current value =   100, max value =   100
VCP code 0xa0 (6 axis hue control: Magenta   ): Unsupported feature code
VCP code 0xa1 (Unknown feature               ): Unsupported feature code
VCP code 0xa3 (Unknown feature               ): Unsupported feature code
VCP code 0xa4 (Turn the selected window operation on/off): Unsupported feature code
VCP code 0xa5 (Change the selected window    ): Unsupported feature code
VCP code 0xa6 (Unknown feature               ): Unsupported feature code
VCP code 0xa7 (Unknown feature               ): Unsupported feature code
VCP code 0xa8 (Unknown feature               ): Unsupported feature code
VCP code 0xa9 (Unknown feature               ): Unsupported feature code
VCP code 0xaa (Screen Orientation            ): Unsupported feature code
VCP code 0xab (Unknown feature               ): Unsupported feature code
VCP code 0xac (Horizontal frequency          ): 79 hz
VCP code 0xad (Unknown feature               ): Unsupported feature code
VCP code 0xae (Vertical frequency            ): 0.75 hz
VCP code 0xaf (Unknown feature               ): Unsupported feature code
VCP code 0xb1 (Unknown feature               ): Unsupported feature code
VCP code 0xb2 (Flat panel sub-pixel layout   ): Sub-pixel layout not defined (sl=0x00)
VCP code 0xb3 (Unknown feature               ): Unsupported feature code
VCP code 0xb4 (Source Timing Mode            ): Unsupported feature code
VCP code 0xb5 (Unknown feature               ): Unsupported feature code
VCP code 0xb6 (Display technology type       ): LCD (active matrix) (sl=0x03)
VCP code 0xb7 (Monitor status                ): Unsupported feature code
VCP code 0xb8 (Packet count                  ): Unsupported feature code
VCP code 0xb9 (Monitor X origin              ): Unsupported feature code
VCP code 0xba (Monitor Y origin              ): Unsupported feature code
VCP code 0xbb (Header error count            ): Unsupported feature code
VCP code 0xbc (Body CRC error count          ): Unsupported feature code
VCP code 0xbd (Client ID                     ): Unsupported feature code
VCP code 0xbe (Link control                  ): Unsupported feature code
VCP code 0xbf (Unknown feature               ): Unsupported feature code
VCP code 0xc0 (Display usage time            ): Usage time (hours) = 30000 (0x007530) mh=0xff, ml=0xff, sh=0x75, sl=0x30
VCP code 0xc1 (Unknown feature               ): Unsupported feature code
VCP code 0xc2 (Display descriptor length     ): Unsupported feature code
VCP code 0xc3 (Transmit display descriptor   ): Unsupported feature code (DDC NULL Message)
VCP code 0xc4 (Enable display of 'display descriptor'): Unsupported feature code
VCP code 0xc5 (Unknown feature               ): Unsupported feature code
VCP code 0xc6 (Application enable key        ): Unsupported feature code
VCP code 0xc7 (Unknown feature               ): Unsupported feature code
VCP code 0xc8 (Display controller type       ): Mfg: Genesis (sl=0x02), controller number: mh=0xff, ml=0xff, sh=0x21
VCP code 0xc9 (Display firmware level        ): 1.2
VCP code 0xca (OSD                           ): OSD Disabled (sl=0x01)
VCP code 0xcb (Unknown feature               ): Unsupported feature code
VCP code 0xcc (OSD Language                  ): Unsupported feature code
VCP code 0xcd (Status Indicators             ): Unsupported feature code
VCP code 0xce (Auxiliary display size        ): Unsupported feature code
VCP code 0xd0 (Output select                 ): Unsupported feature code
VCP code 0xd1 (Unknown feature               ): Unsupported feature code
VCP code 0xd2 (Asset Tag                     ): Unsupported feature code (DDC NULL Message)
VCP code 0xd3 (Unknown feature               ): Unsupported feature code
VCP code 0xd4 (Stereo video mode             ): Unsupported feature code
VCP code 0xd5 (Unknown feature               ): Unsupported feature code
VCP code 0xd6 (Power mode                    ): DPM: On,  DPMS: Off (sl=0x01)
VCP code 0xd7 (Auxiliary power output        ): Unsupported feature code
VCP code 0xd8 (Unknown feature               ): Unsupported feature code
VCP code 0xd9 (Unknown feature               ): Unsupported feature code
VCP code 0xda (Scan format                   ): Unsupported feature code
VCP code 0xdb (Image Mode                    ): Unsupported feature code
VCP code 0xdc (Display Mode                  ): Unsupported feature code
VCP code 0xdd (Unknown feature               ): Unsupported feature code
VCP code 0xdf (VCP Version                   ): 2.0
VCP code 0xe0 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe1 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe2 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe3 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe4 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe5 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe6 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe7 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe8 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xe9 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xea (Manufacturer Specific         ): Unsupported feature code
VCP code 0xeb (Manufacturer Specific         ): Unsupported feature code
VCP code 0xec (Manufacturer Specific         ): Unsupported feature code
VCP code 0xed (Manufacturer Specific         ): Unsupported feature code
VCP code 0xee (Manufacturer Specific         ): Unsupported feature code
VCP code 0xef (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf0 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf1 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf2 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf3 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf4 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf5 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf6 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf7 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf8 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xf9 (Manufacturer Specific         ): Unsupported feature code
VCP code 0xfa (Manufacturer Specific         ): Unsupported feature code
VCP code 0xfb (Manufacturer Specific         ): Unsupported feature code
VCP code 0xfc (Manufacturer Specific         ): Unsupported feature code
VCP code 0xfd (Manufacturer Specific         ): Unsupported feature code
VCP code 0xfe (Manufacturer Specific         ): Unsupported feature code
VCP code 0xff (Manufacturer Specific         ): mh=0xff, ml=0xff, sh=0x00, sl=0x00


Comparing declared capabilities to observed features...

Readable features declared in capabilities string: 02 0b 0c 0e 10 12 14 16 18 1a 1e 20 30 3e 52 6c 6e 70 ac ae b2 b6 c0 c8 c9 ca d6 df

MCCS (VCP) version reported by capabilities: Unqueried
MCCS (VCP) version reported by feature 0xDf: 2.0
Versions do not match!!!

All readable features declared in capabilities were found by scanning.

Features found by scanning but not declared as capabilities:
   Feature x60 - Input Source
   Feature x68 - Unknown feature
   Feature x9b - 6 axis hue control: Red
   Feature x9d - 6 axis hue control: Green
   Feature x9f - 6 axis hue control: Blue
   Feature xff - Manufacturer Specific

Color temperature increment (x0b) = 184 degrees Kelvin
Color temperature request   (x0c) = 2
Requested color temperature = (3000 deg Kelvin) + 2 * (184 degrees Kelvin) = 3368 degrees Kelvin
@maximbaz
Copy link
Owner

Could you please add the following log:

    ddc_hi::Display::enumerate()
        .into_iter()
        .for_each(|mut display| {
            log::debug!(
                "update_capabilities result: {:?}",
                display.update_capabilities()
            );
        });

before this line:

log::debug!(

and show the output here?

@Mynacol
Copy link
Author

Mynacol commented Feb 13, 2022

The full log is now:

[2022-02-13T21:24:12Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                7: "dark",
                20: "night",
                16: "normal",
                9: "dim",
                0: "night",
                13: "bright",
                18: "dark",
                11: "normal",
            },
        },
        output: [
            DdcUtil(
                DdcUtilOutput {
                    name: "1908FP",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
            DdcUtil(
                DdcUtilOutput {
                    name: "W2443",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
        ],
    }
[2022-02-13T21:24:15Z DEBUG wluma::brightness::ddcutil] update_capabilities result: Ok(())
[2022-02-13T21:24:16Z DEBUG wluma::brightness::ddcutil] update_capabilities result: Err(Failed to parse MCCS capabilities

    Caused by:
        [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 97, 115, 115, 101, 116, 95, 101, 101, 112, 40, 52, 48, 41, 0, 255, 255, 109, 99, 99, 115, 95, 118, 101, 114, 40, 50, 46, 48, 41, 0, 255, 255, 9, 0, 0, 22, 161, 30, 0, 0, 23, 161, 30, 30, 0, 23, 161, 30, 60, 97, 115, 115, 101, 116, 95, 101, 101, 112, 40, 52, 48, 41, 109, 99, 99, 115, 95, 118, 101, 114, 40, 50, 46, 48, 41]:Eof)
[2022-02-13T21:24:16Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 "]
[2022-02-13T21:24:16Z WARN  wluma] Skipping '1908FP' as it might be disconnected: Unable to find display
[2022-02-13T21:24:20Z DEBUG wluma::brightness::ddcutil] update_capabilities result: Ok(())
[2022-02-13T21:24:21Z DEBUG wluma::brightness::ddcutil] update_capabilities result: Err(Failed to parse MCCS capabilities

    Caused by:
        [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 97, 115, 115, 101, 116, 95, 101, 101, 112, 40, 52, 48, 41, 0, 255, 255, 109, 99, 99, 115, 95, 118, 101, 114, 40, 50, 46, 48, 41, 0, 255, 255, 9, 0, 0, 22, 161, 30, 0, 0, 23, 161, 30, 30, 0, 23, 161, 30, 60, 97, 115, 115, 101, 116, 95, 101, 101, 112, 40, 52, 48, 41, 109, 99, 99, 115, 95, 118, 101, 114, 40, 50, 46, 48, 41]:Eof)
[2022-02-13T21:24:21Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 "]
[2022-02-13T21:24:21Z DEBUG wluma::brightness::ddcutil] Using display 'W2443 ' for config 'W2443'
[2022-02-13T21:24:21Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.

@maximbaz
Copy link
Owner

Cool, thanks!

Could you please try ddcutil-add-id branch, and provide debug logs once more if it still doesn't work? It should hopefully allow you to also use DDC ID field (whatever that is, you will see what wluma detects in debug logs), if getting name and models fails, instead of skipping that monitor as before.

update_capabilities result: Err(Failed to parse MCCS capabilities

This is what I was afraid of... In order to populate the name and model, so that we can use it for matching, we call update_capabilities from the library, which fills this info, and it fails for one of your monitors.

The library also has update_from_ddc function, but that one only fills in mccs version and database, not any of the identifying information about the monitor which we could use to match against....

However it looks like ID field is always present. So in the branch I added it to the string that you can match in your config, and ignoring the error from update_capabilities function.

This could be problematic though, @cyrinux and I saw some ghost entries (the same monitor would be listed twice, and only one of them was actually usable, the one for which update_capabilities function succeeded), so I'm not sure yet if this would be a viable fix to merge in the current form, even if it solves your problem...

@Mynacol
Copy link
Author

Mynacol commented Feb 14, 2022

Thanks! This solves the detection problem for me.
I modified your change and the ID is not even needed! I guess ddcutil throws an error, so the ok() function stops the handling of this monitor. If you ignore the result value, the model name and serial number are available.

The relevant section is now:

    let displays = ddc_hi::Display::enumerate()
        .into_iter()
        .filter_map(|mut display| {
            let _ignored = display.update_capabilities();
            let empty = "".to_string();
            let merged = format!(
                "{} {}",
                display.info.model_name.as_ref().unwrap_or(&empty),
                display.info.serial_number.as_ref().unwrap_or(&empty)
            );
            Some((merged, display))
        })
        .collect_vec();

And the debug log is now:

[2022-02-14T12:48:21Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                18: "dark",
                9: "dim",
                0: "night",
                16: "normal",
                7: "dark",
                11: "normal",
                13: "bright",
                20: "night",
            },
        },
        output: [
            DdcUtil(
                DdcUtilOutput {
                    name: "1908FP",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
            DdcUtil(
                DdcUtilOutput {
                    name: "W2443",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
        ],
    }
[2022-02-14T12:48:23Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 ", "DELL 1908FP G314H86D7UFA"]
[2022-02-14T12:48:23Z DEBUG wluma::brightness::ddcutil] Using display 'DELL 1908FP G314H86D7UFA' for config '1908FP'
[2022-02-14T12:48:25Z DEBUG wluma::brightness::ddcutil] Discovered displays: ["W2443 ", "DELL 1908FP G314H86D7UFA"]
[2022-02-14T12:48:25Z DEBUG wluma::brightness::ddcutil] Using display 'W2443 ' for config 'W2443'
[2022-02-14T12:48:25Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.

Maybe you can write up some smart detection if update_capabilities fails, but the values are still available?
This might be a cleaner approach, which is better to merge and maintain.
I did not experience duplicate monitor entries.

Another idea: I believe ddcutil detect gets monitor info from EDID, so you could get manufacturer/model/serial nr. from there.

The next problem I experience: I2C errors. Wluma spam-reports [ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI I2C error: No such device or address (os error 6), the kernel log contains some kernel: i2c i2c-0: sendbytes: NAK bailout. i2c-0 is the other monitor, so not related with this issue.

@maximbaz
Copy link
Owner

Cool, thanks for confirming!

I think we'll have to keep IDs because this is what I'm getting when only one external monitor is connected, if we don't ignore update_capabilities errors (as in main branch):

Discovered displays: ["22794 DELL P2317H 9KFDW67326GB", "22793  ",  "22796 DELL P2317H 9KFDW67326GB"]

As you can see it's actually generating 3 entries, one of which has no info (and failed update_capabilities run), two others have exactly the same make and model, but different ID, and only for one of them the update_capabilities succeeded.

If wluma picks the wrong one in the list above, then it will not be able to control brightness...

However before thinking how to solve it, do I understand it correctly that wluma is still unable to get/set brightness for your screen? In other words, I2C errors are not just fake errors, but actually screen is not being managed by wluma? If that's the case, it sounds like the library we are using is simply unable to deal with weird monitors, for which update_capabilities fails...

@willbou1
Copy link

willbou1 commented Feb 24, 2022

diff --git a/src/brightness/ddcutil.rs b/src/brightness/ddcutil.rs
index 09a5108..eb8fd77 100644
--- a/src/brightness/ddcutil.rs
+++ b/src/brightness/ddcutil.rs
@@ -69,10 +69,12 @@ fn find_display_by_name(name: &str) -> Option {
.filter_map(|mut display| {
display.update_capabilities().ok().map(|_| {
let empty = "".to_string();
let empty_int = 0;
let merged = format!(
"{} {} {}",
display.info.model_name.as_ref().unwrap_or(&empty),
display.info.serial_number.as_ref().unwrap_or(&empty),
display.info.serial.as_ref().unwrap_or(&empty_int)
);
(merged, display)
})

I'm not a rust programmer, but this works for me :)

@maximbaz
Copy link
Owner

Could you explain some more, what was your issue and how does the patch help? I'm still at a loss whether it's possible for wluma to control brightness of these "weird" monitors or the patches are just to hide the errors...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants