Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbevents.c @ 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 | e093bbc72ab9 |
children | e85e03f195b4 |
comparison
equal
deleted
inserted
replaced
68:ac6645260d31 | 69:280ff3af2ecc |
---|---|
490 return imps2; | 490 return imps2; |
491 } | 491 } |
492 | 492 |
493 int FB_OpenMouse(_THIS) | 493 int FB_OpenMouse(_THIS) |
494 { | 494 { |
495 int i; | |
495 const char *mousedev; | 496 const char *mousedev; |
496 const char *mousedrv; | 497 const char *mousedrv; |
497 | 498 |
498 mousedrv = getenv("SDL_MOUSEDRV"); | 499 mousedrv = getenv("SDL_MOUSEDRV"); |
499 mousedev = getenv("SDL_MOUSEDEV"); | 500 mousedev = getenv("SDL_MOUSEDEV"); |
520 } | 521 } |
521 | 522 |
522 /* STD MICE */ | 523 /* STD MICE */ |
523 | 524 |
524 if ( mousedev == NULL ) { | 525 if ( mousedev == NULL ) { |
526 /* FIXME someday... allow multiple mice in this driver */ | |
527 char *ps2mice[] = { | |
528 "/dev/input/mice", "/dev/usbmouse", "/dev/psaux", NULL | |
529 }; | |
525 /* First try to use GPM in repeater mode */ | 530 /* First try to use GPM in repeater mode */ |
526 if ( mouse_fd < 0 ) { | 531 if ( mouse_fd < 0 ) { |
527 if ( gpm_available() ) { | 532 if ( gpm_available() ) { |
528 mouse_fd = open(GPM_NODE_FIFO, O_RDONLY, 0); | 533 mouse_fd = open(GPM_NODE_FIFO, O_RDONLY, 0); |
529 if ( mouse_fd >= 0 ) { | 534 if ( mouse_fd >= 0 ) { |
532 #endif | 537 #endif |
533 mouse_drv = MOUSE_GPM; | 538 mouse_drv = MOUSE_GPM; |
534 } | 539 } |
535 } | 540 } |
536 } | 541 } |
537 /* Now try to use the new HID unified mouse device */ | 542 /* Now try to use a modern PS/2 mouse */ |
538 if ( mouse_fd < 0 ) { | 543 for ( i=0; (mouse_fd < 0) && ps2mice[i]; ++i ) { |
539 mouse_fd = open("/dev/input/mice", O_RDWR, 0); | 544 mouse_fd = open(ps2mice[i], O_RDWR, 0); |
540 if (mouse_fd < 0) { | 545 if (mouse_fd < 0) { |
541 mouse_fd = open("/dev/input/mice", O_RDONLY, 0); | 546 mouse_fd = open(ps2mice[i], O_RDONLY, 0); |
542 } | 547 } |
543 if (mouse_fd >= 0) { | 548 if (mouse_fd >= 0) { |
544 /* rcg06112001 Attempt to set IMPS/2 mode first, even with envr var... */ | 549 /* rcg06112001 Attempt to set IMPS/2 mode */ |
545 set_imps2_mode(mouse_fd); | 550 if ( i == 0 ) { |
546 | 551 set_imps2_mode(mouse_fd); |
552 } | |
547 if (detect_imps2(mouse_fd)) { | 553 if (detect_imps2(mouse_fd)) { |
548 mouse_drv = MOUSE_IMPS2; | |
549 } else { | |
550 mouse_drv = MOUSE_PS2; | |
551 } | |
552 } | |
553 } | |
554 /* Now try to use a modern PS/2 port mouse */ | |
555 if ( mouse_fd < 0 ) { | |
556 mouse_fd = open("/dev/psaux", O_RDWR, 0); | |
557 if ( mouse_fd < 0 ) { | |
558 mouse_fd = open("/dev/psaux", O_RDONLY, 0); | |
559 } | |
560 if ( mouse_fd >= 0 ) { | |
561 if ( detect_imps2(mouse_fd) ) { | |
562 #ifdef DEBUG_MOUSE | 554 #ifdef DEBUG_MOUSE |
563 fprintf(stderr, "Using IMPS/2 mouse\n"); | 555 fprintf(stderr, "Using IMPS2 mouse\n"); |
564 #endif | 556 #endif |
565 mouse_drv = MOUSE_IMPS2; | 557 mouse_drv = MOUSE_IMPS2; |
566 } else { | 558 } else { |
567 #ifdef DEBUG_MOUSE | 559 #ifdef DEBUG_MOUSE |
568 fprintf(stderr, "Using PS/2 mouse\n"); | 560 fprintf(stderr, "Using PS2 mouse\n"); |
569 #endif | 561 #endif |
570 mouse_drv = MOUSE_PS2; | 562 mouse_drv = MOUSE_PS2; |
571 } | 563 } |
572 } | 564 } |
573 } | 565 } |