The application I am working on reads an 8 byte packet from the serial port. It then translates that to mouse movement.
Unfortunately what happens is eventually a byte or more gets lost from the serial, which then means my packets don't line up.
Format is CXXYYW00 where
C command byte (243 is the mouse move relative function code)
XX big endian signed int for X
YY big endian signed int for Y
W signed byte wheel

243 0 0 0 14 0 0 243 incrementalMouseMove 0 14 0
0 0 0 11 0 0 0 243 ????
this should be:
243 0 0 0 14 0 0 0 incrementalMouseMove 0 14 0

So a byte was "lost". Both the reading and writing are dead simple:
	for ( char c : {b1, b2, b3, b4, b5, b6, b7, b8}) {
		serialPort.write(&c, 1);
while (COMMAND_PORT.available() >= 8) {
  b1 =;
  b2 =;
  b3 =;
  b4 =;
  b5 =;
  b6 =;
  b7 =;
  b8 =;

  printBytes(b1, b2, b3, b4, b5, b6, b7, b8);
  ...eventually it gets unpacked and calls ...
 incrementalMouseMove(x, y, w);
The issue seems to be coming from use of delay() in the incrementalMouseMove() function which will move the full distance. states that "For natural looking motion, many small moves performed slowly are needed." I've found that when dragging the mouse the target environments are particularly sensitive to this, so there is a loop that divides the movement up into smaller increments. This uses delay() because I read somewhere that the HID needs delay between commands. But it seems that this use of delay is causing me to miss bytes on the serial port. When I use a longer delay, or more delays, it gets worse.

Mouse.move(x,y,w); is limited to +/-127, but I allow larger values in the serial protocol and break it down into smaller increments, because I have to anyway. The goal is for the remote to be able to issue mouseDown(LeftButton), then mouseMove(2048, 0,w)

So I'm stuck between being HID friendly and getting all the data on the serial port it seems.