[MOD] USB Audio Support

Search This thread

foxdog66

Senior Member
Jul 28, 2010
471
53
so the op kernel is cm's stock kernel compiled with usb audio enabled, correct? where can i find the patch(s) for it so that i may try and compile a kernel for my galaxy nexus with this added usb audio support?
 

jayman488

New member
Feb 7, 2013
3
0
usb audio input

hi everyone, I've been following this thread as well as timur's over at rootzwiki. I have a nexus 7 with timur's USBROM which includes this usb audio patch. It works great with my usb sound card; audio is routed through it when plugged in, and returned to the N7 when unplugged.

I have an HD radio with analog RCA audio output that I would like to send through the usb sound card's 3.5mm mic input, through the N7 and out through a DAC. So I actually have 2 usb audio devices, the cheapo sound card with input/output, and the DAC with output only.

I wrote an app to control the HD radio via a usb -> rs232 adapter. But how can I access the usb sound card's audio input in my app, so I can route it out through the DAC? I know this is possible because I installed the UsbAudioTester app and I was able to route sound in and out of the sound card. But since I don't have the source code to that app I don't know how it's doing it.

Could I use OpenSL ES to read a buffer from the sound card's mic input, and route it out through the DAC?
 
Last edited:

CynicalMushroom

Senior Member
Dec 1, 2012
129
41
Can confirm that Carbonrom works with jack's patch on the i9300. It has no Siyah support yet, which is kinda sad :/
 

Kodiack99

Senior Member
Aug 26, 2012
102
19
Timurs usb rom supports it,as well as most common dac's.Give it a shot it is very stable and full of awesomeness.It also supports hotplugging of storage media and dac.

Sent from my SGH-I927 using xda app-developers app
 

Hydro8

Senior Member
Aug 20, 2012
114
4
I try usbrom but it doesn't work :(

When i plug my e17 i have no sound from my e17 or from n7 speaker.
 

Kodiack99

Senior Member
Aug 26, 2012
102
19
You have to reboot with it installed,then you can hot swap once it installs drivers on boot.

Sent from my SGH-I927 using xda app-developers app
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Update 02/12/2013 for AT&T Galaxy S3 owners --- This USB-DAC functionality also now works with the Xylon AOSP ROM:

http://xdaforums.com/showthread.php?p=37925178#post37925178

Also, LiquidSmooth ROM (also works with USB-DAC) thread is closed now due to the team breaking up. But a new thread will likely be opened soon as the ROM is still being developed by the new Liquid team.


I've also tried the latest CM10.1 nightly which now includes analog USB audio functionality. But it still does not work with JackNorris patch.
 
  • Like
Reactions: djthread

djthread

Senior Member
Jul 30, 2010
95
5
Detroit
CZ Eddie, do you notice that the headphone port doesn't work? That certainly seems to be the case with the LiquidSmooth rom you originally discovered took jack's patch that I'm still on. While plugging a DAC causes the signal to switch, plugging in some headphones has no such effect.

I yearn for the day when this DAC hot-switching functionality is merged into CM and other roms which also have working bluetooth. Can you imagine it? :)

Sent from my Samsung Galaxy S3 with CM10/Jelly Bean
 
Last edited:

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Sorry, no I didn't test headphones. I was only on the ROM long enough to see if USB-DAC worked (it did).
That ROM is very new and has a lot of bugs that need to be worked out. I'll flash it again the next release to see if it's a daily driver yet.

I thought Bluetooth was fixed in CM10.1 now? I could be wrong. Just thought I read that somewhere.
 

OSNPA

Senior Member
Apr 13, 2011
603
62
Google Pixel 6 Pro
CZ Eddie, do you notice that the headphone port doesn't work? That certainly seems to be the case with the LiquidSmooth rom you originally discovered took jack's patch that I'm still on. While plugging a DAC causes the signal to switch, plugging in some headphones has no such effect.

I yearn for the day when this DAC hot-switching functionality is merged into CM and other roms which also have working bluetooth. Can you imagine it? :)

Sent from my Samsung Galaxy S3 with CM10/Jelly Bean

Yep, this is what I found also. Itsmikeramsey is merging illusion with LiquidSmooth, working directly with main liquid dev. The included kernel, based on preview screenshots, uses imoseyon's leankernel, which enabled USB audio on Nexus 7. Crossing my fingers.

Sent from my Nexus 7 using xda app-developers app
 
  • Like
Reactions: djthread

Nosferatu.

Senior Member
Dec 20, 2011
2,255
765
Tampa, Florida
Okay questions here... I got hotplugging finally working on the Nexus 7 by flashing a ROM with it already included and I noticed when it's working you get an extra settings menu (USB Host).

Is there any reason I have had no success in other ROMs?

This is the one I flashed that had it working right out of the box...

http://mehrvarz.github.com/nexus-7-usbrom/

Sent from my Nexus 7
 

OSNPA

Senior Member
Apr 13, 2011
603
62
Google Pixel 6 Pro
Okay questions here... I got hotplugging finally working on the Nexus 7 by flashing a ROM with it already included and I noticed when it's working you get an extra settings menu (USB Host).

Is there any reason I have had no success in other ROMs?

This is the one I flashed that had it working right out of the box...

http://mehrvarz.github.com/nexus-7-usbrom/

Sent from my Nexus 7

Timur focused on getting USB audio flawless. There isn't a lot of demand for it in the general community, so it seems it's usually an afterthought. Imoseyon's LeanKernel will get USB audio working with a bunch of ROMs, but not quite as flexible with hotplugging. I use LeanKernel, and I need to reboot so USB OTG is initiated during boot up. I use the grab focus apk from Timur's thread when I'm done, to revert sound back to Nexus 7 speaker.

Sent from my Nexus 7 using xda app-developers app
 

Nosferatu.

Senior Member
Dec 20, 2011
2,255
765
Tampa, Florida
Timur focused on getting USB audio flawless. There isn't a lot of demand for it in the general community, so it seems it's usually an afterthought. Imoseyon's LeanKernel will get USB audio working with a bunch of ROMs, but not quite as flexible with hotplugging. I use LeanKernel, and I need to reboot so USB OTG is initiated during boot up. I use the grab focus apk from Timur's thread when I'm done, to revert sound back to Nexus 7 speaker.

Sent from my Nexus 7 using xda app-developers app

Okay, but is there a way to get this USB Audio Host option under the settings menu available in another ROM? It's really slick but I miss having AOKP customization tweaks.
 

OSNPA

Senior Member
Apr 13, 2011
603
62
Google Pixel 6 Pro
Okay, but is there a way to get this USB Audio Host option under the settings menu available in another ROM? It's really slick but I miss having AOKP customization tweaks.

Sure, there's a way. I don't know that Timur is committed to expand development beyond the bare basics for full car functionality, but I know he has attempted to have some of these changes committed so that they can be picked up by CM team or other. If you find a dev that builds AOKP ROMs to build on what Timur has done, then it's up to them to implement. If you follow Timur's thread on RootzWiki, you can see a clear design path. I would love if it became part of base AOSP but Google has yet to respond to those requests last time I checked.

Sent from my Nexus 7 using xda app-developers app
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Hi Jack,

Does your patch work with 4.2.2?

The LiquidSmooth & Xylon ROM's that worked on Galaxy S3 d2att with 4.2.1 for USB-DAC were just updated to 4.2.2 and now USB-DAC doesn't work anymore after flashing your patch. :(

http://xdaforums.com/showthread.php?p=38053010&posted=1#post38053010


It's too bad, too. Because the new 4.2.2 LiquidSmooth that came out on the 14th is a VERY nice rom (other than not having USB-DAC functionality). The 4.2.2 Xylon still needs work everywhere.
 
Last edited:

CynicalMushroom

Senior Member
Dec 1, 2012
129
41
Sv: [MOD] USB Audio Support

I can confirm that the patch still works even though I'm on 4.2.2 using Carbonrom(i9300)

Only difference is that when applying the patch you get a prompt saying something like: no patch found for current OS 4.2.2 try 4.2.1 anyway?

Sent from my GT-I9300 using xda premium
 
  • Like
Reactions: CZ Eddie

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.