Microsoft Serial Mouse not working on kdrive.
Abhinav Duggal
abhinavduggal at gmail.com
Fri May 4 02:12:27 PDT 2007
Hi all,
I am using a microsoft based serial mouse. But the mouse is not getting
detected . The driver loaded is hw/kdrive/linux/mouse.c
The same mouse is working fine on X and even microwindows.I am getting
messages
Switching to mouse protocol "logitech"
Switching to mouse protocol "ms"
Switching to mouse protocol "msc"
Switching to mouse protocol "logitech"
Switching to mouse protocol "ms"
Switching to mouse protocol "msc"
Switching to mouse protocol "logitech"
.....
......
I think the mouseValid function is failing.I hacked a little bit ,
commented the validity check code
// i = (*km->prot->Valid) (mi, event, ne);
in MouseRead() , forced it to detect microsoft mouse and changed the state
to km->stage == MouseWorking so that the parsing is passed.
I was able to get the mouse detected this way.But the mouse is working in a
haphazard manner.When I move the mouse pointer there is a large movement of
the pointer in a haphazard manner.
The parsing code is modified but is doing the same thing as the previous
code except these four lines.
if (dx > 127)
dx -= 256;
if (dy > 127)
dy -= 256;
If I don't do this the pointer goes at one end and does not come
back.Thisparsing code is derived from microwindows mouse driver.
Here is the parsing code
#define TOP_FIVE_BITS 0xf8
#define BOTTOM_THREE_BITS 0x07
#define TOP_BIT 0x80
#define SIXTH_BIT 0x40
#define BOTTOM_TWO_BITS 0x03
#define THIRD_FOURTH_BITS 0x0c
#define BOTTOM_SIX_BITS 0x3f
#define MS_LEFT_BUTTON 2
#define MS_RIGHT_BUTTON 1
static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
int dx, dy;
unsigned long flags;
int left,right,buttons=0;
left = MS_LEFT_BUTTON;
right = MS_RIGHT_BUTTON;
if(ev[0] & SIXTH_BIT)
{
buttons=(ev[0]>>4) & BOTTOM_TWO_BITS;
dy=((ev[0] & THIRD_FOURTH_BITS) << 4);
dx=((ev[0] & BOTTOM_TWO_BITS) << 6);
}
dx |= (ev[1] & BOTTOM_SIX_BITS);
dy |= (ev[2] & BOTTOM_SIX_BITS);
if (dx > 127)
dx -= 256;
if (dy > 127)
dy -= 256;
flags = KD_MOUSE_DELTA;
if (buttons & left)
flags |= KD_BUTTON_1;
if(buttons &right)
flags |= KD_BUTTON_3;
#if 0
if (ev[0] & 0x20)
flags |= KD_BUTTON_1;
if (ev[0] & 0x10)
flags |= KD_BUTTON_3;
if (!MouseReasonable (mi, flags, dx, dy))
return FALSE;
#endif
if (km->stage == MouseWorking)
KdEnqueueMouseEvent (mi, flags, dx, dy);
return TRUE;
}
Please Help.Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20070504/5b62c9e1/attachment.html>
More information about the xorg
mailing list