How to determine whether the connectors on the sound card or not?

The moment of connection / disconnection is caught through acpi_listener without problems, and you can hang a script on this event that mutes the sound in the speakers when headphones are connected to the front connector, but I cannot understand how to check the current status.

    1 answer 1

    According to this answer , information can be gathered from the files /proc/asound/card*/codec#* .

    An example from this answer:

    headphones connected:

     $ cat /proc/asound/card0/codec#0 [...] Node 0x0d [Pin Complex] wcaps 0x400181: Stereo Control: name="Speaker Phantom Jack", index=0, device=0 Pincap 0x00000014: OUT Detect Pin Default 0x90170110: [Fixed] Speaker at Int N/A Conn = Analog, Color = Unknown DefAssociation = 0x1, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x00: [...] 

    Headphones are disabled (compare the lines about Pin-ctls ):

     $ cat /proc/asound/card0/codec#0 [...] Node 0x0d [Pin Complex] wcaps 0x400181: Stereo Control: name="Speaker Phantom Jack", index=0, device=0 Pincap 0x00000014: OUT Detect Pin Default 0x90170110: [Fixed] Speaker at Int N/A Conn = Analog, Color = Unknown DefAssociation = 0x1, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT [...]