changeset 69:280ff3af2ecc

Added /dev/usbmouse to the list of mice to check
author Sam Lantinga <slouken@lokigames.com>
date Sat, 16 Jun 2001 02:48:39 +0000
parents ac6645260d31
children f590dd383b5d
files src/video/fbcon/SDL_fbevents.c
diffstat 1 files changed, 15 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/fbcon/SDL_fbevents.c	Sat Jun 16 01:51:42 2001 +0000
+++ b/src/video/fbcon/SDL_fbevents.c	Sat Jun 16 02:48:39 2001 +0000
@@ -492,6 +492,7 @@
 
 int FB_OpenMouse(_THIS)
 {
+	int i;
 	const char *mousedev;
 	const char *mousedrv;
 
@@ -522,6 +523,10 @@
 	/* STD MICE */
 
 	if ( mousedev == NULL ) {
+		/* FIXME someday... allow multiple mice in this driver */
+		char *ps2mice[] = {
+		    "/dev/input/mice", "/dev/usbmouse", "/dev/psaux", NULL
+		};
 		/* First try to use GPM in repeater mode */
 		if ( mouse_fd < 0 ) {
 			if ( gpm_available() ) {
@@ -534,38 +539,25 @@
 				}
 			}
 		}
-		/* Now try to use the new HID unified mouse device */
-		if ( mouse_fd < 0 ) {
-			mouse_fd = open("/dev/input/mice", O_RDWR, 0);
+		/* 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);
 			if (mouse_fd < 0) {
-				mouse_fd = open("/dev/input/mice", O_RDONLY, 0);
+				mouse_fd = open(ps2mice[i], O_RDONLY, 0);
 			}
 			if (mouse_fd >= 0) {
-				/* rcg06112001 Attempt to set IMPS/2 mode first, even with envr var... */
-				set_imps2_mode(mouse_fd);
-
-				if (detect_imps2(mouse_fd)) {
-					mouse_drv = MOUSE_IMPS2;
-				} else {
-					mouse_drv = MOUSE_PS2;
+				/* rcg06112001 Attempt to set IMPS/2 mode */
+				if ( i == 0 ) {
+					set_imps2_mode(mouse_fd);
 				}
-			}
-		}
-		/* Now try to use a modern PS/2 port mouse */
-		if ( mouse_fd < 0 ) {
-			mouse_fd = open("/dev/psaux", O_RDWR, 0);
-			if ( mouse_fd < 0 ) {
-				mouse_fd = open("/dev/psaux", O_RDONLY, 0);
-			}
-			if ( mouse_fd >= 0 ) {
-				if ( detect_imps2(mouse_fd) ) {
+				if (detect_imps2(mouse_fd)) {
 #ifdef DEBUG_MOUSE
-fprintf(stderr, "Using IMPS/2 mouse\n");
+fprintf(stderr, "Using IMPS2 mouse\n");
 #endif
 					mouse_drv = MOUSE_IMPS2;
 				} else {
 #ifdef DEBUG_MOUSE
-fprintf(stderr, "Using PS/2 mouse\n");
+fprintf(stderr, "Using PS2 mouse\n");
 #endif
 					mouse_drv = MOUSE_PS2;
 				}