Skip to content

Commit 108a9a2

Browse files
Merge pull request #9 from sweetlilmre/wheel_bit
Fix wheel mouse 3rd button bit.
2 parents 4e8877b + c3b3580 commit 108a9a2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

firmware/include/serial.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ void postSerialMouse() {
172172
packet[1] = ( 0x00 | (mouse_data.mpkt.x & 0x3F));
173173
packet[2] = ( 0x00 | (mouse_data.mpkt.y & 0x3F));
174174

175+
// according to: https://sourceforge.net/p/cutemouse/trunk/ci/master/tree/cutemouse/PROTOCOL.TXT
176+
// for a wheel mouse, the middle button should be reported in bit 0x10
177+
// for a 3-button mouse, the middle button should be reported in bit 0x20
175178
if ( mouse_data.persistent.mousetype == WHEELBTN ){ // Add Wheel Data + Third Button
176-
packet[3] = (0x00 | (mouse_data.mpkt.middle ? 0x20 : 0) | (-mouse_data.mpkt.wheel & 0x0f));
179+
packet[3] = (0x00 | (mouse_data.mpkt.middle ? 0x10 : 0) | (-mouse_data.mpkt.wheel & 0x0f));
177180
serial_putc(packet, 3);
178181
}
179182
else if ( mouse_data.persistent.mousetype == THREEBTN ){ // Add Third Button

0 commit comments

Comments
 (0)