fixed detection of errors and refactored code

when sending non-raw keys, errors were reported on success and failures
were ignored
report type of key press