This repository was archived by the owner on Apr 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed
Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,13 @@ TOOLS_CFLAGS := -Wall -std=c99 -D _DEFAULT_SOURCE
22#
33# Programs
44#
5- all : funkey_gpio_management
5+ all : funkey_gpio_management termfix
66
7- funkey_gpio_management : funkey_gpio_management.o gpio-utils.o uinput.o gpio_mapping.o read_conf_file.o keydefs.o driver_pcal6416a.o driver_axp209.o smbus.o
7+ funkey_gpio_management : funkey_gpio_management.o gpio-utils.o uinput.o gpio_mapping.o read_conf_file.o keydefs.o driver_pcal6416a.o driver_axp209.o smbus.o
88 $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $^
99
10+ termfix : termfix.o
11+ $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $^
1012
1113#
1214# Objects
Original file line number Diff line number Diff line change 1+ #include <sys/ioctl.h>
2+ #include <errno.h>
3+ #include <string.h>
4+ #include <stdio.h>
5+ #include <linux/vt.h>
6+ #include <sys/types.h>
7+ #include <sys/stat.h>
8+ #include <fcntl.h>
9+ #include <linux/kd.h>
10+ #include <linux/keyboard.h>
11+
12+ int main (int argc , char * * argv ) {
13+ if (argc != 2 ) {
14+ printf ("usage: termfix /dev/ttyX\n" );
15+ return 2 ;
16+ }
17+
18+ int fd = open (argv [1 ], O_RDWR , 0 );
19+ int res = ioctl (fd , VT_UNLOCKSWITCH , 1 );
20+
21+ if (res != 0 ) {
22+ perror ("ioctl VT_UNLOCKSWITCH failed" );
23+ return 3 ;
24+ }
25+
26+ ioctl (fd , KDSETMODE , KD_TEXT );
27+
28+ if (res != 0 ) {
29+ perror ("ioctl KDSETMODE failed" );
30+ return 3 ;
31+ }
32+
33+ printf ("Success\n" );
34+
35+ return res ;
36+ }
You can’t perform that action at this time.
0 commit comments