source code of gpm_has_mouse_control helper

Gbp-Pq: Name 014_has_mouse_control.patch
This commit is contained in:
Axel Beckert 2022-05-13 23:47:09 +08:00 committed by openKylinBot
parent 2a2bc494d2
commit 040a5770ce
2 changed files with 27 additions and 0 deletions

7
contrib/control/Makefile Normal file
View File

@ -0,0 +1,7 @@
CC := gcc
all: gpm_has_mouse_control.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o gpm_has_mouse_control -Wall gpm_has_mouse_control.c
clean:
-rm -f gpm_has_mouse_control

View File

@ -0,0 +1,20 @@
#include <sys/fcntl.h>
#include <sys/kd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
int main (int argc, char **argv)
{
int fd;
int mode;
fd = open ("/dev/tty0", O_RDONLY);
if (fd == -1)
fd = open ("/dev/vc/0", O_RDONLY);
if (fd == -1)
perror ("open");
if (ioctl (fd, KDGETMODE, &mode) != 0)
perror ("ioctl");
exit(mode);
}