diff src/video/fbcon/SDL_fbelo.c @ 4:4f6c5f021323

Date: Thu, 26 Apr 2001 10:46:23 +0200 From: Alexander Pipelka <pipelka@bms-austria.com> Subject: SDL ELO driver bugfix Hi Sam! We noticed that the ELO serial touchscreen controller is quite sensitive in terms of correct protocol handling. The current implementation cause some controllers to hangup after some time (> 24h). I think the attached patch should fix this (I ran my device more than 3 days without any hangups).
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:54:56 +0000
parents 74212992fb08
children 2cf88672fc7f
line wrap: on
line diff
--- a/src/video/fbcon/SDL_fbelo.c	Thu Apr 26 16:52:42 2001 +0000
+++ b/src/video/fbcon/SDL_fbelo.c	Thu Apr 26 16:54:56 2001 +0000
@@ -421,3 +421,26 @@
 
 	return 1;
 }
+
+int eloReadPosition(_THIS, int fd, int* x, int* y, int* button_state, int* realx, int* realy) {
+        unsigned char buffer[ELO_PACKET_SIZE];
+        int pointer = 0;
+        int checksum = ELO_INIT_CHECKSUM;
+
+        while(pointer < ELO_PACKET_SIZE) {
+                if(eloGetPacket(buffer, &pointer, &checksum, fd)) {
+                        break;
+                }
+        }
+
+        if(!eloParsePacket(buffer, realx, realy, button_state)) {
+                return 0;
+        }
+
+        *x = *realx;
+        *y = *realy;
+
+        eloConvertXY(this, x, y);
+	
+	return 1;
+}