Hi all,<br>I am using a microsoft based serial mouse. But the mouse is not getting detected . The driver loaded is hw/kdrive/linux/mouse.c<br>The same mouse is working fine on X and even microwindows.I am getting messages
<br>Switching to mouse protocol "logitech"<br>Switching to mouse protocol "ms"<br>Switching to mouse protocol "msc"<br>Switching to mouse protocol "logitech"<br>Switching to mouse protocol "ms"
<br>Switching to mouse protocol "msc"<br>Switching to mouse protocol "logitech"<br>.....<br>......<br>I think the mouseValid function is failing.I hacked a little bit , commented the validity check code
<br>// i = (*km->prot->Valid) (mi, event, ne);<br>in MouseRead() , forced it to detect microsoft mouse and changed the state to km->stage == MouseWorking so that the parsing is passed.<br>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. <br>The parsing code is modified but is doing the same thing as the previous code except these four lines.
<br> if (dx > 127)<br>
dx -= 256;<br>
if (dy > 127)<br>
dy -= 256;<br>If I don't do this the pointer goes at one end and does not come back.This parsing code is derived from microwindows mouse driver.<br><br><br>Here is the parsing code<br>#define TOP_FIVE_BITS 0xf8
<br>#define BOTTOM_THREE_BITS 0x07<br>#define TOP_BIT 0x80<br>#define SIXTH_BIT 0x40<br>#define BOTTOM_TWO_BITS 0x03<br>#define THIRD_FOURTH_BITS 0x0c<br>#define BOTTOM_SIX_BITS 0x3f
<br>#define MS_LEFT_BUTTON 2<br>#define MS_RIGHT_BUTTON 1<br><br><br>static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)<br>{ <br> Kmouse *km = mi->driver;<br> int dx, dy;
<br> unsigned long flags;<br> int left,right,buttons=0;<br> left = MS_LEFT_BUTTON;<br> right = MS_RIGHT_BUTTON;<br> if(ev[0] & SIXTH_BIT)<br> {<br> buttons=(ev[0]>>4) & BOTTOM_TWO_BITS;
<br> dy=((ev[0] & THIRD_FOURTH_BITS) << 4);<br> dx=((ev[0] & BOTTOM_TWO_BITS) << 6);<br> }<br><br> dx |= (ev[1] & BOTTOM_SIX_BITS);<br> dy |= (ev[2] & BOTTOM_SIX_BITS);
<br> if (dx > 127)<br> dx -= 256;<br> if (dy > 127)<br> dy -= 256;<br> <br> flags = KD_MOUSE_DELTA;<br> if (buttons & left)<br> flags |= KD_BUTTON_1;
<br> if(buttons &right)<br> flags |= KD_BUTTON_3;<br><br>#if 0<br> if (ev[0] & 0x20)<br> flags |= KD_BUTTON_1;<br> if (ev[0] & 0x10)<br> flags |= KD_BUTTON_3;<br><br> if (!MouseReasonable (mi, flags, dx, dy))
<br> return FALSE;<br>#endif<br><br> if (km->stage == MouseWorking)<br> KdEnqueueMouseEvent (mi, flags, dx, dy);<br> return TRUE;<br>}<br><br><br>Please Help.Thanks.<br> <br><br>