summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorrmcc <geeksphone@cerqueira.org>2010-07-05 22:55:34 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2010-10-29 18:19:44 +0100
commita9c0f0d6861776570de8a16c492faf62f615ad15 (patch)
treee9d007ac49d4346e375111320456653f3313901c /libs
parent9b6318d39e1fb316498242b2f2a79e7c7a2d6d76 (diff)
downloadframeworks_base-a9c0f0d6861776570de8a16c492faf62f615ad15.zip
frameworks_base-a9c0f0d6861776570de8a16c492faf62f615ad15.tar.gz
frameworks_base-a9c0f0d6861776570de8a16c492faf62f615ad15.tar.bz2
Inotify support for TSLib
Change-Id: I26a289f00d98b5f010e1a6a9db2c111b349a29b6
Diffstat (limited to 'libs')
-rw-r--r--libs/ui/EventHub.cpp47
1 files changed, 40 insertions, 7 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index dc9ee22..bc4230c 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -76,6 +76,11 @@ namespace android {
static const char *WAKE_LOCK_ID = "KeyEvents";
static const char *device_path = "/dev/input";
+#ifdef HAVE_TSLIB
+static const char *ts_path = "/data/misc/tscal";
+static const char *pointercal_path = "/data/misc/tscal/pointercal";
+#endif
+
/* return the larger integer */
static inline int max(int v1, int v2)
{
@@ -387,8 +392,8 @@ bool EventHub::getEvent(int32_t* outDeviceId, int32_t* outType,
#ifdef HAVE_TSLIB
}
else{
- LOGI("mTS->fd = %d", mTS->fd);
- LOGI("tslib: calling ts_read from eventhub\n");
+ LOGV("mTS->fd = %d", mTS->fd);
+ LOGV("tslib: calling ts_read from eventhub\n");
res = ts_read(mTS, &samp, 1);
if (res < 0) {
@@ -514,6 +519,15 @@ bool EventHub::openPlatformInput(void)
if(res < 0) {
LOGE("could not add watch for %s, %s\n", device_path, strerror(errno));
}
+#ifdef HAVE_TSLIB
+ res = inotify_add_watch(mFDs[0].fd, pointercal_path, IN_MODIFY);
+ if (res < 0) {
+ res = inotify_add_watch(mFDs[0].fd, ts_path, IN_MODIFY);
+ if (res < 0) {
+ LOGE("could not add watch for %s, %s\n", ts_path, strerror(errno));
+ }
+ }
+#endif
#else
/*
* The code in EventHub::getEvent assumes that mFDs[0] is an inotify fd.
@@ -954,12 +968,31 @@ int EventHub::read_notify(int nfd)
//printf("%d: %08x \"%s\"\n", event->wd, event->mask, event->len ? event->name : "");
if(event->len) {
strcpy(filename, event->name);
- if(event->mask & IN_CREATE) {
- open_device(devname);
- }
- else {
- close_device(devname);
+#ifdef HAVE_TSLIB
+ if (!strcmp(filename, "pointercal")) {
+ if (mTS->fd)
+ ts_reload(mTS);
+ inotify_rm_watch(mFDs[0].fd, res);
+ res = inotify_add_watch(mFDs[0].fd, pointercal_path, IN_MODIFY);
+ if(res < 0) {
+ LOGE("could not add watch for %s, %s\n", pointercal_path, strerror(errno));
+ }
+ } else {
+#else
+ {
+#endif
+ if(event->mask & IN_CREATE) {
+ open_device(devname);
+ }
+ else {
+ close_device(devname);
+ }
}
+#ifdef HAVE_TSLIB
+ } else {
+ if (mTS->fd)
+ ts_reload(mTS);
+#endif
}
event_size = sizeof(*event) + event->len;
res -= event_size;