Detecting device before printing its name (logic).