OSDN Git Service

Fixed problem in plugins/linear.c, added Webpad support. See ChangeLog.
authorDouglas Lowder <douglowder@mac.com>
Fri, 12 Jul 2002 01:19:55 +0000 (18:19 -0700)
committerDouglas Lowder <douglowder@mac.com>
Fri, 12 Jul 2002 01:19:55 +0000 (18:19 -0700)
ChangeLog
plugins/linear.c
src/ts_read_raw.c

index e90d4f1..00fcce6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-07-11  Douglas Lowder <dlowder@earthlink.net>
+- Added code in src/ts_read_raw.c to handle reading events from the mk712
+  touchscreen driver on the Hitachi Webpad.
+
+- Fixed a bug in plugins/linear.c (incorrect default calibration in
+  absence of /etc/pointercal)
+
 2002-07-10  Douglas Lowder <dlowder@earthlink.net>
 
 - Added a patch by Holger Schurig <h.schurig@mn-logistik.de> to fix
index 510c4f3..b75c907 100644 (file)
@@ -6,7 +6,7 @@
  * This file is placed under the LGPL.  Please see the file
  * COPYING for more details.
  *
- * $Id: linear.c,v 1.4 2002/07/01 23:02:57 dlowder Exp $
+ * $Id: linear.c,v 1.5 2002/07/11 18:19:55 dlowder Exp $
  *
  * Linearly scale touchscreen values
  */
@@ -116,12 +116,12 @@ struct tslib_module_info *mod_init(struct tsdev *dev, const char *params)
        lin->module.ops = &linear_ops;
 
 // Use default values that leave ts numbers unchanged after transform
-       lin->a[0] = 0;
-       lin->a[1] = 1;
+       lin->a[0] = 1;
+       lin->a[1] = 0;
        lin->a[2] = 0;
        lin->a[3] = 0;
-       lin->a[4] = 0;
-       lin->a[5] = 1;
+       lin->a[4] = 1;
+       lin->a[5] = 0;
        lin->a[6] = 1;
        lin->p_offset = 0;
        lin->p_mult   = 1;
index 81f64ee..0ebe24d 100644 (file)
@@ -10,7 +10,7 @@
  * This file is placed under the LGPL.  Please see the file
  * COPYING for more details.
  *
- * $Id: ts_read_raw.c,v 1.5 2002/07/10 17:45:45 dlowder Exp $
+ * $Id: ts_read_raw.c,v 1.6 2002/07/11 18:19:55 dlowder Exp $
  *
  * Read raw pressure, x, y, and timestamp from a touchscreen device.
  */
 #ifdef USE_INPUT_API
 #include <linux/input.h>
 #else
-struct ts_event  {
+struct ts_event  {   /* Used in UCB1x00 style touchscreens (the default) */
        unsigned short pressure;
        unsigned short x;
        unsigned short y;
        unsigned short pad;
        struct timeval stamp;
 };
-struct h3600_ts_event {
+struct h3600_ts_event { /* Used in the Compaq IPAQ */
        unsigned short pressure;
        unsigned short x;
        unsigned short y;
        unsigned short pad;
 };
-
+struct mk712_ts_event { /* Used in the Hitachi Webpad */
+       unsigned int header;
+       unsigned int x;
+       unsigned int y;
+       unsigned int reserved;
+};
 #endif /* USE_INPUT_API */
 
 #include "tslib-private.h"
@@ -51,6 +56,7 @@ int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
 #else
        struct ts_event *evt;
        struct h3600_ts_event *hevt;
+       struct mk712_ts_event *mevt;
 #endif /* USE_INPUT_API */
        int ret;
        int total = 0;
@@ -171,6 +177,27 @@ int ts_read_raw(struct tsdev *ts, struct ts_sample *samp, int nr)
                                ret -= sizeof(*hevt);
                        }
                }
+       } else if( strcmp(tseventtype,"MK712") == 0) { /* Hitachi Webpad events */
+               mevt = alloca(sizeof(*mevt) * nr);
+               ret = read(ts->fd, mevt, sizeof(*mevt) * nr);
+               if(ret >= 0) {
+                       int nr = ret / sizeof(*mevt);
+                       while(ret >= sizeof(*mevt)) {
+                               samp->x = (short)mevt->x;
+                               samp->y = (short)mevt->y;
+                               if(mevt->header==0)
+                                       samp->pressure=1;
+                               else
+                                       samp->pressure=0;
+#ifdef DEBUG
+        printf("RAW---------------------------> %d %d %d\n",samp->x,samp->y,samp->pressure);
+#endif /*DEBUG*/
+                               gettimeofday(&samp->tv,NULL);
+                               samp++;
+                               mevt++;
+                               ret -= sizeof(*mevt);
+                       }
+               }
        } else { /* Use normal UCB1x00 type events */
                evt = alloca(sizeof(*evt) * nr);
                ret = read(ts->fd, evt, sizeof(*evt) * nr);