Mouse on framebuffer - no motion

Hi All,

I just subscribed so please forgive if I ask a question that was
answered here recently. This mailing list doesn’t have a search function
and the complete archive is too big to download (50 MB) so I thought I
would simply ask you directly:

I have been using libsdl for about six months already. The application
we develop runs under X11 (window/fullscreen) and also on console
(fbcon/svgalib). Under X11 there’s no problem. But on the console we are
having problems with mouse. The mouse movements are not detected
properly - the mouse cursor usually does not move at all or the movement
is often incorrectly detected as mouse button clicks.

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

My question is whether there were any changes in 1.2.x regarding reading
mouse on console (particularly fbcon). I didn’t change my code nor my
system environment (IIRC). We also observed this problem on several
machines with different Linux distributions (Debian Sid, Redhat 7.x).

The code for reading mouse movements is rather simple and looks like
this (simplified):

init:
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE);

once in a while (each 20 milliseconds):

while (SDL_PollEvent(&event)) {
int type = event.type;
if (type == SDL_MOUSEMOTION) {
SDL_MouseMotionEvent eve = event.motion;
int xrel = eve.xrel;
int yrel = eve.yrel;

   // follows code that works with xrel and yrel and
   // draws the mouse cursor
}

}

I don’t claim this code is perfect - I followed the documentation on
libsdl.org and also the trial-error path. It works perfectly in X11 and
used to work well on fbcon. But now it doesn’t work.

Thanks for any hints.

Petr

P.S. I heard I could try to run gpm in repeater mode. I tried it but it
didn’t help.

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

Are you still having this problem? If so, can you tell me what sort of
mouse you’re using?

–ryan.

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

Are you still having this problem?

yes. For about three months already.

If so, can you tell me what sort of mouse you’re using?

Microsoft IntelliMouse 1.3A.

I know this mouse is weird. I also know what the “Intelli” means - the
mouse lives its own intelligent life and feels free to move itself in
certain directions in X11.

Anyway, it used to work on fbcon several months ago with the same mouse.

BTW, I just found out that SDL_WarpMouse(640/2, 480/2) crashes in SDL
when running on fbcon. Is it related to my mouse motion problems? I
don’t know.

PetrOn Thu, 2001-09-20 at 10:39, Ryan C. Gordon wrote:

svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

just to make sure you understand what I suffer from I wrote this simple
program:

#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL/SDL_events.h>

int main() {
SDL_Event event;
int quit = 0;
if (SDL_Init(SDL_INIT_VIDEO) != 0)
return 1;
SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE |SDL_FULLSCREEN);
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE);
while(! quit) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_MOUSEMOTION) {
SDL_MouseMotionEvent eve = event.motion;
fprintf(stderr, “Mouse moved [%d, %d]\n”, eve.xrel, eve.yrel);
}
else if (event.type == SDL_KEYDOWN) {
quit = 1;
break;
}
}
}

SDL_ShowCursor(SDL_ENABLE);
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_VideoQuit();
SDL_Quit();
return 0;

}

Feel free to “cc test.c -o test -lSDL” and run it.
When I start it under X11 and move my mouse slowly to the right I get
something like this:

Mouse moved [1, 0]
Mouse moved [1, 0]
Mouse moved [1, 0]
Mouse moved [1, 0]
Mouse moved [1, 0]

The same program started on fbcon yields this:

Mouse moved [0, -8]
Mouse moved [1, 0]
Mouse moved [8, -2]
Mouse moved [0, -8]
Mouse moved [1, 0]
Mouse moved [8, -2]
Mouse moved [0, -40]
Mouse moved [255, 0]

completely random values. I’d say garbage. Do you see any reason for
this? Is something wrong in my setup?

Petr

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

Are you still having this problem?

yes. For about three months already.

Just a thought - I see you are running debian.
This hasn’t got anything to do with running gpm?
Try a /etc/init.d/gpm stop and see what happens.On Thursday 20 September 2001 10:59, you wrote:

On Thu, 2001-09-20 at 10:39, Ryan C. Gordon wrote:

If so, can you tell me what sort of mouse you’re using?

Microsoft IntelliMouse 1.3A.

I know this mouse is weird. I also know what the “Intelli” means - the
mouse lives its own intelligent life and feels free to move itself in
certain directions in X11.

Anyway, it used to work on fbcon several months ago with the same mouse.

BTW, I just found out that SDL_WarpMouse(640/2, 480/2) crashes in SDL
when running on fbcon. Is it related to my mouse motion problems? I
don’t know.

Petr


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi!

I’m working on the same code as Petr Stehlik…On Thu, 20 Sep 2001, Jone Marius Vignes wrote:

On Thursday 20 September 2001 10:59, you wrote:

On Thu, 2001-09-20 at 10:39, Ryan C. Gordon wrote:

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

Are you still having this problem?

yes. For about three months already.

Just a thought - I see you are running debian.
This hasn’t got anything to do with running gpm?
Try a /etc/init.d/gpm stop and see what happens.

I didn’t have gpm started. Someone here have said that I should use the -R
mode and test it: No improvement.
I’m using RH7.0+patches.

regards

STan

just to make sure you understand what I suffer from I wrote this simple
program:

Have you tried setting the environment variable:

export SDL_MOUSEDEV_IMPS2=1

before running the program?

–ryan.

Mouse moved [0, -8]
Mouse moved [1, 0]
Mouse moved [8, -2]
Mouse moved [0, -8]
Mouse moved [1, 0]
Mouse moved [8, -2]
Mouse moved [0, -40]
Mouse moved [255, 0]

This looks something like mouse bit patterns … Are you sure you’re
using the right driver ?

(this could of course also be the intelligent life living in the
mouse, having a bit fun).–
Trick


Linux User #229006 * http://counter.li.org

wow! Works like a charm now. What is it - a RTFM thing or something
hidden in the SDL source? And why does it need to be set before running
the program - libSDL cannot detect this automatically?

Anyway, thanks a lot for this hint. Saved me a lot of headache!

PetrOn Thu, 2001-09-20 at 14:09, Ryan C. Gordon wrote:

just to make sure you understand what I suffer from I wrote this simple
program:

export SDL_MOUSEDEV_IMPS2=1

just to make sure you understand what I suffer from I wrote this simple
program:

Have you tried setting the environment variable:

export SDL_MOUSEDEV_IMPS2=1

before running the program?

Yes, I’ve just tried this too. No improvement too. Just now I’m building
the SDL (cvs version) with the DEBUG_MOUSE, so we should know more after a
while.
BTW: Did anybody tried the code posted by Petr Stehlik? Does it work at
your site?

regards

STanOn Thu, 20 Sep 2001, Ryan C. Gordon wrote:

wow! Works like a charm now. What is it - a RTFM thing or something
hidden in the SDL source? And why does it need to be set before running
the program - libSDL cannot detect this automatically?

It’s something I stumbled across last time this came up, and I think it’s
only documented in the source, since it is generally pretty esoteric… I’m
not sure WHY its needed (that is, I’m not sure if there’s a way to
autodetect the mouse), and it isn’t needed in all cases, either.
(shrug).

–ryan.

I remember that the mouse used to work fine on fbcon in April this year
(libsdl probably version 1.2.0, or pre1.2.0). It never worked on
svgalib, though. Currently I have libsdl 1.2.1 (Debian) and tried 1.2.2
(rpm) and neither fbcon nor svgalib mouse works.

I use Debian (woody), and during the several upgrades I have had recently, my
mouse support under fbcom has been actually lost. So it may have nothing to
do with SDL, it may be a misconfiguration. (I actually can’t recall how to
fix the configuration right now either… e-mail me off list if you think
this may be your problem ;-)–
Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Tux4Kids: < http://www.geekcomix.com/tux4kids/ >

just to make sure you understand what I suffer from I wrote this simple
program:

Have you tried setting the environment variable:

export SDL_MOUSEDEV_IMPS2=1

before running the program?

Yes, I’ve just tried this too. No improvement too. Just now I’m building
the SDL (cvs version) with the DEBUG_MOUSE, so we should know more after a
while.

Well, it says only this:
Using IMPS2 mouse

This means, as I look into the SDL code, that the handle_mouse doesn’t
reach the read(mouse_fd) debug report line and thus I don’t get any mouse
event at all. I can try to debug this here…

regards

STanOn Thu, 20 Sep 2001, Standa Opichal wrote:

On Thu, 20 Sep 2001, Ryan C. Gordon wrote:

BTW: Did anybody tried the code posted by Petr Stehlik? Does it work at
your site?

Not to make you upset, but I tried at my site (Red Hat Linux 6.2 with some Compaq Mouse) and everithing worked fine… even without the

export SDL_MOUSEDEV_IMPS2=1

AlfonsoOn Thu, Sep 20, 2001 at 03:01:39PM +0200, Standa Opichal wrote: