# Test wired headset detection via software

Since I still don't know whether my problem (call audio doesn't work without headset or speakerphone) is caused by faulty hardware or by software, I'd like to know the following:

Is there a way to tell if the headset switch in the headset jack (which tells the phone app whether a wired headset is connected or not) is working as expected?

I am looking for a solution that doesn't require disassembling the phone before knowing what is actually causing the aforementioned problem. The following idea comes to mind:

Is there a way to display/query/dump the status of the headset detection via ? Maybe something under /dev?

Or are there other ways to tell if Android thinks a wired headphone is currently connected?

By the way, I am running Cyanogenmod version 11-20141112-SNAPSHOT if that makes any difference.

UPDATE

I noticed that stock Android seems to have a "headset icon" to indicate that a headset is connected, but apparently Cyanogenmod doesn't have this (or I accidentally disabled it somehow).

• @Firelord: I edited my question. As I mentioned in my other question, I can see that inserting the headset starts the audio player. What I am after here is a more "static" way to tell the status of the switch, as inserting/removing the headset might cause switch bouncing which could trigger the start of the app but doesn't guarantee that the state is correct when the headset isn't plugged in. – FriendFX Oct 4 '15 at 12:30
• Have you been thorough(sic) with /sys, especially with /sys/devices? Is there anything relevant under /proc/asound/? – Firelord Oct 13 '15 at 20:59
• @Firelord: I don't know how to extract the headphone state from those resources - that would be exactly my question. I'll look into it more, one thing I found already is dumpsys which I imagine could be useful..? – FriendFX Oct 15 '15 at 4:50