[MOD] USB Audio Support

Search This thread

henrylar

Senior Member
Feb 8, 2008
211
41
faux kernel works

Thanks for all your hard work. It's great to see progress on this.

I tried on my Nexus 7 running the latest Faux kernel, stock 4.2.1 ROM. I plugged in a generic USB headset, with volume controls and a power on//off button. When you first plug it in, the volume buttons actually controls the Nexus 7 volume sliders! Very cool. But when you power the headset off and back on, it loses the ability.

As mentioned in the thread, hotplugging doesn't work. When you boot up with the USB headset connected, it works great.

Thank you Yukster. The Faux kernel works fine on top of stock 4.2.1 and I get a signal through to the Fiio E17.When I install the two files, volume up and down at the n7 works, but I have to start with the USB attached before I start tne N7 . I can remove and put in again the usb wire. It does not freeze the N7, and it works again at the Fiio when I attach the USB, but there is no sound in the N7. So the volumen control works, but the services does not work.
 

henrylar

Senior Member
Feb 8, 2008
211
41
I'm still working on an alternative method to distribute the patch as clearly the services.jar file replacement isn't working across devices or roms.
I will post most information soon.

I am really looking forward to that. It would be so wonderful. May I propose that you take a look at the combination of stock 4.2.1 and as an example the faux kernel for making it work
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
allows the internal microphone to operate properly while connected. As long as you have a standard USB AUDIO CLASS compliant device then you should have no problems.

Have you seen this new app yet?

http://www.extreamsd.com/USBAudioRecorderPRO/

https://play.google.com/store/apps/details?id=com.extreamsd.usbaudiorecorderpro

The Android app USB Audio Recorder PRO allows you to record and playback audio using class-compliant USB audio devices on your Android phone or tablet! eXtream Software Development has written a custom USB audio driver from scratch because Android does not support USB audio (even Android 4.1 contrary to popular believe!).

Would be wicked cool if we could output music audio to our DAC's and also be able to use the same USB OTG connection for phone calls where the call audio is output via the digital and then allows our voices to be picked up by USB Microphones.

---------- Post added at 01:16 AM ---------- Previous post was at 12:36 AM ----------

I posted about your progress over at the HUGE Android+DAC thread:

http://www.head-fi.org/t/595071/android-phones-and-usb-dacs/300#post_8700170
 
Last edited:

henrylar

Senior Member
Feb 8, 2008
211
41
Have you seen this new app yet?

http://www.extreamsd.com/USBAudioRecorderPRO/

https://play.google.com/store/apps/details?id=com.extreamsd.usbaudiorecorderpro



Would be wicked cool if we could output music audio to our DAC's and also be able to use the same USB OTG connection for phone calls where the call audio is output via the digital and then allows our voices to be picked up by USB Microphones.

---------- Post added at 01:16 AM ---------- Previous post was at 12:36 AM ----------

I posted about your progress over at the HUGE Android+DAC thread:

http://www.head-fi.org/t/595071/android-phones-and-usb-dacs/300#post_8700170

It works fine as player. You do not need to restart the N7. It claims to be able to play 96/24 files, but that does not work - yet at least. However, since it is a recording program, it is not very convenient as music player, but maybe there is an inspiration for our guy here :)
 

MetalMan2

Senior Member
May 25, 2012
145
39
a24 kernel now supports USB hot plug support :) will test tomorrow if this works.

http://xdaforums.com/showthread.php?t=1937146&highlight=dac

//Mike

Nowhere in the description in the M-Kernel thread does it suggest that it has USB audio enabled.

EDIT: Nevermind, he lists the following:
Metallice said:
New Features:

Note: since there hasn't been a "stable" kernel yet, these are based on an alpha version. May be outdated.
Note 2: Some of the listed features may be planned features for the first stable version that may not be included yet, knowledge of which will not incfluence testing.
Note 3: Many added features/changes in latest alpha and planned features not yet incorporated intentionally left out of this list as to not influence alpha testing.
Note 3.1: Once we have a stable version, NO alpha changes will be listed here.

No speaker popping or bootup issues
Updated to latest 4.1.2 kernel source from AOSP.
Included ramdisk with optimized mount options such as discard and noauto_da_alloc (no need for init.d scripts to enable anymore)
Included ramdisk with optimized VM settings
Additional compiler and build optimizations as well as the removal of some motley included that have a negative impact on the kernel.
Removed pointless pixel clock increase which has no effect on performance. Decreases battery life and can cause screen tearing or pink color distortion. Only improved benchmarks on GPU tests where the N7 was already scoring at maximum 60FPS like quadrant or nenamark 2 by pointlessly increasing screen refresh rate.
Reworked default voltage table to be closer to the ones provided by Nvidia (_motley's were much higher than needed for 1.0Ghz and above)
LP core (AKA Low-Power or companion core) overclock up to 666Mhz to theoretically improve battery life and performance in low cpu-usage, single-threaded apps like media playback or web browsing.
USB DAC support
OTG peripheral/host mode charging
HFS support for the Mac users.
Custom User definable GPU OC
Runnable threads hotplug on top of regulate tegra auto-hotplug
TCP advanced congestion control with multiple algorithm options. Set to Westwood+ by default.

So it does support USB audio.
 
Last edited:

ElJimador

New member
Dec 19, 2012
1
0
While we all wait with bated breath, a couple of questions/ideas:

  1. Have you submitted your changes to Cyanogen Mod or AOSP?
  2. Would you be willing to provide your changes as a source patch for those of us willing to build stuff from source?

If you'll provide a source patch I'd like to try integrating it into the ROM I'm using on my Galaxy Nexus and maybe my Nexus 10. In the long run I'd like USB audio to be well supported in stock Android, and even if they reject your patch it might provide a helpful push. Widespread support in custom roms (or even just out-of-the-box support on some ROMs) would be a boon for everyone wanting to use a DAC with their Android device, and helps show community interest.
 

MetalMan2

Senior Member
May 25, 2012
145
39
yes. but you have to boot with DAC USB OTG. not hotplug it

One of the primary points of this thread is regarding hotplugging USB DACs on the Nexus 7. So if you say that a kernel allows hotplugging (in this thread) then I'd guess that it has something to do with USB audio. USB audio is what this thread is all about.

And Metallice confirmed that his kernel only supports hotplugging USB flash drives, which is perhaps not very useful to this thread.
 

mkmonkey

Senior Member
Jul 5, 2007
139
9
One of the primary points of this thread is regarding hotplugging USB DACs on the Nexus 7. So if you say that a kernel allows hotplugging (in this thread) then I'd guess that it has something to do with USB audio. USB audio is what this thread is all about.

And Metallice confirmed that his kernel only supports hotplugging USB flash drives, which is perhaps not very useful to this thread.

After wiping and upgrading the whole N7 , I've finally make the system support for USB DAC audio output . It never works before .

But the result is more then expected . As mentioned by others before , the USB DAC will not work anymore if the cable is disconnected . Reboot is required even a very temporary disconnection . However , now my system can unplug the USB DAC , and work again once the cable re-connect .

**UDPATE**
Only works if the system did not goto sleep . After power on the device again the hotplug function is gone .

Configuration :
M-Kernel a25
XenonHD Stable-1
N7 16GB
 
Last edited:

jacknorris

Senior Member
Nov 8, 2010
55
83
Sorry for the lack of updates, Christmas was busier than I expected...

I am still working on a more reliable patch method, the tests so far appear to work rather well so far across devices and roms. I will post more updates later but it may not be today unfortunately.
 

mkmonkey

Senior Member
Jul 5, 2007
139
9
Thanks for your work ! Is it possible to release a patch so people using ROMs other then CM10 can be patch them individually ?
 

CynicalMushroom

Senior Member
Dec 1, 2012
129
41
Just gonna bump this thread as I find it very intresting, been looking for a ROM/Mod/Kernel that supports USB Audio on the GS3 that isn't stock or ICS since before X-mas. If I've missed any, please let me know.
 

Darkii89

Member
Nov 24, 2012
16
3
how did you edit services.jar,i want to try to modify services.jar for my note 2 and see if my usb dac work with this mod

tried to convert it to .java files and edit the lines , convert it to .class then to .dex

but in process of converting .java to .class i got error >_>

pls help >< :(
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
If there is a chance this fix will work on the USA based Galaxy S III CM10.1, I would happily donate $50 to the cause. :)

I know a lot of other folks who would be absolutely thrilled also!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 35
    Nexus 7 USB Audio Support

    I originally started looking into this as part of my Nexus 7 car project. Rebooting just to get USB audio working conflicted with my goal of being able to "dock and forget". It took a bit of experimenting and debugging but it's finally working
    wink2.png


    This program should enable USB audio support on your Nexus 7 - that means you are able to plug and unplug a USB sound card without having to reboot in order for it to work. Other devices should also work but I have not been able to fully test.

    It works by downloading your devices services.jar which is then extracted and de-odexed if required. The necessary classes are then patched and a new services.jar is packaged up, re-odexed, re-signed and finally re-uploaded to your device. The previous method replaced the entire services.jar which turned out to be a really bad idea!

    As always please let me know of any issues you stumble upon. The patching software was written quickly so there will most likely be bugs!

    Instructions


    1. Obtain a full backup of your device. This patch is experimental.
    2. Ensure your device is ADB enabled, rooted and has busybox installed.
    3. Make sure your PC has Java and .NET 4 installed.
    4. Download usb-audio-patcher below and extract to a folder.
    5. Run usb-audio-patcher.exe, the software will guide you through the rest of the process.
    6. Flash a kernel with USB audio support. Nexus 7 Wifi kernels can be found below although any kernel with USB audio support will work.

    Downloads

    Software
    [Windows] usb-audio-patcher-1.1.zip.

    Kernels
    [N7 CM10 / Stock 4.1.2] cm-10-n7-wifi-usb-audio-kernel.zip
    [N7 CM10.1 / Stock 4.2.1] cm-10.1-n7-wifi-usb-audio-kernel.zip
    [Timurs N7 Kernel] http://rootzwiki.com...ment-usb-audio/

    Misc
    [Volume Control] n7-volume-control-patch.zip - Allow media volume control when USB audio device is connected.
    8
    Working USB DAC solution for KitKat!

    Here's a small New Year present to all audio lovers!

    This patcher was originally developed by JackNorris and was later modified by _crue_ - many thanks!
    However, 4.4.zip patch disabled headphone functionality. So I ripped contents of WiredAccessoryManager from Timur's USB-ROM and updated 4.2 and 4.4 zips with them.

    Results:

    1. USB DAC hotplug works!
    2. Switching between internal speakers and DAC - works!
    3. Once headphones are plugged in, sound switches from speakers or DAC to them - works!
    4. No volume control for USB DAC - this requires another patch for AudioPolicyManagerBase.cpp before ROM compilation (http://xdaforums.com/showthread.php?t=2222374&page=93 post #928 - again, all credits to JackNorris). I do not have the environment to build my own ROM...

    It's strange that FineVolumeControl app is able to control DAC volume.

    As of now, it's a partial success, but hope is not lost! Please look for 1st post in this thread for instructions.

    Tested with Oxydo v15 version 1 (BTW, v1 boot failure can be caused by different SEPOLICY binary in CM11 and AOSP ROMs, binary from latest CM11 kernel works even if installed in AOSP kernel ramdisk) and CM11 nightly from 12/25.

    Credits:

    To JackNorris and _crue_ for the patcher
    To Timur Mehrvarz for his tremendous development work on USB ROM.

    Happy New Year!

    P.S. Additional info (as per recommendation from redeyedjedi)

    Java JRE 1.6 (16u45 recommended) must be installed (included SMALI binaries might not work with Java 1.7), as well as .NET v4 or v4.5

    Hotplug on boot does not work (not an issue for me) no matter which options I adjust under /sys/kernel/usbhost - I must unplug OTG cable from Nexus first.
    However, if I boot without OTG cable, then connect it without DAC and only later connect the DAC, it is detected properly.
    If I boot with OTG Y-cable (with power connected to it) and plug the DAC after boot completion it is detected properly.
    It seems that initial DAC detection routine in the kernel is affected by OTG charging patch (as Timur stated a while ago). There might be something else in his ROM to force initial DAC detection. I played with Timur's kernel during my 4.2.2 days and it did not detect DAC on boot as well when using stock ROM.
    If I boot with stock CM11 kernel, DAC is detected on boot, hotplug works, but no OTG charging (and I need it for USB peripherals)
    And there's still a volume control issue...:(

    WARNING: It seems that this patch will only work on CM11-based ROMs! It can render AOSP ROMs (such as Purity) unbootable! Please use with caution!
    8
    Just a quick update to let you guys know that I will be posting a new simpler patch method soon which will also include the option to enable volume control. I'm hoping to finish things off tonight/tomorrow.
    6
    Thanks so much for your help, if you could make a flashable version as sadly my android knowledge is somewhat limited :highfive:

    I have a flashable version already.....its what I run. just need to upload to devhost.....got a reply from showp so its all good. give me a bit....I might even be able to from my tablet......otherwise itll be tomorrow cause im not home.



    OK.......its rude to hijack a thread.....so I will take the time in the next days to do a proper thread. I'm also on my personal tablet and this particular build has 100mb of modules you don't need but it will work just fine. So please.... Save any questions for a bit till I get a chance on my desktop to do this right.

    Just install...... Apply this Ops mod....... And enjoy.! http://d-h.st/QhW
    5
    I'll submit the required patches to CM at the weekend (I promise :p) that should at least get things going for CM based ROMs.

    I am also hoping to release something based on the Xposed framework for people who either don't have a CM based ROM or don't want to change/update. Using Xposed should make the patch more compatible and stable across devices, it will also allows patching the fixed volume limitation when a USB DAC is connected. The volume patch is extremely simple when built into a ROM but it becomes tricky when patching at runtime.