Skip to content

Config: don't use more light steps than exist#33

Open
LRitzdorf wants to merge 2 commits into
mikhail-m1:masterfrom
LRitzdorf:light-steps-limit
Open

Config: don't use more light steps than exist#33
LRitzdorf wants to merge 2 commits into
mikhail-m1:masterfrom
LRitzdorf:light-steps-limit

Conversation

@LRitzdorf

Copy link
Copy Markdown

Attempting to use more steps than actually exist (by setting a light_N value equal or greater than light_steps) writes too high a brightness to the sysfs backlight node, generating an "invalid argument" error.

Currently, this uses .filter() to map invalid light values to None, which will generate an InvalidPointsInConfig error later. This seems pretty consistent with existing behavior, erroring when invalid values are provided.

The other option is to just clamp any excessively high values to the largest allowed (light_steps - 1), and continuing without error. This was my first thought, but it feels misleading to the user to just silently allow this.

This PR also updates the example config file to obey the light-step limit.

Fixes #30

Violating this means attempting to use more steps than actually exist,
which writes too high a brightness and generates an "invalid argument"
error from the sysfs.

Fixes mikhail-m1#30
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.

cannot write to file, cannot set brightness

1 participant