Mini2440 - reading from Touch screen device

Rajam AP
Hello all, 

We are in the process of developing application in MINI2440 and we are
trying to get the touch screen inputs. 

when I checked for input devices: 

cd /dev/input/
[root@FriendlyARM input]# ls -al
drwxr-xr-x    2 root     root            0 Feb 21 09:50 .
drwxr-xr-x    7 root     root            0 Feb 21 10:09 ..
crw-rw----    1 root     root      13,  64 Feb 21 09:50 event0
crw-rw----    1 root     root      13,  63 Feb 21 09:50 mice
[root@FriendlyARM input]# 

I thought /dev/input/event0 might be the touch screen device and tried
opening the device. The device was opened successfully but when I tried
reading from the device I get errorno 22 INvalid argument. 

My piece of code for this is: 

    fileno = open("/dev/input/event1",O_RDONLY);

    if (fileno < 0) {

       printf("Touch screen driver: open device error!\n");

        printf("errno = %d, %s\n", errno, strerror(errno));

        return 0;

    }

    for(;;)

  {

  num_bytes = read(fileno, &ev, sizeof(struct s3c2410_ts_event));

  if( num_bytes != sizeof(struct s3c2410_ts_event) ) {

  printf("errno = %d, %s read bytes=%d\n", errno, strerror(errno),
num_bytes);
  return; 

  }

        else {

  printf("x= %d, y= %d, flag=0x%04x\n", ev.x, ev.y, ev.pressure);

  }



  }



    close(fileno);

Can anyone help me in getting through with reading from touch screen
device?

Thanks a lot for all the help and support, 

Regards

Rajam

Rajam AP
Hello experts, 

Please help me in reading from the touch screen device in our Linux
application. 

Thanks and regards

Rajam

open-nandra
There exist /dev/input/event0 but in code you call event1??? Anyway you
said it's opened correctly. 

Also for reading use:
ret = read(ts->fd, &ev, sizeof(struct input_event));

marek

Rajam AP
Thanks for the response.

Yes, there is a mistake in the code copied - file was opened with
/dev/input/event0 only.

I will try as per your suggestion to read into input event structure from
the device and update ...

Thanks and regards

Rajam

Rajam AP
Thanks for the help. 

Reading of input_event structure goes through and we are reading the
structure. we have to figure out on deciphering the data and applying it
for our application UI screens. 

Thanks a lot, 

Rajam
Qmax Systems