comparison src/video/fbcon/SDL_fbevents.c @ 1584:b786d9c15e42

Fixed bug #61 Date: Mon, 24 Feb 2003 13:35:11 +0800 From: "Leonidas" Subject: [SDL] Re: Trigger mouse wheel event -- not in X-environment I have looked into the codes for the IMPS/2 mouse wheel mode of fbcon driver. But I found something weird. Here's the original codes to set a mouse device into IMPS/2 mode in libSDL. In the file src/video/fbcon/SDL_fbevents.c In function static int set_imps2_mode(int fd) ... Uint8 set_imps2[] = {0xf3, 200, 0xf3, 100, 0xf3, 80}; Uint8 reset = 0xff; fd_set fdset; struct timeval tv; int retval = 0; // Set mouse device fd into IMPS/2 mode if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) { // ??? then RESET it..??? if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) { retval = 1; } } ........... Since it sets IMPS/2 mode then reset it, so you will never get a mouse into IMPS/2 mode to use its wheel. What I did to make the wheel usable is remove the RESET codes. .... if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) { /* if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) { } */ retval = 1; } .... And in FB_OpenMouse(_THIS) Make the device /dev/psaux to be setted into imps2 mode such that it can be detected its a imps/2 mouse or not. (my mouse device is on ps2, but the codes only set /dev/input/mice device originally) Then I have done, I can use the mouse wheel when SDL uses frame buff driver. I dont exactly know I did right or wrong, I just change it for my usuage. Correct me please, if I did something wrong. Best regards, Li Tsung Lin IAP Product Dept. Engineer EeRise Corp. (Image Processing System, Computer Vision System) Hsin Tien, Taipei Hsien, Taiwan, R.O.C.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 22 Mar 2006 07:22:40 +0000
parents 43a565749fbf
children 980d2a0dc2a3
comparison
equal deleted inserted replaced
1583:95451df282c3 1584:b786d9c15e42
418 fd_set fdset; 418 fd_set fdset;
419 struct timeval tv; 419 struct timeval tv;
420 int retval = 0; 420 int retval = 0;
421 421
422 if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) { 422 if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) {
423 /* Don't reset it, that'll clear IMPS/2 mode on some mice
423 if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) { 424 if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) {
424 retval = 1; 425 retval = 1;
425 } 426 }
427 */
426 } 428 }
427 429
428 /* Get rid of any chatter from the above */ 430 /* Get rid of any chatter from the above */
429 FD_ZERO(&fdset); 431 FD_ZERO(&fdset);
430 FD_SET(fd, &fdset); 432 FD_SET(fd, &fdset);
543 545
544 /* STD MICE */ 546 /* STD MICE */
545 547
546 if ( mousedev == NULL ) { 548 if ( mousedev == NULL ) {
547 /* FIXME someday... allow multiple mice in this driver */ 549 /* FIXME someday... allow multiple mice in this driver */
548 static const char * const ps2mice[] = { 550 static const char *ps2mice[] = {
549 "/dev/input/mice", "/dev/usbmouse", "/dev/psaux", NULL 551 "/dev/input/mice", "/dev/usbmouse", "/dev/psaux", NULL
550 }; 552 };
551 /* First try to use GPM in repeater mode */ 553 /* First try to use GPM in repeater mode */
552 if ( mouse_fd < 0 ) { 554 if ( mouse_fd < 0 ) {
553 if ( gpm_available() ) { 555 if ( gpm_available() ) {
566 if (mouse_fd < 0) { 568 if (mouse_fd < 0) {
567 mouse_fd = open(ps2mice[i], O_RDONLY, 0); 569 mouse_fd = open(ps2mice[i], O_RDONLY, 0);
568 } 570 }
569 if (mouse_fd >= 0) { 571 if (mouse_fd >= 0) {
570 /* rcg06112001 Attempt to set IMPS/2 mode */ 572 /* rcg06112001 Attempt to set IMPS/2 mode */
571 if ( i == 0 ) { 573 set_imps2_mode(mouse_fd);
572 set_imps2_mode(mouse_fd);
573 }
574 if (detect_imps2(mouse_fd)) { 574 if (detect_imps2(mouse_fd)) {
575 #ifdef DEBUG_MOUSE 575 #ifdef DEBUG_MOUSE
576 fprintf(stderr, "Using IMPS2 mouse\n"); 576 fprintf(stderr, "Using IMPS2 mouse\n");
577 #endif 577 #endif
578 mouse_drv = MOUSE_IMPS2; 578 mouse_drv = MOUSE_IMPS2;