Add check_devices function