Auto detection of type of device using single wire two-way communication