Fix profile detection when lid state differs from save time#423
Open
elstonj wants to merge 1 commit into
Open
Conversation
Two issues in find_profiles prevented correct profile detection when a laptop's lid state at detection time differed from when the profile was saved: 1. The completeness check required ALL connected outputs with fingerprints to be present in the profile config. Profiles saved with the lid closed would not include the eDP/LVDS output's EDID in the setup file, so when the lid was later opened, the profile would not be detected despite the external monitors matching. Fix: exempt eDP and LVDS outputs from the completeness check, since these may not have been present when the profile was saved due to a closed lid. 2. The closeness calculation used stale loop variables (output, name) from the preceding for loop iteration rather than computing across all profile outputs. This could produce incorrect rankings or crash on profiles with edid=None outputs. Fix: iterate all config items and use min closeness across outputs with valid EDIDs. Also fix is_closed_lid regex where \+ (literal plus) should be + (one-or-more quantifier) for matching output names like eDP-1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eDP/LVDS lid exemption in
find_profiles: Profiles saved with the laptop lid closed don't include the eDP/LVDS output's EDID in the setup file. When the lid is later opened,find_profilesrejects the profile because the eDP output has a fingerprint but isn't in the profile config. Fix: exempt eDP/LVDS outputs from the completeness check, since they may not have been present at save time due to a closed lid.Closeness calculation bug: The closeness score used stale loop variables (
output,name) left over from the precedingforloop iteration, rather than computing across all profile outputs. This could produce incorrect rankings or crash on profiles withedid=Noneoutputs. Fix: iterate all config items and usemincloseness across outputs with valid EDIDs.is_closed_lidregex:\+(literal plus) should be+(one-or-more quantifier) for matching output names likeeDP-1. Worked by accident because the*quantifier allowed zero matches of the group, but was incorrect.Test plan
autorandr— the docked profile should be detecteddefault) are NOT detected when external monitors are connected