mirror of https://gitee.com/openkylin/gpm.git
source code of gpm_has_mouse_control helper
Gbp-Pq: Name 014_has_mouse_control.patch
This commit is contained in:
parent
2a2bc494d2
commit
040a5770ce
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue