Meet my Friend, Jack
How does the OS know when a headset is plugged in? This is a physical jack, so there must be a physical change that is detectable.
Some jacks have normally-closed sense pins that open when you insert a plug. These might be readable as a simple digital I/O – high or low. If you’ve ever wired gadgets onto the GPIO pins of a Raspberry Pi, it’s something like that.
The Librem 14, though, has a normally open sense pin. The plug tip shorts two pins together. The jack’s datasheet has a diagram worth a thousand words...