Moved all debug to dev_dbg macro.
Recoded parse_packet states and key events.

e.g
deb debug rework and corect packet length handeled, with new logic in the parse_packet function.