Skip to content

Commit

Permalink
ibmpc_usb: Fix error handling #718
Browse files Browse the repository at this point in the history
Error was not recovered properly when it happens before entering to LOOP state
  • Loading branch information
tmk committed May 28, 2022
1 parent 29d5961 commit 27178e9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions converter/ibmpc_usb/ibmpc_usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,18 @@ uint8_t IBMPCConverter::process_interface(void)
if (ibmpc.error) {
xprintf("\n%u ERR:%02X ISR:%04X ", timer_read(), ibmpc.error, ibmpc.isr_debug);

/* Error handling:
* IBMPC_ERR_PARITY Reinit
* IBMPC_ERR_PARITY_AA AT/XT Auto-Switching
* IBMPC_ERR_SEND Ignore
* IBMPC_ERR_TIMEOUT Reinit
* IBMPC_ERR_FULL Ignore
* IBMPC_ERR_ILLEGAL Reinit
* IBMPC_ERR_FF Ignore(not used)
*/
// when recv error, neither send error nor buffer full
if (!(ibmpc.error & (IBMPC_ERR_SEND | IBMPC_ERR_FULL))) {
if (state == LOOP) {
// Reset
state = ERROR;
}
state = ERROR;
if (ibmpc.error == IBMPC_ERR_PARITY_AA) {
// AT/XT Auto-Switching support
// https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-Keyboard-Converter#atxt-auto-switching
Expand Down Expand Up @@ -219,6 +225,7 @@ uint8_t IBMPCConverter::process_interface(void)
case INIT:
xprintf("I%u ", timer_read());
init_time = timer_read();
ibmpc.host_isr_clear();
ibmpc.host_enable();
state = WAIT_SETTLE;
break;
Expand Down

0 comments on commit 27178e9

Please sign in to comment.