validate_device function

Validate device and get default device