Index: [thread] [date] [subject] [author]
  From: Christoph Egger <Christoph_Egger@t-online.de>
  To  : mackan@stacken.kth.se
  Date: Thu, 6 May 1999 21:03:07 +0200 (MEST)

MouseMan protocoll optimisation

Hi!

I know, the damned MouseMan protocoll has 3/4 bytes packets. The extra
byte is only there if the middle button is active.

You can optimize the MouseMan protocoll like this:

Getting the extra byte as a packet with magic numbers in it.
And then switch to 4-byte mode.

The magic numbers are:

#define MOUSE_EXTRA_MAGIC_1 0xAA
#define MOUSE_EXTRA_MAGIC_2 0x55

An implementation could be:

        if (buf[1] == MOUSE_EXTRA_MAGIC_1 && buf[2] == MOUSE_EXTRA_MAGIC_2)
        {
                /* got unexpected fourth byte => switch to 4-byte mode*/

	}
	else
	{
		/* the normal 3-byte mode */

	} // if


Christoph Egger
E-Mail: Christoph_Egger@t-online.de

Index: [thread] [date] [subject] [author]