aboutsummaryrefslogtreecommitdiff
path: root/protocol/serial_mouse_microsoft.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/serial_mouse_microsoft.c')
-rw-r--r--protocol/serial_mouse_microsoft.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c
index f83036a31..54fedae77 100644
--- a/protocol/serial_mouse_microsoft.c
+++ b/protocol/serial_mouse_microsoft.c
@@ -27,6 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
27#include "print.h" 27#include "print.h"
28#include "debug.h" 28#include "debug.h"
29 29
30#ifdef MAX
31#undef MAX
32#endif
33#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
34
30static void print_usb_data(const report_mouse_t *report); 35static void print_usb_data(const report_mouse_t *report);
31 36
32void serial_mouse_task(void) 37void serial_mouse_task(void)
@@ -91,8 +96,8 @@ void serial_mouse_task(void)
91 report.y = ((buffer[0] << 4) & 0xC0) | buffer[2]; 96 report.y = ((buffer[0] << 4) & 0xC0) | buffer[2];
92 97
93 /* USB HID uses values from -127 to 127 only */ 98 /* USB HID uses values from -127 to 127 only */
94 report.x = report.x < -127 ? -127 : report.x; 99 report.x = MAX(report.x, -127);
95 report.y = report.y < -127 ? -127 : report.y; 100 report.y = MAX(report.y, -127);
96 101
97#if 0 102#if 0
98 if (!report.buttons && !report.x && !report.y) { 103 if (!report.buttons && !report.x && !report.y) {