Avoiding keypresses during a phone call

Andy Green andy at openmoko.com
Sun Nov 16 20:04:04 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:

|> I have removed the mokopatch as requested the other day on
|> stable-tracking now, it should allow an IOCTL to enable and disable
|> touchscreen traffic as mentioned by Neil Brown:
|>
|> ''All we have to do is undo the kernel hack which effectively disables
|> EVIOCGRAB and then it is trivial to turn off the touchscreen.
|> Just open the device and issue that ioctl.''
|
| I have a question and comment.
|
| I don't yet have a grasp of IOCTL.  What would be the fcntl() or ioctl()
| command in python to disable the touchscreeen?
|
| Seems like a useful method to add to frameworkd.

I found this after googling around for a bit

~     case DEVICE_ON:
+        if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1))
+            xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
+                    strerror(errno));
~         xf86AddEnabledDevice(pInfo);
~        device->public.on = TRUE;
~        break;

~     case DEVICE_OFF:
+        if (ioctl(pInfo->fd, EVIOCGRAB, (void *)0))


ioctl() itself is easily understood, given an open file descriptor it
gives you a side-channel into the driver that services that file
descriptor and allows you to set and query things from the context of
the file descriptor, without performing any actual file operations.

You can find definition of EVIOCGRAB in /usr/include/linux/input.h for
use in usermode apps.

I don't know python but that should be enough info for a quick meddle
around, you would first open() the file descriptor normally on
/dev/input/event1 or whatever.

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkkgbqQACgkQOjLpvpq7dMogZQCgh623vdFwhkoDWT7+SiS4EYIW
rcgAoIYo8hVFM1DiFpcyDHUMUERAKFpL
=WRa1
-----END PGP SIGNATURE-----



More information about the devel mailing list