Thanks for the log.
OK. Let me ask some.
What is your converter's mcu? ATmega32u2, ATmega32u4 or other? I'll build the firmware for you next time.
What is your OS? MacOS, Windows or Linux?
Debug print is enabled by default in current firmware configuration, you don't have to turn it on by hand.
Added some debug prints to see how mouse movement data are processed. Try this patch and post debug log.
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
index ee99d7d5..6b03b71e 100644
--- a/converter/adb_usb/matrix.c
+++ b/converter/adb_usb/matrix.c
@@ -153,10 +153,10 @@ void matrix_init(void)
}
#ifdef ADB_MOUSE_ENABLE
+static uint8_t mouse_handler;
static void mouse_init(void)
{
uint16_t reg3;
- uint8_t mouse_handler;
again:
// Check if there is mouse device at default address 3
@@ -242,6 +242,12 @@ again:
adb_host_flush(ADB_ADDR_MOUSE_TMP);
adb_host_listen(ADB_ADDR_MOUSE_TMP, ADB_REG_3, ((reg3 >> 8) & 0xF0) | ADB_ADDR_0, 0xFE);
goto again;
+ } else if (buf[0] == 0x4B && buf[1] == 0x4F && buf[2] == 0x49 && buf[3] == 0x54) {
+ // https://elixir.bootlin.com/linux/v5.17/source/drivers/macintosh/adbhid.c#L1068
+ dmprintf("Macally2: found\n");
+ adb_host_flush(ADB_ADDR_MOUSE_TMP);
+ adb_host_listen(ADB_ADDR_MOUSE_TMP, ADB_REG_3, (reg3 >> 8), ADB_HANDLER_MACALLY2_MOUSE);
+ mouse_handler = (reg3 = adb_host_talk(ADB_ADDR_MOUSE_TMP, ADB_REG_3)) & 0xFF;
} else {
dmprintf("Unknown\n");
}
@@ -350,6 +356,13 @@ void adb_mouse_task(void)
// b--: Button state.(0: on, 1: off)
// x--: X axis movement.
// y--: Y axis movement.
+ //
+ // Macally2
+ //
+ // Byte 0: b00 y06 y05 y04 y03 y02 y01 y00
+ // Byte 1: b01 x06 x05 x04 x03 x02 x01 x00
+ // Byte 2: 1 0 0 0 1 0 0 0
+ // Byte 3: 1 0 0 0 1 0 0 0
len = adb_host_talk_buf(ADB_ADDR_MOUSE_POLL, ADB_REG_0, buf, sizeof(buf));
// If nothing received reset mouse acceleration, and quit.
@@ -357,7 +370,12 @@ void adb_mouse_task(void)
mouseacc = 1;
return;
};
- dmprintf("[%02X %02X %02X %02X %02X]\n", buf[0], buf[1], buf[2], buf[3], buf[4]);
+
+ //dmprintf("[%02X %02X %02X %02X %02X] %02X\n", buf[0], buf[1], buf[2], buf[3], buf[4], len);
+ xprintf("M:[ ");
+ for (uint8_t i = 0; i < len; i++)
+ xprintf("%02X ", buf[i]);
+ xprintf("]\n");
// Store off-buttons and 0-movements in unused bytes
bool xneg = false;
@@ -365,6 +383,9 @@ void adb_mouse_task(void)
if (len == 2) {
if (buf[0] & 0x40) yneg = true;
if (buf[1] & 0x40) xneg = true;
+ } else if (mouse_handler == ADB_HANDLER_MACALLY2_MOUSE) {
+ if (buf[0] & 0x40) yneg = true;
+ if (buf[1] & 0x40) xneg = true;
} else {
if (buf[len - 1] & 0x40) yneg = true;
if (buf[len - 1] & 0x04) xneg = true;
@@ -376,6 +397,11 @@ void adb_mouse_task(void)
if (xneg) buf[i] |= 0x07;
}
+ xprintf("M:[ ");
+ for (uint8_t i = 0; i < sizeof(buf); i++)
+ xprintf("%02X ", buf[i]);
+ xprintf("]\n");
+
// 8 buttons at max
// TODO: Fix HID report descriptor for mouse to support button6-8
uint8_t buttons = 0;
diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h
index 31c26fb9..578f9883 100644
--- a/tmk_core/protocol/adb.h
+++ b/tmk_core/protocol/adb.h
@@ -95,6 +95,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define ADB_HANDLER_CLASSIC2_MOUSE 0x02
#define ADB_HANDLER_EXTENDED_MOUSE 0x04
#define ADB_HANDLER_TURBO_MOUSE 0x32
+#define ADB_HANDLER_MACALLY2_MOUSE 0x42
// ADB host