1 분 소요

움…touch drvier는 값을 읽어서 input device로 data를 보내는것으로 보인다.

대부분 QT를 써서 하는거라.. 이렇게 직접 읽는건 짜본 사람이 없는것같다 ㅜㅜ

결국 정리하면 /dev/input 에 있는  event0를 읽어서 처리하면 될듯하다..

기본적으로 읽는건 아래처럼 구현하면 된다.

이제 가공을 해볼까나~~

1 #include

2 #include

3 #include <sys/types.h>

4 #include

5 #include

6 #include <linux/input.h>

7 #define EVENT_BUF_NUM 64

8

9 void touch_wait(void)

10 {

11         int print_count = 0;

12         int read_byte = 0;

13         struct input_event event_buf[EVENT_BUF_NUM];  // 64

14         char *str_device = “/dev/input/event0”; // or event1

15

16         int evt_fd = open(str_device, O_RDONLY);

17

18         if(evt_fd <0)

19         {

20                 printf(“touch driver open fail\n”);

21         }

22

23         printf(“%s opened … \n”, str_device);

24

25         read_byte = read(evt_fd, event_buf, sizeof(struct input_event)*EVENT_BUF_NUM);

26

27         for(print_count ; print_count < EVENT_BUF_NUM ; print_count++)

28                 printf(“type %x  code %x  value %x \n”, event_buf[print_count].type,

event_buf[print_count].code,event_buf[print_count].value) ;

29

30         close(evt_fd);

31         printf(“%s closed….”,str_device);

32 }

33

34