Trigger mouse wheel event -- not in X-environment

Hi, everybody, thank you for your reply of my last question.
My mouse wheel now is usable under X-environment.
However, I am sorry that I am such a greed guy.

Now I want to use the mouse wheel without entering X-environment,
since the system loading will be lighter and the performance will be better.

That is, after bootup, I do not execute “startx”,
but directly execute my SDL program.
I am sure my SDL program is executable in console mode, with all mouse
motion/keydown
actions, and full colors display, but I do not know how to make the
mouse wheel rolling event be triggered.

Could you help me again?

Thank you.

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.
Email: Leondias at eerise.com.tw
WebSite: Http://www.eerise.com.tw

I have looked into the codes for the IMPS/2 mouse wheel mode of fbcon
driver.
But I found something weird.

Thanks, I’ve entered this bug in bugzilla:
https://bugzilla.libsdl.org/show_bug.cgi?id=61

I think you’re right, that we want to leave the mouse in imps2 mode,
or at least re-set it if we decide to use the mouse in that mode. :slight_smile:

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment