nanogui: Thread: touch screen


[<<] [<] Page 2 of 2 [>] [>>]
Subject: Re: [nanogui] Touchscreen
From: "Greg Haerr" ####@####.####
Date: 17 May 2004 14:24:02 +0100
Message-Id: <04e301c43c12$3be72b20$3aba46a6@xmission.com>

: Which source file is in charge of starting the touch screen? I found the
: file that actually opens the /dev/ts device (moutouchscreen.c), but which
: file calls that file? For some reason, that method isn't being called.

nanox/srvmain.c - main() function calls GsInitMouse
engine/devmouse.c - GsInitMouse calls driver to open mouse
drivers/mou_xxx.c - hw init code executes for mouse

Regards,

Greg
Subject: Touchscreen
From: "Demetris Zavorotnichenko" ####@####.####
Date: 15 Jun 2006 10:41:15 +0100
Message-Id: <005501c6905f$d64ef730$0100a8c0@3dmaster>

I am trying to make the Touchscreen on the Panasonic LCD with four wire resistive touch screen work on Gumstix.

Gumstix uses the pxa2xx-ac97 driver conjunction with the EVDEV module to operate a touchscreen with a device under /dev/input/even0 

i haven't found any support to this anywhere so if anyone could help me please do.


Demetris Z

.
Subject: RE: [nanogui] Touchscreen
From: Junior ####@####.####
Date: 15 Jun 2006 20:46:09 +0100
Message-Id: <E88552361A0.00000585ejr@inbox.com>


> -----Original Message-----
> From: ####@####.####
> Sent: Thu, 15 Jun 2006 12:41:11 +0300
> To: ####@####.####
> Subject: [nanogui] Touchscreen
> 
> I am trying to make the Touchscreen on the Panasonic LCD with four wire
> resistive touch screen work on Gumstix.
> 
> Gumstix uses the pxa2xx-ac97 driver conjunction with the EVDEV module to
> operate a touchscreen with a device under /dev/input/even0
> 

I'm using the same device and added support for the tslib to by drivers. I'll try to get a patch out soon.

--Jr. 
Subject: Re: [nanogui] Touchscreen
From: Junior ####@####.####
Date: 15 Jun 2006 21:49:34 +0100
Message-Id: <E9138A5E13E.00000631ejr@inbox.com>

> -----Original Message-----
> From: ####@####.####
> Sent: Thu, 15 Jun 2006 23:04:14 +0300
> To: ####@####.####
> Subject: Re: [nanogui] Touchscreen
> 
> Please if possible explain how to patch the drivers and makefile of
> Microwindows fo TSLIB for the touchscreen.
> I need the help allot since i have a deadline and you are my Saviour :)
> 
> Please if possible help me out here.
> 
> 
> Demetris Z
> 
> .
> ----- Original Message -----
> From: "Junior" ####@####.####
> To: "Demetris Zavorotnichenko" ####@####.####
> ####@####.####
> Sent: Thursday, June 15, 2006 10:45 PM
> Subject: RE: [nanogui] Touchscreen
> 
> 
> 
> 
>> -----Original Message-----
>> From: ####@####.####
>> Sent: Thu, 15 Jun 2006 12:41:11 +0300
>> To: ####@####.####
>> Subject: [nanogui] Touchscreen
>> 
>> I am trying to make the Touchscreen on the Panasonic LCD with four wire
>> resistive touch screen work on Gumstix.
>> 
>> Gumstix uses the pxa2xx-ac97 driver conjunction with the EVDEV module to
>> operate a touchscreen with a device under /dev/input/even0
>> 
> 
> I'm using the same device and added support for the tslib to by drivers.
> I'll try to get a patch out soon.
> 
> --Jr.
> 
> 

Patch...


[Content type application/octet-stream not shown. Download]
Subject: Re: [nanogui] Touchscreen
From: "ing. Davide Rizzo" ####@####.####
Date: 27 Mar 2008 14:43:26 -0000
Message-Id: <47EBB28E.6050603@elpa.it>

Hi Greg,
I appreciate very much nano-X and nxlib. Currently I'm using them with 
fltk 1.1.7.
Until now I used it on my Linux-ARM embedded system, with h3600-tsraw 
touchscreen driver.
Unfortunately from linux kernel 2.6.24 that driver disappeared.
I added one driver to microwindows to use /dev/input/event0 standard 
interface. I tested also with nxcal, it seems to work.
This should enable nano-X to work with various standard touchscreen drivers.
I enclose my patch to add that driver, plus some minor bug corrections 
(I think).
I enclose also a very small nxlib patch that corrects an obsoleted 
include and disables an annoying debug print (never used a FLTK clock 
widget ?)
These patches have been generated with diff related to your actual cvs 
version.
Please let me know if they can be useful.
Note: if you cannot reach the included patches, you can download them 
from: http://www.elpa.it/eng/rd129.html
Question: Is it possible to use Fltk+Nxlib+NanoX with 
linked-app-into-server option ? I tried, but without success.
Regards
Davide Rizzo - ELPA sas

diff -urN microwindows-080127/src/config microwindows-080127.elpa/src/config
--- microwindows-080127/src/config	2008-01-07 00:15:02.000000000 +0100
+++ microwindows-080127.elpa/src/config	2008-02-06 16:10:40.000000000 +0100
@@ -310,6 +310,7 @@
 # NOMOUSE	no mouse driver
 #
 # Touchscreen drivers
+# EVENTMOUSE	Standard event interface (/dev/input/event0)
 # IPAQMOUSE	Compaq iPAQ, Intel Assabet (/dev/h3600_tsraw)
 # ZAURUSMOUSE	Sharp Zaurus (/dev/sharp_ts)
 # TUXMOUSE	TuxScreen (/dev/ucb1x00-ts)
@@ -323,9 +324,10 @@
 # HARRIERMOUSE	NEC Harrier (/dev/tpanel)
 ####################################################################
 GPMMOUSE                 = N
-SERMOUSE                 = Y
+SERMOUSE                 = N
 SUNMOUSE                 = N
 NOMOUSE                  = N
+EVENTMOUSE               = Y
 IPAQMOUSE                = N
 ZAURUSMOUSE              = N
 TUXMOUSE                 = N
diff -urN microwindows-080127/src/demos/mwin/mine.c microwindows-080127.elpa/src/demos/mwin/mine.c
--- microwindows-080127/src/demos/mwin/mine.c	2005-06-17 01:42:11.000000000 +0200
+++ microwindows-080127.elpa/src/demos/mwin/mine.c	2008-02-04 14:01:23.000000000 +0100
@@ -16,6 +16,7 @@
 #define MWINCLUDECOLORS
 #include "windows.h"
 #include "wintools.h"
+#include "wintern.h"
 
 typedef struct {	
        	int flag;
@@ -1049,6 +1050,7 @@
 WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
 	int nShowCmd)
 {
+		MwSetTextCoding ( MWTF_ASCII );
     TestMyWindow (NULL);
     return 0;
 }
diff -urN microwindows-080127/src/demos/nxroach/Makefile microwindows-080127.elpa/src/demos/nxroach/Makefile
--- microwindows-080127/src/demos/nxroach/Makefile	2003-09-25 04:15:01.000000000 +0200
+++ microwindows-080127.elpa/src/demos/nxroach/Makefile	2008-02-04 14:01:23.000000000 +0100
@@ -49,9 +49,9 @@
 ifeq ($(SHAREDLIBS), Y)
 $(MW_DIR_BIN)/nxroach: $(OBJS) $(NANOXCLIENTLIBS) $(CONFIG)
 	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $@ $(CCNANOXCLIENTLIBS)
 else
 $(MW_DIR_BIN)/nxroach: $(OBJS) $(NANOXCLIENTLIBS) $(CONFIG)
 	@echo "Linking $(patsubst $(MW_DIR_BIN)/%,%,$@) ..."
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $@ $(NANOXCLIENTLIBS)
 endif
diff -urN microwindows-080127/src/drivers/mou_event.c microwindows-080127.elpa/src/drivers/mou_event.c
--- microwindows-080127/src/drivers/mou_event.c	1970-01-01 01:00:00.000000000 +0100
+++ microwindows-080127.elpa/src/drivers/mou_event.c	2008-02-06 16:04:59.000000000 +0100
@@ -0,0 +1,110 @@
+/*
+ * Generic event touchscreen driver 
+ *
+ * Copyright (c) 2008, ELPA sas
+ * Written by Davide Rizzo ####@####.####
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <linux/input.h>
+#include "device.h"
+
+#define TS_DEVICE "/dev/input/event0"
+
+extern SCREENDEVICE scrdev;
+static int pd_fd = -1;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+	if((pd_fd = open(TS_DEVICE, O_NONBLOCK)) < 0)
+	{
+		EPRINTF("[%s] Error %d opening %s\n", TS_DEVICE, errno, TS_DEVICE);
+		return -1;
+	}
+	GdHideCursor(&scrdev);
+	return pd_fd;
+}
+
+static void PD_Close(void)
+{
+ 	if(pd_fd < 0)
+		return;
+	close(pd_fd);
+	pd_fd = -1;
+}
+
+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)
+{
+	struct input_event event;
+	int bytes_read;
+	static int x,y,z;
+	/* read a data point */
+	while( (bytes_read = read(pd_fd, &event, sizeof(event))) == sizeof(event) )
+	{
+		switch(event.type)
+		{
+		case EV_ABS:
+			switch(event.code)
+			{
+			case ABS_X:
+				x=event.value;
+				break;
+			case ABS_Y:
+				y=event.value;
+				break;
+			}
+			break;
+		case EV_KEY:
+			if(event.code==BTN_TOUCH)
+				z=event.value;
+			break;
+		case EV_SYN:
+			*px=x;
+			*py=y;
+			*pb = z ? MWBUTTON_L : 0;
+			*pz = z;
+			if(!*pb)
+				return 3;
+			return 2;
+			break;
+		}
+	}
+	if(bytes_read == -1)
+	{
+		if(errno == EINTR || errno == EAGAIN) return 0;
+		EPRINTF("[%s] Error %d reading from touch panel\n", TS_DEVICE, errno);
+		return -1;
+	}
+	if(bytes_read != 0)
+	{
+		EPRINTF("[%s] Wrong number of bytes %d read from touch panel "
+		"(expected %d)\n", TS_DEVICE, bytes_read, sizeof(event));
+		return -1;
+	}
+	return 0;
+}
+
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL,
+	MOUSE_TRANSFORM   /* Input filter flags */
+};
diff -urN microwindows-080127/src/drivers/Objects.rules microwindows-080127.elpa/src/drivers/Objects.rules
--- microwindows-080127/src/drivers/Objects.rules	2005-06-15 18:38:19.000000000 +0200
+++ microwindows-080127.elpa/src/drivers/Objects.rules	2008-02-04 15:23:09.000000000 +0100
@@ -170,6 +170,11 @@
 MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_touchscreen.o
 endif
 
+ifeq ($(EVENTMOUSE), Y)
+CFLAGS += -DTOUCHSCREEN_EVENT=1
+MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_event.o
+endif
+
 ifeq ($(IPAQMOUSE), Y)
 CFLAGS += -DTOUCHSCREEN_IPAQ=1
 MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_touchscreen.o
diff -urN microwindows-080127/src/engine/devmouse.c microwindows-080127.elpa/src/engine/devmouse.c
--- microwindows-080127/src/engine/devmouse.c	2005-06-23 07:00:00.000000000 +0200
+++ microwindows-080127.elpa/src/engine/devmouse.c	2008-02-06 16:40:36.000000000 +0100
@@ -636,7 +636,7 @@
 		break;
 
 	case MWPORTRAIT_DOWN:
-		*xpos = x;
+		*xpos = scrdev.xres - x - 1;
 		*ypos = scrdev.yres - y - 1;
 		break;
 
diff -urN microwindows-080127/src/mwin/winevent.c microwindows-080127.elpa/src/mwin/winevent.c
--- microwindows-080127/src/mwin/winevent.c	2005-06-23 07:00:00.000000000 +0200
+++ microwindows-080127.elpa/src/mwin/winevent.c	2008-02-04 14:01:23.000000000 +0100
@@ -19,7 +19,7 @@
 
 static LPFN_KEYBTRANSLATE mwPtrKeyboardTranslator = NULL;
 
-#if !(DOS_TURBOC | DOS_QUICKC | _MINIX | VXWORKS)
+#if !(DOS_TURBOC | DOS_QUICKC | _MINIX | VXWORKS | LINUX)
 static int
 abs(int n)
 {

diff -urN nxlib-071231/FillPolygon.c nxlib-071231.elpa/FillPolygon.c
--- nxlib-071231/FillPolygon.c	2002-08-14 03:37:47.000000000 +0200
+++ nxlib-071231.elpa/FillPolygon.c	2007-12-31 14:58:59.000000000 +0100
@@ -27,8 +27,8 @@
 		}
 	}
 
-	if (shape == Complex || shape == Convex)
-		printf("XFillPolygon: Complex/Convex\n");
+//	if (shape == Complex || shape == Convex)
+//		printf("XFillPolygon: Complex/Convex\n");
 
 	GrFillPoly(d, gc->gid, npoints, gr_points);
 
diff -urN nxlib-071231/Xlcint.h nxlib-071231.elpa/Xlcint.h
--- nxlib-071231/Xlcint.h	2003-08-11 22:17:56.000000000 +0200
+++ nxlib-071231.elpa/Xlcint.h	2007-12-31 15:26:51.000000000 +0100
@@ -71,7 +71,7 @@
 #include "Xresource.h"
 #include "Xutil.h"
 /*#include "Xvarargs.h"*/
-#include "varargs.h"
+#include "stdarg.h"
 
 typedef Bool (*XFilterEventProc)(
 #if NeedFunctionPrototypes
Subject: Re: [nanogui] Touchscreen
From: "Greg Haerr" ####@####.####
Date: 28 Mar 2008 23:35:24 -0000
Message-Id: <107901c8912c$61da63b0$6401a8c0@winXP>

: Question: Is it possible to use Fltk+Nxlib+NanoX with 
: linked-app-into-server option ? I tried, but without success.

What was the error?  I've never tried.  If its just some
undefined symbols, some may need to be added for
the linked in case in nanox/srvmain.c.

Regards,

Greg
Subject: Re: [nanogui] Touchscreen
From: "ing. Davide Rizzo" ####@####.####
Date: 29 Mar 2008 08:52:21 -0000
Message-Id: <47EE0341.1020508@elpa.it>

Greg Haerr ha scritto:
> : Question: Is it possible to use Fltk+Nxlib+NanoX with 
> : linked-app-into-server option ? I tried, but without success.
>
> What was the error?  I've never tried.  If its just some
> undefined symbols, some may need to be added for
> the linked in case in nanox/srvmain.c.
>   
No, the problem is different. The compilation is OK.
I'm running this on an embedded arm9-based CPU, equipped with QVGA lcd 
panel and touchscreen.
After running the monolithic program, it's locked on a select (like it 
should). That select the first time waits not for a touchscreen event, 
but for a console key press, and then it "seems" to work. Afther this 
first event, in practice the program run in a short loop, never waiting 
on the select call.
That debug was performed using h3600_tsraw touchscreen driver and kernel 
2.6.23.
The same program is actually running without problems in my system with 
kernel 2.6.24 and the standard event driver I gave you, with separated 
nano-X server and client program.
I'm sorry, I tried this some months ago, so I don't remember more details.
If you're interested in it, I can have again a deeper debug session to 
give you more details.
Regards
Davide Rizzo - ELPA sas

> Regards,
>
> Greg
>
>   

[<<] [<] Page 2 of 2 [>] [>>]


Powered by ezmlm-browse 0.20.