Index: /trunk/oe/packages/tslib/tslib-1.0/tslib-input_raw-grab_events.patch
===================================================================
--- /trunk/oe/packages/tslib/tslib-1.0/tslib-input_raw-grab_events.patch	(revision 941)
+++ /trunk/oe/packages/tslib/tslib-1.0/tslib-input_raw-grab_events.patch	(revision 942)
@@ -20,5 +20,15 @@
  #include <stdlib.h>
  #ifdef HAVE_UNISTD_H
-@@ -42,6 +43,7 @@
+@@ -33,6 +34,9 @@
+ 
+ #include "tslib-private.h"
+ 
++#define GRAB_EVENTS_WANTED	1
++#define GRAB_EVENTS_ACTIVE	2
++
+ struct tslib_input {
+ 	struct tslib_module_info module;
+ 
+@@ -42,6 +46,7 @@
  
  	int	sane_fd;
@@ -28,19 +38,36 @@
  
  static int check_fd(struct tslib_input *i)
-@@ -64,6 +66,13 @@
+@@ -64,6 +69,14 @@
  
  	if (bit & (1 << EV_SYN))
  		i->using_syn = 1;
 +	
-+	if (i->grab_events) {
++	if (i->grab_events == GRAB_EVENTS_WANTED) {
 +		if (ioctl(ts->fd, EVIOCGRAB, (void *)1)) {
 +			fprintf(stderr, "Unable to grab selected input device\n");
 +			return -1;
 +		}
++		i->grab_events = GRAB_EVENTS_ACTIVE;
 +	}
  
  	return 0;
  }
-@@ -231,6 +240,35 @@
+@@ -222,6 +235,15 @@
+ 
+ static int ts_input_fini(struct tslib_module_info *inf)
+ {
++	struct tslib_input *i = (struct tslib_input *)inf;
++	struct tsdev *ts = inf->dev;
++
++	if (i->grab_events == GRAB_EVENTS_ACTIVE) {
++		if (ioctl(ts->fd, EVIOCGRAB, (void *)0)) {
++			fprintf(stderr, "Unable to un-grab selected input device\n");
++		}
++	}
++
+ 	free(inf);
+ 	return 0;
+ }
+@@ -231,6 +253,36 @@
  	.fini	= ts_input_fini,
  };
@@ -60,5 +87,6 @@
 +	switch ((int)data) {
 +	case 1:
-+		i->grab_events = v;
++		if (v)
++			i->grab_events = GRAB_EVENTS_WANTED;
 +		break;
 +	default:
@@ -78,5 +106,5 @@
  {
  	struct tslib_input *i;
-@@ -245,5 +283,12 @@
+@@ -245,5 +297,12 @@
  	i->current_p = 0;
  	i->sane_fd = 0;
