Initial input-clone

This commit is contained in:
Merlijn Wajer 2013-01-16 02:28:36 +01:00
parent 71557bd433
commit 4918d8669e
3 changed files with 42 additions and 0 deletions

13
read-device/Makefile Normal file
View File

@ -0,0 +1,13 @@
.PHONY: default clean
CFLAGS+=-ansi -pedantic -Wall -Wextra -Werror -Wno-unused-result
CFLAGS+=-pipe -O2
CFLAGS+=-D_BSD_SOURCE
default: read
map: read.c
$(CC) read.c $(CFLAGS) -o read
clean:
rm -f read

3
read-device/README Normal file
View File

@ -0,0 +1,3 @@
Use: evtest /dev/input/by-id/usb-Logitech_USB-PS_2_Optical_Mouse-event-mouse
Check: http://cgit.freedesktop.org/evtest/tree/evtest.c#n739

26
read-device/read.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
#include <unistd.h>
#include <fcntl.h>
#define INPUT_PATH "/dev/input/by-id/usb-Logitech_USB-PS_2_Optical_Mouse-event-mouse"
int main (int argc, char** argv) {
int f;
(void)argc;
(void)argv;
f = open(INPUT_PATH, O_RDONLY);
if (f < 0) {
perror("open");
return 1;
}
return 0;
}