first sample

This commit is contained in:
ioacademy-jikim
2015-08-19 19:26:23 +09:00
commit e92d98c6d0
62 changed files with 2573 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -fPIE
LOCAL_LDFLAGS := -fPIE -pie
LOCAL_MODULE := myapp
LOCAL_SRC_FILES := input_app.c
include $(BUILD_EXECUTABLE)
+23
View File
@@ -0,0 +1,23 @@
#if 1
#include <stdio.h>
#include <poll.h>
#include <fcntl.h>
#include <linux/input.h>
int main()
{
int i;
int fd, ret;
struct input_event events[64];
fd = open( "/dev/input/event4", O_RDONLY );
while (ret = read( fd, events, sizeof events ))
{
for( i=0 ; i<(ret/(int)sizeof(struct input_event)); i++ )
printf("type=%d, code=%d, value=%d\n",
events[i].type, events[i].code, events[i].value);
}
close(fd);
return 0;
}
#endif
+21
View File
@@ -0,0 +1,21 @@
#if 1
#include <stdio.h>
#include <poll.h>
#include <fcntl.h>
int main()
{
int i;
int fd, ret;
int temp[64];
fd = open( "/dev/mydev", O_RDONLY );
while (ret = read( fd, temp, sizeof temp ))
{
for( i=0 ; i<(ret/(int)sizeof(int)); i++ )
printf("temp[%d] = %d\n", i, temp[i] );
}
close(fd);
return 0;
}
#endif