Skip to content

Commit

Permalink
adb_usb: Fix for MacTRAC 2.0(old firmware)
Browse files Browse the repository at this point in the history
Buttons works as below:
Left button: Left Click
Center button: Drag Lock
Right button: Right Click
  • Loading branch information
tmk committed Oct 26, 2023
1 parent f25df07 commit bd6e208
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions converter/adb_usb/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,29 @@ static uint8_t mouse_proc(uint8_t addr)
if (buf[1] & 0x40) xneg = true;
// Ignore Byte2 and 3
len = 2;
} else if (mouse_handler == ADB_HANDLER_MICROSPEED_MACTRAC ||
} else if (mouse_handler == ADB_HANDLER_MICROSPEED_MACTRAC && len == 2) {
// MacTRAC 2.0 old firmware
// https://github.com/tmk/tmk_keyboard/issues/725#issuecomment-1779462409
// Byte0: b00 y06 y05 y04 y03 y02 y01 y00
// Byte1: b01 x06 x05 x04 x03 x02 x01 x00
// left button: b00=0, b01=1
// right button: b00=0, b01=0
// center button: Drag Lock
if (buf[0] & 0x40) yneg = true;
if (buf[1] & 0x40) xneg = true;
len = 2;

uint16_t packet = (buf[0] << 8) | buf[1];
// right button
if ((packet & 0x8080) == 0x0000) {
buf[0] |= 0x80;
buf[1] &= ~0x80;
} else {
buf[1] |= 0x80;
}
} else if ((mouse_handler == ADB_HANDLER_MICROSPEED_MACTRAC ||
mouse_handler == ADB_HANDLER_MICROSPEED_UNKNOWN ||
mouse_handler == ADB_HANDLER_CONTOUR_MOUSE) {
mouse_handler == ADB_HANDLER_CONTOUR_MOUSE) && len >= 3) {
// Microspeed:
// Byte0: ??? y06 y05 y04 y03 y02 y01 y00
// Byte1: ??? x06 x05 x04 x03 x02 x01 x00
Expand Down

0 comments on commit bd6e208

Please sign in to comment.