[MOD] USB Audio Support

Search This thread

paatos

Member
Nov 7, 2012
10
0
Sorry for the lack of updates.
Going to post something after work tonight ;)

Could you help me setup my USB card Maya 44? Patches from first post doesn't make my card default in any case :/
Card is properly initialized by Android. USB Audio Recorder can record and play wav files through Maya 44 but I can't make usb card default in whole system.

I'm using right now XenonHD Stable-2.0 (4.2.1). Only in XenonHD mixers are properly showed in AlsaMixer from Google Play. Also, card is visible in /dev/pcm/. Trying to symlink as default card with no effect (no sound at all).

Editing audio_policy.conf and setting USB_DEVICE_OUT_SPEAKER as default = no sound at all.
 

jacknorris

Senior Member
Nov 8, 2010
55
83
You must be getting some serious overtime $$$ at that job of yours. :angel:

Haha, I wish!

Sorry for the delays. I found an issue when patching the stock ROM that I would like to fix - thankfully it doesn't appear to be too much work. I'll avoid giving dates but I would rather release something that actually works for the majority this time around :)

And in response to your earlier post. Yes, it will work for the S3 and other devices. Providing you can get hold of a kernel with the USB audio drivers compiled in.
 
Last edited:
  • Like
Reactions: CZ Eddie

jacknorris

Senior Member
Nov 8, 2010
55
83
Original post updated with new patch method.
Please give it a go and let me know!

Remember to backup your device first, bugs will be bugs!
 
  • Like
Reactions: CZ Eddie

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
edit: I was doing it wrong. Without SU privileges.
After letting ADB have SU, it worked.
 
Last edited:

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
edit: I was doing it wrong. Without SU privileges.
After letting ADB have SU, it worked.
 
Last edited:

jacknorris

Senior Member
Nov 8, 2010
55
83
Can you guys make sure your device is on and unlocked/on the home screen when running the software? It may be that SuperSU/Superuser has popped up asking for permission to run as root.
 
Last edited:

jacknorris

Senior Member
Nov 8, 2010
55
83
No difference here.
The .exe just complains about me having a de-odexed ROM instead of an odexed.
I was on my homescreen just now. Ran the .exe and did not see Superuser ask for any permissions. Nothing happened on the phone at all.

Win7x64
Java installed
.net 4.0
Ran the .exe as an administrator

CyanogenMOD 10.1 1/22/12 build for Galaxy S3
Busybox installed
Debugging enabled
Fresh install, no other apps installed yet (except gapps & busybox 1.202)

Please could you run the following adb command on your device(s) and reply or PM me with the output.

shell su cat /init.rc
eg. adb.exe shell su cat /init.rc

Thanks
 

Darkii89

Member
Nov 24, 2012
16
3
mods doesn't work with note 2 :X
patched successfully but the whenever i plugin my usb dac the music player freeze or play with with no sound :(, its not compatible with note 2 i think the same will be for s3 @_@
 

jacknorris

Senior Member
Nov 8, 2010
55
83
mods doesn't work with note 2 :X
patched successfully but the whenever i plugin my usb dac the music player freeze or play with with no sound :(, its not compatible with note 2 i think the same will be for s3 @_@

Stock versions of Note/S3 may have issues but CM10/10.1 should be fine. I have tested it on a friends S3 and it works without issue.
What OS are you running on your Note 2?
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Please could you run the following adb command on your device(s) and reply or PM me with the output.

shell su cat /init.rc
eg. adb.exe shell su cat /init.rc

Thanks

Okay, I found the problem while trying to su.

By default CM10 [cm10.x] only allows root access from Apps, not ADB.
Go to Settings -> Developer options -> Root access, and change option to "Apps and ADB".

After changing my setting to "Apps and ADB", I was now able to run your .exe successfully on my ATT Galaxy S3.
And my phone rebooted successfully!

Now to work on figuring out how to add USB Audio drivers to my kernel!!! :good:

---------- Post added at 12:51 PM ---------- Previous post was at 12:03 PM ----------

Stock versions of Note/S3 may have issues but CM10/10.1 should be fine. I have tested it on a friends S3 and it works without issue.

Wait, you got USB-DAC working on a North American Galaxy S3 running CM10.1?
Could I ask what you guys did to get it working? I thought we didn't have drivers yet.
 

jacknorris

Senior Member
Nov 8, 2010
55
83
Okay, I found the problem while trying to su.

After changing my setting to "Apps and ADB", I was now able to run your .exe successfully on my ATT Galaxy S3.
And my phone rebooted successfully!

Now to work on figuring out how to add USB Audio drivers to my kernel!!! :good:

---------- Post added at 12:51 PM ---------- Previous post was at 12:03 PM ----------



Wait, you got USB-DAC working on a North American Galaxy S3 running CM10.1?
Could I ask what you guys did to get it working? I thought we didn't have drivers yet.

Not the NA version unfortunately. International S3 running CM 10.1.
Glad to hear that it actually worked without killing the OS this time around. I will update the app to check for the ability to SU. I'm not sure on the drivers for the NA S3. Is there a significant hardware difference between the two models?
 
Last edited:

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Not the NA version unfortunately. International S3 running CM 10.1.
Glad to hear that it actually worked without killing the OS this time around. I will update the app to check for the ability to SU. I'm not sure on the drivers for the NA S3. Is there a significant hardware difference between the two models?

Thanks!
Yes, the two S3 models have a different CPU. I'm not sure of any other hardware differences.
 

CynicalMushroom

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

Okay, let me get this straight before I flash this. This reportedly makes usb audio work on the I9300 running cm 10.1 (JB 4.2.1), right? Does that include hotplugging it or do we need to reboot every time we want to use it?

Also, is it in any way possible to do this using a mac? Or do I have to use another pc with windows?

Sent from my GT-I9300 using xda premium
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Okay, let me get this straight before I flash this. This reportedly makes usb audio work on the I9300 running cm 10.1 (JB 4.2.1), right? Does that include hotplugging it or do we need to reboot every time we want to use it?

Also, is it in any way possible to do this using a mac? Or do I have to use another pc with windows?

Sent from my GT-I9300 using xda premium

Since his .exe is for Windows, I would suggest using a Windows virtual machine to run his utilty.
 

jacknorris

Senior Member
Nov 8, 2010
55
83
I have updated the main post with v1.1 which should detect root a bit better. I am still interested to hear of results with other devices. If there are issues I may be able to create device specific patches that can be applied in the same way.

Thanks!
Yes, the two S3 models have a different CPU. I'm not sure of any other hardware differences.
I am looking into the driver situation now, just out of interest what is the codename for your NA S3? (eg i9300, d2vzw, d2att etc)

Okay, let me get this straight before I flash this. This reportedly makes usb audio work on the I9300 running cm 10.1 (JB 4.2.1), right? Does that include hotplugging it or do we need to reboot every time we want to use it?

Also, is it in any way possible to do this using a mac? Or do I have to use another pc with windows?

Sent from my GT-I9300 using xda premium
That is correct, this will enable hot plugging of USB audio devices. The only catch is that you need a kernel flashed to the device with USB audio drivers before anything will actually work.
 

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.