tangled
alpha
login
or
join now
jcs.org
/
intel_backlight_fbsd
0
fork
atom
Control intel backlight on FreeBSD (and OpenBSD)
openbsd
0
fork
atom
overview
issues
pulls
pipelines
always exit 0, print values on one line
jcs.org
8 years ago
49e67dc4
8f91a5e6
+7
-11
1 changed file
expand all
collapse all
unified
split
intel_backlight.c
+7
-11
intel_backlight.c
···
83
83
max = reg_read(BLC_PWM_PCH_CTL2) >> 16;
84
84
85
85
min = 0.5 + 0.5 * max / 100.0; // 0.5%
86
86
-
/*
87
87
-
printf ("min: %d, NUM_ELEMENTS(brightness_levels): %d\n", min,
88
88
-
NUM_ELEMENTS(brightness_levels));
89
89
-
*/
90
86
result = 0.5 + current * 100.0 / max;
91
91
-
printf ("current backlight value: %d%% (%d/%d)\n", result, current, max);
87
87
+
88
88
+
printf ("%d", result);
92
89
93
90
if (argc > 1) {
94
91
uint32_t v;
···
98
95
v = 0.5 + brightness_decr(result) * max / 100.0;
99
96
else
100
97
v = 0.5 + atoi (argv[1]) * max / 100.0;
101
101
-
/*
102
102
-
printf("v: %d\n", v);
103
103
-
*/
98
98
+
104
99
if (v < min)
105
100
v = min;
106
101
else if (v > max)
···
118
113
(void) reg_read(BLC_PWM_CPU_CTL);
119
114
}
120
115
result = 0.5 + v * 100.0 / max;
121
121
-
printf ("set backlight to %d%% (%d/%d)\n", result, v, max);
116
116
+
printf (" -> %d", result);
122
117
}
123
118
124
124
-
return result;
119
119
+
printf("\n");
120
120
+
121
121
+
return (0);
125
122
}
126
126
-