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
cleanup whitespace
jcs.org
9 years ago
4795f543
a17fe19a
+6
-6
1 changed file
expand all
collapse all
unified
split
intel_backlight.c
+6
-6
intel_backlight.c
···
44
44
{
45
45
*(volatile uint32_t *)((volatile char*)mmio + reg) = val;
46
46
}
47
47
-
47
47
+
48
48
static int brightness_levels[] = {1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 43,
49
49
-
51, 60, 70, 80, 90, 100};
49
49
+
51, 60, 70, 80, 90, 100};
50
50
51
51
static int brightness_incr(int curr)
52
52
{
···
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,
87
87
+
printf ("min: %d, NUM_ELEMENTS(brightness_levels): %d\n", min,
88
88
NUM_ELEMENTS(brightness_levels));
89
89
*/
90
90
result = 0.5 + current * 100.0 / max;
91
91
printf ("current backlight value: %d%% (%d/%d)\n", result, current, max);
92
92
-
92
92
+
93
93
if (argc > 1) {
94
94
uint32_t v;
95
95
-
if (0 == strcmp(argv[1], "incr"))
95
95
+
if (0 == strcmp(argv[1], "incr"))
96
96
v = 0.5 + brightness_incr(result) * max / 100.0;
97
97
else if (0 == strcmp(argv[1], "decr"))
98
98
v = 0.5 + brightness_decr(result) * max / 100.0;
99
99
-
else
99
99
+
else
100
100
v = 0.5 + atoi (argv[1]) * max / 100.0;
101
101
/*
102
102
printf("v: %d\n", v);