Date: Mon, 14 Jun 2004 12:32:12 +0200 From: Emmanuel Anne To: sdl@libsdl.org Subject: [SDL] patch : imps2 mouse in fbcon (raw repeater) --- /mnt/win_c/msys/1.0/home/Manu/SDL-1.2.7/src/video/fbcon/SDL_fbevents.c 2004-02-18 18:22:06.000000000 +0100 +++ src/video/fbcon/SDL_fbevents.c 2004-06-08 23:05:33.000000000 +0200 @@ -61,6 +61,7 @@ #define GPM_NODE_FIFO "/dev/gpmdata" #endif +// #define DEBUG_MOUSE /* The translation tables from a console scancode to a SDL keysym */ #define NUM_VGAKEYMAPS (1< 0 ) { - if ( strcmp(arg, "-R") == 0 ) { +#ifdef DEBUG_MOUSE + fprintf(stderr,"gpm arg %s len %d\n",arg,len); +#endif + if (!strcmp(arg,"-t")) { + // protocol string, keep it for later + char *s; + arg += strlen(arg)+1; + s = strchr(arg,' '); + if (s) *s = 0; + strncpy(gpm_proto, arg, 10 ); + if (s) *s = ' '; + } + + if ( strncmp(arg, "-R",2) == 0 ) { + char *s; available = 1; + arg += 2; + s = strchr(arg,' '); + if (s) *s = 0; + strncpy(gpm_repeater_proto, arg, 10); + if (s) *s = ' '; } arglen = strlen(arg)+1; len -= arglen; @@ -394,6 +419,9 @@ } closedir(proc); } +#ifdef DEBUG_MOUSE + fprintf(stderr,"gpm test %d\n",available); +#endif return available; } @@ -535,10 +563,26 @@ #ifdef DEBUG_MOUSE fprintf(stderr, "Using GPM mouse\n"); #endif + if ((!strcmp(gpm_proto, "imps2") && !strcmp(gpm_repeater_proto,"raw")) || + !strcmp(gpm_repeater_proto,"imps2")) { + mouse_drv = MOUSE_IMPS2; + } else { + set_imps2_mode(mouse_fd); + if (detect_imps2(mouse_fd)) { +#ifdef DEBUG_MOUSE +fprintf(stderr, "Using IMPS2 mouse\n"); +#endif + mouse_drv = MOUSE_IMPS2; + } else { +#ifdef DEBUG_MOUSE +fprintf(stderr,"imps2 test failed, using msc\n"); +#endif mouse_drv = MOUSE_MSC; } } } + } + } /* 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);