Added /dev/usbmouse to the list of mice to check
authorSam Lantinga <slouken@lokigames.com>
Sat, 16 Jun 2001 02:48:39 +0000
changeset 69280ff3af2ecc
parent 68 ac6645260d31
child 70 f590dd383b5d
Added /dev/usbmouse to the list of mice to check
src/video/fbcon/SDL_fbevents.c
     1.1 --- a/src/video/fbcon/SDL_fbevents.c	Sat Jun 16 01:51:42 2001 +0000
     1.2 +++ b/src/video/fbcon/SDL_fbevents.c	Sat Jun 16 02:48:39 2001 +0000
     1.3 @@ -492,6 +492,7 @@
     1.4  
     1.5  int FB_OpenMouse(_THIS)
     1.6  {
     1.7 +	int i;
     1.8  	const char *mousedev;
     1.9  	const char *mousedrv;
    1.10  
    1.11 @@ -522,6 +523,10 @@
    1.12  	/* STD MICE */
    1.13  
    1.14  	if ( mousedev == NULL ) {
    1.15 +		/* FIXME someday... allow multiple mice in this driver */
    1.16 +		char *ps2mice[] = {
    1.17 +		    "/dev/input/mice", "/dev/usbmouse", "/dev/psaux", NULL
    1.18 +		};
    1.19  		/* First try to use GPM in repeater mode */
    1.20  		if ( mouse_fd < 0 ) {
    1.21  			if ( gpm_available() ) {
    1.22 @@ -534,38 +539,25 @@
    1.23  				}
    1.24  			}
    1.25  		}
    1.26 -		/* Now try to use the new HID unified mouse device */
    1.27 -		if ( mouse_fd < 0 ) {
    1.28 -			mouse_fd = open("/dev/input/mice", O_RDWR, 0);
    1.29 +		/* Now try to use a modern PS/2 mouse */
    1.30 +		for ( i=0; (mouse_fd < 0) && ps2mice[i]; ++i ) {
    1.31 +			mouse_fd = open(ps2mice[i], O_RDWR, 0);
    1.32  			if (mouse_fd < 0) {
    1.33 -				mouse_fd = open("/dev/input/mice", O_RDONLY, 0);
    1.34 +				mouse_fd = open(ps2mice[i], O_RDONLY, 0);
    1.35  			}
    1.36  			if (mouse_fd >= 0) {
    1.37 -				/* rcg06112001 Attempt to set IMPS/2 mode first, even with envr var... */
    1.38 -				set_imps2_mode(mouse_fd);
    1.39 -
    1.40 +				/* rcg06112001 Attempt to set IMPS/2 mode */
    1.41 +				if ( i == 0 ) {
    1.42 +					set_imps2_mode(mouse_fd);
    1.43 +				}
    1.44  				if (detect_imps2(mouse_fd)) {
    1.45 -					mouse_drv = MOUSE_IMPS2;
    1.46 -				} else {
    1.47 -					mouse_drv = MOUSE_PS2;
    1.48 -				}
    1.49 -			}
    1.50 -		}
    1.51 -		/* Now try to use a modern PS/2 port mouse */
    1.52 -		if ( mouse_fd < 0 ) {
    1.53 -			mouse_fd = open("/dev/psaux", O_RDWR, 0);
    1.54 -			if ( mouse_fd < 0 ) {
    1.55 -				mouse_fd = open("/dev/psaux", O_RDONLY, 0);
    1.56 -			}
    1.57 -			if ( mouse_fd >= 0 ) {
    1.58 -				if ( detect_imps2(mouse_fd) ) {
    1.59  #ifdef DEBUG_MOUSE
    1.60 -fprintf(stderr, "Using IMPS/2 mouse\n");
    1.61 +fprintf(stderr, "Using IMPS2 mouse\n");
    1.62  #endif
    1.63  					mouse_drv = MOUSE_IMPS2;
    1.64  				} else {
    1.65  #ifdef DEBUG_MOUSE
    1.66 -fprintf(stderr, "Using PS/2 mouse\n");
    1.67 +fprintf(stderr, "Using PS2 mouse\n");
    1.68  #endif
    1.69  					mouse_drv = MOUSE_PS2;
    1.70  				}