Disabling touch screen.

NeilBrown neilb at suse.de
Tue Nov 11 23:37:15 CET 2008

On Wed, November 12, 2008 12:24 am, Christian Adams wrote:

> could someone drop a line when/if it will be available in a downloads/
> daily/uImage.bin?
> (and which ioctls we should invoke on which device to enable and
> which to disable touchscreen and how to get the status)

To answer the second part of the question:

  #include <linux/input.h>

  int fd = open("/dev/input/touchscreen0", O_RDONLY);

  if (ioctl(fd, EVIOCGRAB, 1) != 0) {
     printf("Sorry, I couldn't grab the device, maybe someone else did\n");
  printf("Grab was successful\n");
  ioctl(fd,EVIOCGRAB, 0);
  printf("Device has been released, but is still open\n");
  close(fd); /* would release the grab if it was still held */

Hopefully that gives you enough detail.
You can do with on e.g. /dev/input/mouse0 on your desktop and see how it
works.  You can do it to your keyboard too if you can find the right
device (looking in /dev/input/by-path might help).  Be certain that
the program will release the grab without you having to type control-C,
because control-C won't work.

There is a program called 'evtest.c' of which google seems to be able
to find multiple versions, some of which use EVIOCGRAB.  I find
it very useful for exploring /dev/input/event* devices.


More information about the openmoko-kernel mailing list