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

add monitor detection fallback to skip cap check #102

Merged
merged 3 commits into from
Mar 30, 2024
Merged

Conversation

braye
Copy link
Contributor

@braye braye commented Mar 30, 2024

Resolves #101

I'm a total Rust newb - if there's a better way to do this let me know. I basically copied everything from find_display_by_name and skipped the capabilities check. Not the prettiest but it's only twice.

Personally, I'm a fan of "twice is not duplication" ;)

@maximbaz
Copy link
Owner

Hahaha thanks 😁 Most importantly, do you confirm that this trick solves the issue with your monitors? Just to be sure 😄

@maximbaz
Copy link
Owner

While I totally agree with "twice is not duplication", rust is very pleasant language to build abstractions on 😁 What do you think about the idea I just pushed? And does it actually work? 😅

@braye
Copy link
Contributor Author

braye commented Mar 30, 2024

Oh, your approach is much better! That's pretty much what I was thinking would be the best solution but I didn't quite know how to implement it.

I can confirm that 34baa1b finds both monitors fine:

[2024-03-30T21:14:32Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                13: "bright",
                9: "dim",
                16: "normal",
                7: "dark",
                11: "normal",
                18: "dark",
                0: "night",
                20: "night",
            },
        },
        output: [
            DdcUtil(
                DdcUtilOutput {
                    name: "DELL U2415 CFV9N85Q0HWS",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
            DdcUtil(
                DdcUtilOutput {
                    name: "LG ULTRAGEAR 103NTPC9A464",
                    capturer: None,
                    min_brightness: 1,
                },
            ),
        ],
    }
[2024-03-30T21:14:37Z DEBUG wluma::brightness::ddcutil] Discovered displays (check_caps=true): ["DELL U2415 CFV9N85Q0HWS"]
[2024-03-30T21:14:37Z DEBUG wluma::brightness::ddcutil] Using display 'DELL U2415 CFV9N85Q0HWS' for config 'DELL U2415 CFV9N85Q0HWS' (check_caps=true)
[2024-03-30T21:14:38Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: invalid DDC/CI length
[2024-03-30T21:14:38Z DEBUG wluma::brightness::ddcutil] Discovered displays (check_caps=true): []
[2024-03-30T21:14:38Z DEBUG wluma::brightness::ddcutil] Discovered displays (check_caps=false): ["LG ULTRAGEAR 103NTPC9A464", "DELL U2415 CFV9N85Q0HWS"]
[2024-03-30T21:14:38Z DEBUG wluma::brightness::ddcutil] Using display 'LG ULTRAGEAR 103NTPC9A464' for config 'LG ULTRAGEAR 103NTPC9A464' (check_caps=false)
[2024-03-30T21:14:38Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.
[2024-03-30T21:14:56Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: invalid DDC/CI length
[2024-03-30T21:14:57Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI I2C error: Remote I/O error (os error 121)
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI I2C error: Remote I/O error (os error 121)
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI I2C error: Remote I/O error (os error 121)
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: invalid DDC/CI length
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: Expected DDC/CI length bit
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: invalid DDC/CI length
[2024-03-30T21:14:58Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: Expected DDC/CI length bit
[2024-03-30T21:14:58Z DEBUG wluma::predictor::controller] [LG ULTRAGEAR 103NTPC9A464] Learning Entry { lux: "bright", luma: 0, brightness: 50 }
[2024-03-30T21:15:02Z ERROR wluma::brightness::controller] Unable to get brightness value: DDC/CI error: Expected DDC/CI length bit
[2024-03-30T21:15:05Z DEBUG wluma::predictor::controller] [DELL U2415 CFV9N85Q0HWS] Learning Entry { lux: "bright", luma: 0, brightness: 60 }

Ignoring all the DDC/CI errors of course, it can read brightness changes from both monitors.

@maximbaz
Copy link
Owner

That's awesome! Glad that we are on the same page, and that it works as expected, merging then, and thanks for all your help! 🙏

@maximbaz maximbaz merged commit bb6b8d0 into maximbaz:main Mar 30, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

[Bug]: Can't find display, but shows up in ddcutil detect
2 participants