blob: e5306741316c2474cd556fe077aab5cadcdbe798 (
plain) (
blame)
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
|
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <sys/ioctl.h>
int main(int argc, char *argv[]) {
int err, fd, mode;
if (argc != 2) {
fprintf(stderr, "usage: %s <graphics|text>\n", argv[0]);
return 1;
}
if (strcmp(argv[1], "graphics") == 0) {
mode = KD_GRAPHICS;
}
else if (strcmp(argv[1], "text") == 0) {
mode = KD_TEXT;
}
else {
fprintf(stderr, "usage: %s <graphics|text>\n", argv[0]);
return 1;
}
fd = open("/dev/tty0", O_WRONLY);
if (fd < 0) {
perror(argv[0]);
return 1;
}
err = ioctl(fd, KDSETMODE, mode);
if (err < 0) {
perror(argv[0]);
return 1;
}
return 0;
}
|