Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion brightnessctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ float val_to_percent(float val, struct device *d, bool rnd) {
}

unsigned long percent_to_val(float percent, struct device *d) {
return roundf(powf(percent / 100, p.exponent) * d->max_brightness);
return roundf(powf(fmaxf(percent, 0) / 100, p.exponent) * d->max_brightness);
}

void print_device(struct device *dev) {
Expand Down