9. A device comprising: one or more processors; one or more computer-readable storage media; an accessory port configured to receive a connector for an accessory device; and instructions stored on computer-readable storage media that when executed by the one or more processors cause the device to perform operations including: detecting insertion of the connector into the accessory port based on detection pin signals conveyed via a plurality of detection pins of the connector; obtaining a logic state of the detection pin signals; determining a type of the accessory device based upon the obtained logic state of the detection pin signals; ascertaining an orientation of the connector inserted in the accessory port by: when the accessory device is a one-wire type device, determining the orientation of the connector directly from the logic states of the detection pin signals; or when the accessory device is a two-wire type device, measuring values of identity resistors exposed by the accessory device via the detection pin signals, and determining the orientation of the connector based on predetermined valid values of the measured values of the identity resistors; and configuring signal routing to pins of the accessory port according to the determined type of the accessory device and the ascertained orientation.
11. The device of claim 9 , wherein a two-wire type device is a device that communicates via receive and transmit signals conveyed over separate lines.