Do not test KBD_FLAGS_DOWN, this only indicates key repeat. Check for the absence of KBD_FLAGS_RELEASE