jcsullins: rework headphone switch detection