2009年6月1日 星期一

PATCH microwindows-0.91 to support tslib-1.4

diff -Naur VT300/microwindows-0.91/src/config S3C2440/microwindows-0.91/src/config
--- VT300/microwindows-0.91/src/config    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/config    2009-06-01 13:11:51.000000000 +0800
@@ -37,7 +37,7 @@
 # note: ELKS can't build client/server nano-X, nor widget lib
 #
 ####################################################################
-ARCH                     = LINUX-MIPS
+ARCH                     = LINUX-ARM
 BIGENDIAN                = N
 NATIVETOOLSPREFIX        =
 ARMTOOLSPREFIX           = arm-linux-
@@ -137,7 +137,7 @@
 ####################################################################
 HAVE_JPEG_SUPPORT        = Y
 INCJPEG                  = .
-LIBJPEG                  = /usr/local/MIPSEL_UCLIBC/lib/libjpeg.a
+LIBJPEG                  = /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libjpeg.so
 
 ####################################################################
 # PNG support via libpng and libz
@@ -145,7 +145,7 @@
 HAVE_PNG_SUPPORT         = Y
 INCPNG                   = .
 #LIBPNG                   = /usr/lib/libpng.a
-LIBPNG                   = /usr/local/MIPSEL_UCLIBC/lib/libpng.so
+LIBPNG                   = /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/libpng.so
 LIBZ                     = -lz
 
 ####################################################################
@@ -192,7 +192,7 @@
 ####################################################################
 HAVE_PCF_SUPPORT         = Y
 HAVE_PCFGZ_SUPPORT       = N
-PCF_FONT_DIR             = "/phone/lib/X11/fonts/misc"
+PCF_FONT_DIR             = "/lib/X11/fonts/misc"
 
 ####################################################################
 # Chinese Han Zi Ku loadable font support
@@ -316,7 +316,7 @@
 GPMMOUSE                 = N
 SERMOUSE                 = N
 SUNMOUSE                 = N
-NOMOUSE                  = Y
+NOMOUSE                  = N
 IPAQMOUSE                = N
 ZAURUSMOUSE              = N
 TUXMOUSE                 = N
@@ -329,15 +329,19 @@
 YOPYMOUSE                = N
 HARRIERMOUSE             = N
 LIRCMOUSE                = N
+TSLIBMOUSE               = Y
+
+INCTSLIB                 = /home/gigijoe/S3C2440/tslib/src
+LIBTS             = /home/gigijoe/S3C2440/tslib/src/.libs/libts.so
 
 # keyboard or null kbd driver
 TTYKBD                   = N
 SCANKBD                  = N
-AC494KBD         = Y
+AC494KBD         = N
 PIPEKBD                  = N
 IPAQKBD                  = N
 LIRCKBD                  = N
-NOKBD                    = N
+NOKBD                    = Y
 
 endif
 
diff -Naur VT300/microwindows-0.91/src/drivers/mou_touchscreen.c S3C2440/microwindows-0.91/src/drivers/mou_touchscreen.c
--- VT300/microwindows-0.91/src/drivers/mou_touchscreen.c    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/mou_touchscreen.c    2009-06-01 14:52:17.000000000 +0800
@@ -46,15 +46,22 @@
 #include "touchscreen_ucb1x00.h"
 #endif
 
+#ifdef TOUCHSCREEN_TSLIB
+#include "touchscreen_tslib.h"
+#endif
+
+extern SCREENDEVICE scrdev;
+
+#ifndef TOUCHSCREEN_TSLIB
+
 #ifndef TS_DEVICE
 #error "You didn't define a device for the generic touchscreen driver!"
 #endif
 
 static int pd_fd = -1;
-extern SCREENDEVICE scrdev;
 
 static int PD_Open(MOUSEDEVICE *pmd)
-{           
+{
     if((pd_fd = open(TS_DEVICE_FILE, O_NONBLOCK)) < 0) {
         EPRINTF("Error %d opening %s touchscreen device [%s]\n",
             errno, TS_DEVICE, TS_DEVICE_FILE);
@@ -123,6 +130,84 @@
     return 2;
 }
 
+#else
+
+static struct tsdev *ts = 0;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+    char *tsdevice=NULL;
+
+      if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
+          ts = ts_open(tsdevice,0);
+      } else {
+          if (!(ts = ts_open("/dev/input/event0", 0)))
+                ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+        }
+
+      if (!ts) {
+          perror("ts_open");
+            return -1;
+        }
+
+      if (ts_config(ts)) {
+            perror("ts_config");
+        ts_close(ts);
+        ts = 0;
+            return -1;
+        }
+
+    GdHideCursor(&scrdev);  
+
+    return ts_fd(ts);
+}
+
+static void PD_Close(void)
+{
+    if(ts)
+        ts_close(ts);
+    ts = 0;
+}
+
+static int PD_GetButtonInfo(void)
+{
+    /* get "mouse" buttons supported */
+    return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+    *pscale = 3;
+    *pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb, int mode)
+{
+    struct ts_sample samp;
+    int ret;
+
+    ret = ts_read(ts, &samp, 1);
+
+      if (ret < 0) {
+          perror("ts_read");
+            return 0;
+        }
+
+    if(ret != 1)    /*EAGAIN*/
+        return 0;
+printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure);
+    *px = samp.x;
+    *py = samp.y;
+    *pb = (samp.pressure) ? MWBUTTON_L : 0;
+    *pz = samp.pressure;
+
+    if(!*pb)
+        return 3;
+    return 2;
+}
+
+#endif
+
 MOUSEDEVICE mousedev = {
     PD_Open,
     PD_Close,
diff -Naur VT300/microwindows-0.91/src/drivers/Objects.rules S3C2440/microwindows-0.91/src/drivers/Objects.rules
--- VT300/microwindows-0.91/src/drivers/Objects.rules    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/Objects.rules    2009-05-27 22:36:54.000000000 +0800
@@ -221,6 +221,12 @@
 MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_null.o
 endif
 
+### Touchscreen handle by tslib
+ifeq ($(TSLIBMOUSE), Y)
+CFLAGS += -DTOUCHSCREEN_TSLIB=1
+MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_touchscreen.o
+endif
+
 #
 # Keyboard driver specific for every system
 #
diff -Naur VT300/microwindows-0.91/src/drivers/touchscreen_tslib.h S3C2440/microwindows-0.91/src/drivers/touchscreen_tslib.h
--- VT300/microwindows-0.91/src/drivers/touchscreen_tslib.h    1970-01-01 08:00:00.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/touchscreen_tslib.h    2009-05-27 22:38:02.000000000 +0800
@@ -0,0 +1 @@
+#include "tslib.h"
diff -Naur VT300/microwindows-0.91/src/Makefile.rules S3C2440/microwindows-0.91/src/Makefile.rules
--- VT300/microwindows-0.91/src/Makefile.rules    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/Makefile.rules    2009-05-27 23:24:19.000000000 +0800
@@ -278,6 +278,14 @@
 DEFINES += -DMW_LIRC_MOUSE=1
 endif
 
+ifeq ($(TSLIBMOUSE), Y)
+ifneq ($(INCTSLIB),)
+INCLUDEDIRS += -I$(INCTSLIB)
+endif
+LDFLAGS += -lts
+MW_CORE_LIBS += $(LIBTS)
+endif
+
 ifeq ($(LIRCKBD2), Y)
 DEFINES += -DMW_FEATURE_TWO_KEYBOARDS=1
 endif
@@ -332,7 +340,7 @@
 ifneq ($(ARCH), TRIMEDIA)
 
 ifeq ($(SHAREDLIBS), Y)
-CFLAGS += -fpic
+CFLAGS += -fomit-frame-pointer -march=armv4
 endif
 
 ifeq ($(OPTIMIZE), Y)
@@ -356,7 +364,7 @@
 MAKEDEPCFLAGS :=
 HOSTCFLAGS :=
 CPPFLAGS += $(DEFINES)
-LDFLAGS += -L$(MW_DIR_LIB)
+LDFLAGS += -L$(MW_DIR_LIB) -lgcc_s
 ifeq ($(ARCH), TRIMEDIA)
 ARFLAGS = r
 else
diff -Naur VT300/microwindows-0.91/src/nanox/clientfb.c S3C2440/microwindows-0.91/src/nanox/clientfb.c
--- VT300/microwindows-0.91/src/nanox/clientfb.c    2009-01-23 21:29:30.000000000 +0800
+++ S3C2440/microwindows-0.91/src/nanox/clientfb.c    2009-05-20 17:10:45.000000000 +0800
@@ -10,7 +10,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#if 0
 #include <asm/page.h>        /* For definition of PAGE_SIZE */
+#endif
 #include <linux/fb.h>
 #endif
 #include "nano-X.h"
@@ -18,7 +20,7 @@
 
 #define CG6_RAM        0x70016000    /* for Sun systems*/
 
-#ifdef LINUX-MIPS
+#ifdef LINUX-ARM
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT      12
 #define PAGE_SIZE       (1UL << PAGE_SHIFT)
diff -Naur VT300/microwindows-0.91/src/nanox/nxutil.c S3C2440/microwindows-0.91/src/nanox/nxutil.c
--- VT300/microwindows-0.91/src/nanox/nxutil.c    2009-01-23 21:29:30.000000000 +0800
+++ S3C2440/microwindows-0.91/src/nanox/nxutil.c    2009-05-20 18:34:54.000000000 +0800
@@ -11,6 +11,19 @@
 #include "nano-X.h"
 #include "device.h"
 
+#if 0
+extern unsigned int __aeabi_uidivmod(unsigned numerator, unsigned denominator);
+int __aeabi_idiv(int numerator, int denominator)
+     {
+      int neg_result = (numerator ^ denominator) & 0x80000000;
+      int result = __aeabi_uidivmod ((numerator < 0) ? -numerator : numerator, (denominator < 0) ? -denominator : denominator);
+      return neg_result ? -result : result; }
+unsigned __aeabi_uidiv(unsigned numerator, unsigned denominator)
+     {
+      return __aeabi_uidivmod (numerator, denominator);
+     }
+#endif
+
 /*
  * Create new window with passed style, title and location.
  */


沒有留言:

張貼留言