mirror of
https://github.com/FunKey-Project/FunKey-GPIO-Mapping.git
synced 2025-12-13 02:08:53 +01:00
Added termfix
This commit is contained in:
parent
82276e6ebe
commit
0ac193e41e
6
Makefile
6
Makefile
@ -2,11 +2,13 @@ TOOLS_CFLAGS := -Wall -std=c99 -D _DEFAULT_SOURCE
|
|||||||
#
|
#
|
||||||
# Programs
|
# Programs
|
||||||
#
|
#
|
||||||
all: funkey_gpio_management
|
all: funkey_gpio_management termfix
|
||||||
|
|
||||||
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
|
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
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
termfix: termfix.o
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
#
|
#
|
||||||
# Objects
|
# Objects
|
||||||
|
|||||||
36
termfix.c
Normal file
36
termfix.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <linux/vt.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <linux/kd.h>
|
||||||
|
#include <linux/keyboard.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("usage: termfix /dev/ttyX\n");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fd = open(argv[1], O_RDWR, 0);
|
||||||
|
int res = ioctl(fd, VT_UNLOCKSWITCH, 1);
|
||||||
|
|
||||||
|
if (res != 0) {
|
||||||
|
perror("ioctl VT_UNLOCKSWITCH failed");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
ioctl(fd, KDSETMODE, KD_TEXT);
|
||||||
|
|
||||||
|
if (res != 0) {
|
||||||
|
perror("ioctl KDSETMODE failed");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Success\n");
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user