state machine for reading scancodes