Reduce variable scopes

Signed-off-by: Ran Benita <ran234@gmail.com>
keycodes: use correct printf format

Signed-off-by: Ran Benita <ran234@gmail.com>