|
|
@ -156,8 +156,15 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) |
|
|
|
mouse_report->x = X_IS_NEG ? ((!X_IS_OVF && -127 <= mouse_report->x && mouse_report->x <= -1) ? mouse_report->x : -127) : ((!X_IS_OVF && 0 <= mouse_report->x && mouse_report->x <= 127) ? mouse_report->x : 127); |
|
|
|
mouse_report->y = Y_IS_NEG ? ((!Y_IS_OVF && -127 <= mouse_report->y && mouse_report->y <= -1) ? mouse_report->y : -127) : ((!Y_IS_OVF && 0 <= mouse_report->y && mouse_report->y <= 127) ? mouse_report->y : 127); |
|
|
|
|
|
|
|
#ifdef PS2_MOUSE_INVERT_BUTTONS |
|
|
|
// swap left & right buttons |
|
|
|
uint8_t needs_left = mouse_report->buttons & PS2_MOUSE_BTN_RIGHT; |
|
|
|
uint8_t needs_right = mouse_report->buttons & PS2_MOUSE_BTN_LEFT; |
|
|
|
mouse_report->buttons = (mouse_report->buttons & ~(PS2_MOUSE_BTN_MASK)) | (needs_left ? PS2_MOUSE_BTN_LEFT : 0) | (needs_right ? PS2_MOUSE_BTN_RIGHT : 0); |
|
|
|
#else |
|
|
|
// remove sign and overflow flags |
|
|
|
mouse_report->buttons &= PS2_MOUSE_BTN_MASK; |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef PS2_MOUSE_INVERT_X |
|
|
|
mouse_report->x = -mouse_report->x; |
|
|
|