Skip to content

Limit to max_brightness, some clean up, add some TODOs#1

Open
ematsumiya wants to merge 1 commit intoDzejrou:masterfrom
ematsumiya:master
Open

Limit to max_brightness, some clean up, add some TODOs#1
ematsumiya wants to merge 1 commit intoDzejrou:masterfrom
ematsumiya:master

Conversation

@ematsumiya
Copy link

  • Although I don't know the behaviour if value goes above max_brightness, doesn't
    hurt to check.

  • Changed some variable names for better understanding :P

  • Add some TODOs to README and code

--

Update after commit:

If input value is greater than max_brightness, writing to the brightness file will fail with "invalid argument".

- Although I don't know the behaviour if value goes above max_brightness, doesn't
hurt to check.

- Changed some variable names for better understanding :P

- Add some TODOs to README and code
@ematsumiya
Copy link
Author

  • (RFC) Maybe change granularity of increment/decrement (e.g. "./twbl +1" makes no difference at all, up until 1000)

This was supposed to be in a next PR hehe

I was working on a way to use "twbl inc/dec" arguments rather than relying on user to know what value to use, but gave up mid way because the way it is currently is more flexible.

Copy link
Owner

@Dzejrou Dzejrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How dare you rename my variables >:(

Fix the whitespace and newline issues, then LGTM.

* TODO: save these strings in a file maybe?
*/
std::string fname{"/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness"};
std::string max_fname{"/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/max_brightness"};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespace in this PR does not match the original, tabs vs spaces.


if ((current_value + val) > max_value)
{
std::cerr << "Invalid input value: " << val << " is greater than max value " << max_value;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at the end of the error message.

@Dzejrou Dzejrou self-assigned this May 27, 2019
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.

2 participants