Detect device and set configuration respectively.