From e473e8ce2fbb0869eaf8193fb908092b9a3f6caa Mon Sep 17 00:00:00 2001 From: tmk Date: Mon, 16 Nov 2020 11:32:53 +0900 Subject: [PATCH] ibmpc_usb: Add info to debug print --- converter/ibmpc_usb/ibmpc_usb.c | 3 ++- converter/ibmpc_usb/ibmpc_usb.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/converter/ibmpc_usb/ibmpc_usb.c b/converter/ibmpc_usb/ibmpc_usb.c index 9347793f..6d22ad73 100644 --- a/converter/ibmpc_usb/ibmpc_usb.c +++ b/converter/ibmpc_usb/ibmpc_usb.c @@ -174,6 +174,7 @@ uint8_t matrix_scan(void) xprintf("I%u ", timer_read()); keyboard_kind = NONE; keyboard_id = 0x0000; + current_protocol = 0; matrix_clear(); clear_keyboard(); @@ -311,7 +312,7 @@ uint8_t matrix_scan(void) keyboard_kind = PC_AT; } - xprintf("\nID:%04X(%d) ", keyboard_id, keyboard_kind); + xprintf("\nID:%04X(%s) ", keyboard_id, KEYBOARD_KIND_STR(keyboard_kind)); state = SETUP; break; diff --git a/converter/ibmpc_usb/ibmpc_usb.h b/converter/ibmpc_usb/ibmpc_usb.h index 86ebe17d..e08be6e4 100644 --- a/converter/ibmpc_usb/ibmpc_usb.h +++ b/converter/ibmpc_usb/ibmpc_usb.h @@ -2,6 +2,13 @@ #define IBMPC_USB_H typedef enum { NONE, PC_XT, PC_AT, PC_TERMINAL, PC_AT_Z150 } keyboard_kind_t; +#define KEYBOARD_KIND_STR(kind) \ + (kind == PC_XT ? "XT" : \ + kind == PC_AT ? "AT" : \ + kind == PC_TERMINAL ? "TERMINAL" : \ + kind == PC_AT_Z150 ? "AT_Z150" : \ + "NONE") + extern uint16_t keyboard_id; extern keyboard_kind_t keyboard_kind; -- 2.46.2