I wipped up some code to let me use SDL-1.2.4 with a touchscreen on a
StrongARM platform by Applieddata.net. The product can be seen here:
http://www.applieddata.net/products_bitsy.asp
It probably will work on any of their Linux products. It uses /dev/ts
which is setup by ADS’s kernel patches. The patch is attached. Hope maybe
this is useful to someone else too.
Bill Thiede
Cybernet Systems Corp.
http://www.cybernet.com
-------------- next part --------------
*** SDL-1.2.4/src/video/fbcon/SDL_fbevents.c Wed Mar 6 06:23:03 2002
— SDL-1.2.4.ads/src/video/fbcon/SDL_fbevents.c Tue May 14 10:34:08 2002***************
*** 317,322 ****
— 317,323 ----
MOUSE_MS,
MOUSE_BM,
MOUSE_ELO,
- MOUSE_ADS,
NUM_MOUSE_DRVS
} mouse_drv = MOUSE_NONE;
*** 539,544 ****
— 540,555 ----
}
}
}
-
/* Try ADS touchscreen */
-
if ( mouse_fd < 0 ) {
-
mouse_fd = open("/dev/ts", O_RDONLY, 0);
-
if ( mouse_fd >= 0 ) {
- #ifdef DEBUG_MOUSE
-
fprintf(stderr, "Using ADS touchscreen\n");
- #endif
-
mouse_drv = MOUSE_ADS;
-
}
-
} /* Now try to use a modern PS/2 mouse */ for ( i=0; (mouse_fd < 0) && ps2mice[i]; ++i ) { mouse_fd = open(ps2mice[i], O_RDWR, 0);
*** 574,579 ****
— 585,591 ----
}
}
}
+
/* Default to a serial Microsoft mouse */
if ( mouse_fd < 0 ) {
if ( mousedev == NULL ) {
*** 602,607 ****
— 614,622 ----
}
}
if ( mouse_fd < 0 ) {
- #ifdef DEBUG_MOUSE
- fprintf(stderr, “Not using mouse”);
-
#endif
mouse_drv = MOUSE_NONE;
}
return(mouse_fd);
*** 649,659 ****
— 664,676 ----
{
static int start = 0;
static unsigned char mousebuf[BUFSIZ];
-
static short oldmousebuf[BUFSIZ];
static int relative = 1;int i, nread;
int button = 0;
int dx = 0, dy = 0; -
int packetsize = 0;
int realx, realy;
*** 674,679 ****
— 691,700 ----
case MOUSE_BM:
packetsize = 3;
break;
-
case MOUSE_ADS:
-
packetsize = 3;
-
relative = 0;
-
break; case MOUSE_ELO: packetsize = ELO_PACKET_SIZE; relative = 0;
*** 808,813 ****
— 829,862 ----
eloConvertXY(this, &dx, &dy);
break;
*/
-
case MOUSE_ADS:
-
{
-
short newdx, newdy;
-
memcpy(&newdx, &mousebuf[0], 2);
-
memcpy(&newdy, &mousebuf[2], 2);
-
button = mousebuf[4]>0?1:0;
-
if(newdx == -1)
-
{
-
dx = oldmousebuf[0];
-
}
-
else
-
{
-
dx = newdx;
-
oldmousebuf[0] = dx;
-
}
-
if(newdy == -1)
-
{
-
dy = oldmousebuf[1];
-
}
-
else
-
{
-
dy = newdy;
-
oldmousebuf[1] = dy;
-
}
-
}
-
break; case MOUSE_ELO: case NUM_MOUSE_DRVS: