Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have got new earphones, the AKG K318's to be exact and they have one of those remotes. On a smartphone, such as an Android phone or iPhone, the buttons map to actions on the music player such as play/pause, volume up/down, skip, previous, you get the idea.

I was wondering how I could replicate the same function on my computer.

I imagine the process consists of getting X to recognize the input, and then somehow mapping those inputs for an application to use.

The "device" (which would connect via sound jack) isn't listed in xinput, nor do the buttons trigger regular keyboard events.

How can I use the earphones plugged in the output sound jack as X key inputs?

share|improve this question

2 Answers 2

up vote 29 down vote accepted

Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.

The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).

Four buttons might use four resistances (of any unit):

volume up:   1 ohm
volume down: 2 ohms
stop:        4 ohms
play:        8 ohms

If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!

Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.

But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)

share|improve this answer
4  
and yes, I take ALL my toys apart... –  lornix Jun 30 '12 at 8:21
4  
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms. –  Ignacio Vazquez-Abrams Jun 30 '12 at 9:14
2  
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me. –  lornix Jun 30 '12 at 9:23
    
Just keeping answers honest is all. –  Ignacio Vazquez-Abrams Jun 30 '12 at 9:24
    
and I love ya for it! {chuckle} quit following me!! –  lornix Jun 30 '12 at 9:25

There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.