1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <cairo.h>
#include "fbtools.h"
#include "logind.h"
/* ------------------------------------------------------------------ */
static void usage(FILE *fp)
{
fprintf(fp,
"\n"
"usage: fbtest [ options ]\n"
"\n"
"options:\n"
" -h print this\n"
" -f <nr> pick framebuffer\n"
"\n");
}
int main(int argc, char **argv)
{
int framebuffer = 0;
int c;
for (;;) {
c = getopt(argc, argv, "hf:");
if (c == -1)
break;
switch (c) {
case 'f':
framebuffer = atoi(optarg);
break;
case 'h':
usage(stdout);
exit(0);
default:
usage(stderr);
exit(1);
}
}
logind_init();
fb_query(framebuffer);
logind_fini();
fprintf(stderr, "fb%d: %s, %dx%d, %d bpp, r/g/b/a %d/%d/%d/%d\n",
framebuffer,
fb_fix.id,
fb_var.xres, fb_var.yres,
fb_var.bits_per_pixel,
fb_var.red.length,
fb_var.green.length,
fb_var.blue.length,
fb_var.transp.length);
return 0;
}
|