[Xperia Play Q&A, Help & Troubleshooting] KenSharp:
Using the stock firmware on my Sony Xperia PLAY, the earphones that came with the phone work no problem.

However, using CM9 or CM10, the earphones only work if the phone is plugged into the dock.

Plugging and unplugging the earphones directly into the phone:

V/WiredAccessoryObserver( 7781): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=65024, DEVPATH=/devices/virtual/switch/h2w, SEQNUM=1864, ACTION=change, SWITCH_NAME=Unsupported}
V/WiredAccessoryObserver( 7781): updateState name: Unsupported state 65024
V/WiredAccessoryObserver( 7781): updateState switchState: 0
E/WiredAccessoryObserver( 7781): unsetting h2w flag
V/WiredAccessoryObserver( 7781): newState = 0, headsetState = 0,mHeadsetState = 0
V/WiredAccessoryObserver( 7781): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=65280, DEVPATH=/devices/virtual/switch/h2w, SEQNUM=1865, ACTION=change, SWITCH_NAME=Device Unknown}
V/WiredAccessoryObserver( 7781): updateState name: Device Unknown state 65280
V/WiredAccessoryObserver( 7781): updateState switchState: 0
V/WiredAccessoryObserver( 7781): newState = 0, headsetState = 0,mHeadsetState = 0
E/WiredAccessoryObserver( 7781): unsetting h2w flag
V/WiredAccessoryObserver( 7781): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=0, DEVPATH=/devices/virtual/switch/h2w, SEQNUM=1866, ACTION=change, SWITCH_NAME=No Device}
V/WiredAccessoryObserver( 7781): updateState name: No Device state 0
V/WiredAccessoryObserver( 7781): updateState switchState: 0
E/WiredAccessoryObserver( 7781): unsetting h2w flag
V/WiredAccessoryObserver( 7781): newState = 0, headsetState = 0,mHeadsetState = 0

Plugging and unplugging while the phone is in the dock:

V/WiredAccessoryObserver( 7781): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=2, DEVPATH=/devices/virtual/switch/h2w, SEQNUM=1879, ACTION=change, SWITCH_NAME=Headphone}
V/WiredAccessoryObserver( 7781): updateState name: Headphone state 2
V/WiredAccessoryObserver( 7781): updateState switchState: 2
V/WiredAccessoryObserver( 7781): newState = 2, headsetState = 2,mHeadsetState = 1
V/WiredAccessoryObserver( 7781): device Headphone disconnected
I/HeadsetService( 8650): Headset=true; Bluetooth=false
V/WiredAccessoryObserver( 7781): device Headphone connected

(Snip: a bunch of apps get excited)

I/AudioHardware7x30( 7651): Routing audio to Speakerphone
D/AudioHardware7x30( 7651): new_rx = 6
D/AudioHardware7x30( 7651): new_tx = 12
E/AudioHardware7x30( 7651): updateDeviceInfo: E rx_device 2 and tx_device 3
D/AudioHardware7x30( 7651): No active voicecall/playback, disabling cur_rx 4
D/AudioHardware7x30( 7651): value of device and enable is 4 0 ALSA dev id:2
D/AudioHardware7x30( 7651): No active voicecall/recording, disabling cur_tx 5
D/AudioHardware7x30( 7651): value of device and enable is 5 0 ALSA dev id:4
E/AudioHardware7x30( 7651): updateDeviceInfo: X cur_rx 2 cur_tx 3
D/AudioHardware7x30( 7651): setVoiceVolume(0.800000)
I/AudioHardware7x30( 7651): Setting in-call volume to 80 (available range is 0 to 100)
E/AudioHardware7x30( 7651): msm_set_voice_rx_vol(80) failed errno = 1
I/AudioHardware7x30( 7651): Routing audio to No microphone Wired Headset (0,8)
D/AudioHardware7x30( 7651): new_rx = 2
D/AudioHardware7x30( 7651): new_tx = 1
E/AudioHardware7x30( 7651): updateDeviceInfo: E rx_device 4 and tx_device 1
D/AudioHardware7x30( 7651): No active voicecall/playback, disabling cur_rx 2
D/AudioHardware7x30( 7651): value of device and enable is 2 0 ALSA dev id:6
D/AudioHardware7x30( 7651): No active voicecall/recording, disabling cur_tx 3
D/AudioHardware7x30( 7651): value of device and enable is 3 0 ALSA dev id:12
E/AudioHardware7x30( 7651): updateDeviceInfo: X cur_rx 4 cur_tx 1
D/AudioHardware7x30( 7651): setVoiceVolume(0.600000)
I/AudioHardware7x30( 7651): Setting in-call volume to 60 (available range is 0 to 100)
E/AudioHardware7x30( 7651): msm_set_voice_rx_vol(60) failed errno = 1
[snip]
I/HeadsetService( 8650): Headset=false; Bluetooth=false
I/HeadsetService( 8650): Selected configuration: speaker
I/HeadsetService( 8650): Headset=true; Bluetooth=false
I/HeadsetService( 8650): Selected configuration: headset
[snip]
V/WiredAccessoryObserver( 7781): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=0, DEVPATH=/devices/virtual/switch/h2w, SEQNUM=1880, ACTION=change, SWITCH_NAME=No Device}
V/WiredAccessoryObserver( 7781): updateState name: No Device state 0
V/WiredAccessoryObserver( 7781): updateState switchState: 0
V/WiredAccessoryObserver( 7781): newState = 0, headsetState = 0,mHeadsetState = 2
V/WiredAccessoryObserver( 7781): device No Device disconnected
I/HeadsetService( 8650): Headset=true; Bluetooth=false
I/AudioHardware7x30( 7651): Routing audio to Speakerphone
D/AudioHardware7x30( 7651): new_rx = 6
D/AudioHardware7x30( 7651): new_tx = 12
E/AudioHardware7x30( 7651): updateDeviceInfo: E rx_device 2 and tx_device 3
D/AudioHardware7x30( 7651): No active voicecall/playback, disabling cur_rx 4
D/AudioHardware7x30( 7651): value of device and enable is 4 0 ALSA dev id:2
D/AudioHardware7x30( 7651): No active voicecall/recording, disabling cur_tx 1
D/AudioHardware7x30( 7651): value of device and enable is 1 0 ALSA dev id:1
E/AudioHardware7x30( 7651): updateDeviceInfo: X cur_rx 2 cur_tx 3
D/AudioHardware7x30( 7651): setVoiceVolume(0.800000)
I/AudioHardware7x30( 7651): Setting in-call volume to 80 (available range is 0 to 100)
E/AudioHardware7x30( 7651): msm_set_voice_rx_vol(80) failed errno = 1
I/HeadsetService( 8650): Headset=false; Bluetooth=false
I/HeadsetService( 8650): Selected configuration: speaker

Can anyone help? I need my phone to recognise my headphones. Very odd that it doesn't.

Current setup:

TIA