From ea1ac8a713e2aca5abde5ee062809a293ed375d3 Mon Sep 17 00:00:00 2001 From: sago35 Date: Tue, 6 Feb 2024 08:28:49 +0900 Subject: [PATCH] Add suport for Vial's Matrix tester (#30) --- via.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/via.go b/via.go index 2ccda8a..e29a13a 100644 --- a/via.go +++ b/via.go @@ -166,6 +166,16 @@ func rxHandler2(b []byte) bool { // id_get_keyboard_value Changed = false Changed2 = false + switch txb[1] { + case 0x03: + cols := device.GetMaxKeyCount() + rowSize := (cols + 7) / 8 + for _, v := range device.pressed { + row, _, col := decKey(v) + idx := 2 + row*rowSize + (rowSize - 1) - col/8 + txb[idx] |= byte(1 << (col % 8)) + } + } case 0x05: //fmt.Printf("XXXXXXXXX % X\n", b) //Keys[b[1]][b[2]][b[3]] = Keycode((uint16(b[4]) << 8) + uint16(b[5]))