An audio accessory comprising at least one speaker adapted to provide audio output and a plurality of resistive switches, each switch having a resistive element having a resistance, the audio accessory being coupleable to an electronic device having a bias voltage source adapted to provide power to the resistive switches via an bias resistor, and a measurement module, and when the audio accessory is coupled to the electronic device, the measurement module is adapted to:
- monitor a bias point on a connection between the bias voltage source and the resistive switches to determine when at least one of the switches has been engaged;
- at least once while that switch is engaged, activate and deactivate the bias voltage source, taking a first measurement of the bias point while the bias voltage source is activated and a second measurement of the bias point while the bias voltage source is deactivated;
- determine a ground offset voltage caused by the audio output based on the second measurement;
- compensate for the ground offset voltage caused by the audio output voltage based on a voltage difference between the first and second measurements;
- and
- determine which of switches has been engaged based on the voltage difference.