Fixed Y polarity in the MM Series packet format on the Logitech Serial Mouse.

This commit is contained in:
OBattler
2023-06-19 01:59:33 +02:00
parent a312c10129
commit 8b559f1271

View File

@@ -214,13 +214,14 @@ sermouse_data_mmseries(mouse_t *dev, int x, int y, int b)
dev->data[0] = 0x80;
if (x >= 0)
dev->data[0] |= 0x10;
if (y >= 0)
/* It appears we have inverted Y polarity. */
if (y < 0)
dev->data[0] |= 0x08;
dev->data[0] |= (b & 0x01) ? 0x04 : 0x00; /* left button */
dev->data[0] |= (b & 0x04) ? 0x02 : 0x00; /* middle button */
dev->data[0] |= (b & 0x02) ? 0x01 : 0x00; /* right button */
dev->data[1] = abs(x);
dev->data[2] = abs(y);
dev->data[1] = abs(x) & 0x7f;
dev->data[2] = abs(y) & 0x7f;
return 3;
}