Added safe casting to log device in keyboard callback.