Turn your mic jack into a headphone jack!

Posted on 2011-11-29 by David Henningsson

Most of today’s built-in sound cards are to some degree retaskable, which means that they can be used for more than one thing. That means you can turn your Mic jack into an extra Headphone jack, or why not make them both line outs, and connect them to your surround receiver?

I’ve known for a while that the kernel exposes an interface that makes it possible to retask your jacks, but almost no one seems to use it, or even know about it. So over the past few weeks I’ve been working (from time to time) with HDA-Jack-Retask, a small application that makes this interface easy to use.

Although primarily meant for power users, it focuses on simplicity: Just select your codec, then select which pins you want to override and what you want them to override to: Headphones, Line Out, Mic, Line In, and so on. There are buttons for trying it out right away, and for making your override the boot-time default. And of course, a button for removing all overrides in case things did not go as planned.

Consider it beta quality for now, and it’s one of those “won’t work for everyone” programs, but that’s mostly due to hardware and driver limitations.

It’s available for Ubuntu 11.10, and you can install it by adding ppa:diwic/hda and then installing the hda-jack-retask package. Start it by running “hda-jack-retask” in a terminal. Enjoy!

spacer

This entry was posted in Uncategorized and tagged ubuntu. Bookmark the permalink.

18 Responses to Turn your mic jack into a headphone jack!

  1. spacer Tomáš says:
    2011-11-29 at 22:37

    Hi, this looks great (i.e. solving the use case af watching a movie in a bus/plane in two people).
    I have three remarks:
    1) Is not the mic usualy red? At least I always thought it was. But maybe I am colorblind/my computer is nonstandard.
    2) If my microphone allows only microphone/Internal mic/Not connected, is that a hardware issue (codec is Conexant cx20561)?
    3) It does not have an icon,but you probably know that:-)
    And one more: upon Restore boot default, it says via a dialog:

    rm: cannot remove `/etc/modprobe.d/hda-jack-retask.conf’: No such file or directory
    rm: cannot remove `/lib/firmware/hda-jack-retask.fw’: No such file or directory

    • spacer David Henningsson says:
      2011-11-30 at 08:04

      Hi there and thanks for beta testing!
      1) No, I’d say Pink is more common. Nevertheless, what color is shown in the GUI, is what BIOS tells the program. AFAIK, the “color” and “location” fields are not used that much by any operating system, so sometimes the BIOS writers don’t care about setting it the right way. On my laptop, both jacks (headphone and mic) are black, but yet they show up as “Pink” and “Green”.
      2) Yes, I try my best to limit the options to what the hardware actually supports, in order not to give options that would not work anyway.
      3) Yes. Maybe I’ll draw one, one day spacer
      4) This is because you have not installed a boot default, so there is nothing to remove. Maybe I could check for the files being present before trying to remove them. Come to think of it, maybe the name of the button is ambiguous? What I mean “make sure no boot time override is installed”, but maybe you interpreted it as “restore right now to what was the boot time default”?

      • spacer Tomáš says:
        2011-11-30 at 10:33

        4) I tried playing with advanced override (what if you got it wrong and it actually supported the headphone – well, you got it right:-)) and yes, I thought “Restore boot default” would revert any changes I did.

  2. spacer foo says:
    2011-11-30 at 02:34

    How about putting that into pulseaudio??!

    • spacer David Henningsson says:
      2011-11-30 at 08:16

      The way the kernel interface and PulseAudio are structured today, this would be quite difficult (although not impossible). That said, if this is shown to be popular, maybe one could consider having a GUI alongside PulseAudio’s volume control, where you could do things like this.
      I’m a little hestitant to over-promising though. There might be hardware limitations we can’t detect, e g the system manufacturer might decide to add some de-pop capacitors to the headphone out. Maybe that makes the jack unusable as a microphone jack, even though the codec supports it. Due to these things, maybe we need to always have a “Experimental” watermark over these functions.

  3. spacer dt2g says:
    2011-11-30 at 04:00

    This is amazing! It works perfectly on my Sony Vaio laptop and its Realtek ALC275, which is awesome because I never plug in external mics and having another headphone jack is 100x as useful. Keep up the excellent work!

  4. spacer Mackenzie says:
    2011-11-30 at 16:10

    Cool! I remember Dan Chen telling me about that kernel interface when explaining a bit about codecs, but having a way to *actually use it* rocks!

  5. spacer CruelAngel says:
    2011-12-04 at 14:22

    Could this app be backported to Natty (or Maverick even)?

    • spacer David Henningsson says:
      2011-12-04 at 17:51

      Maverick is not possible without a substantial rewrite – I used the GTK3 library, which is not in maverick. But I just did an no-change upload to my ppa for Natty. Let us see if it compiles. If it does, please test it and let me know if it works spacer

      Do know, however, that the HDA drivers improve over time, and so there might be driver improvements between Natty and Oneiric, that could make your use case to work in Oneiric but not in Natty.

      • spacer CruelAngel says:
        2011-12-04 at 22:07

        Thanks for the fast reply, it seems that it failed to build on natty.

        Actually it’s not really that important (especially on Maverick). I use Natty on my desktop, because compiz seem to have a weird bug with Oneric, and I use Maverick on my lappy, because that was the only version I succesfully managed to build and use bumblebee (the Optimus chipset driver thing), and still use compiz.
        On my desktop there’s a weird bug, that actually made everything quiter. (I have to use the boost in the sound preferences window even with max volume on my speekers, for normal volume levels.) I was curious what would happen if I messed around with your app.
        So yeah, I would gladly test it, but it’s not that terrible important or urgent. spacer

  6. spacer Ted says:
    2011-12-15 at 07:51

    I can only say thanks!

    My eeepc ha-1000 running 11.10 Ubuntu is happy to let me set the microphone jack to an audio jack!

    It even recognizes that a headphone has been plugged in and shuts off the internal speaker!

    I found that the best setting for me was to set the microphone jack to ‘front’. Rear did not have the same audio level.

    Hat’s off to you.

    Ted

  7. spacer carchaias says:
    2012-02-10 at 09:52

    Thanks for that tool. I unfortunatly cant use it. When clicking on “Apply now” it takes a Moment and then it gives me a Error that “The Device is in use” or so.
    I have a Asus A5ION Board with ALC887 onboard Sound and Mythbuntu 11.10

    • spacer David Henningsson says:
      2012-02-10 at 09:59

      You can solve this problem in two ways:
      1) either try figuring out what is currently using the sound card; by running “sudo fuser -v /dev/snd/*” you should get a hint of what’s keeping your sound card busy (and then make sure that application is not running when you click “Apply now”)

      or 2) you can still use the boot-time default override (i e the install/remove buttons), and test by rebooting.

  8. spacer Terry says:
    2012-02-20 at 05:39

    Excellent utility. Thank you. The version my chip-maker supplies (which is Windows-only) also has the option to swap LFE/Center. Could that be added – or is there a way to do it now and I’ve missed it? If not, I can always break out the soldering iron and re-purpose a patch-cord.

    Thanks again. Gotta love open-source.

    • spacer David Henningsson says:
      2012-02-20 at 05:59

      Thanks for the feedback! Unfortunately, there is no easy way to swap Center and LFE. I believe the common standard to be Center on the Left/White/Tip and LFE on the Right/Red/Ring.

      As for the soldering iron; if you want to avoid it:
      Assuming you’re having a 3.5 mm connection on both sides, you can buy one 3.5 mm to 2 x RCA female cable and one 3.5 mm to 2 x RCA male, and connect the RCA male to the RCA female but swap the channels by connecting red to white and white to red.

  9. spacer Kyun says:
    2012-02-20 at 13:46

    Hi David, love your program. I had such a pain with my HP-dv7, trying desperately to get its subwoofer to work. This program just may be a solution for me.
    But there are two issues.
    First issue is that I cannot apply the override, and it is telling me that the “deamon cannot be killed.” I have checked with “sudo fuser -v /dev/snd/*”, and it returned pulseaudio, which I cannot kill.
    Second issue is when I try to “set as boot default”, it returns the error message “/tmp/hda-jack-retask-E8JBAW/script.sh: 1: !#/bin/sh: not found”.
    Is it possible for you to suggest me a workaround?
    (I am a newbie with Oneiric Ocelot.)

    Cheers. Best.

    Kyun

    • spacer David Henningsson says:
      2012-02-20 at 14:30

      Hi Kyun!

      For the unkillable PulseAudio, maybe the PulseAudio is not running as another user, or in system-wide mode? It’s difficult to help you without really knowing.

      The second one looks like a typo (!#/bin/sh should be #!/bin/sh ), but why that is failing for you and nobody else seems strange. (Maybe try “sudo apt-get install –reinstall dash” as that’s the one providing /bin/sh ?)
      Will fix the typo anyway.

  10. spacer Cedric Mamo says:
    2012-03-05 at 18:42

    THANK YOU!

    I’ve been using ubuntu exclusively for years and have never managed to get it to work… this program fixed it in seconds… i can now start using my surround setup again after all these years spacer

    Thanks again!