[MOD] USB Audio Support

Search This thread

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
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.

No change in behavior with my rooted, custom De-Odexed TW ROM for Galaxy S3.
I do have ADB enabled but it doesn't pop up & request root privs on my unlocked, open desktop of the phone.

Of course, my TW doesn't need it because USB-DAC works fine as-is.

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)

Mine is a D2att. Which is the North American Galaxy S3 for AT&T. :)
 

jacknorris

Senior Member
Nov 8, 2010
55
83
No change in behavior with my rooted, custom De-Odexed TW ROM for Galaxy S3.
I do have ADB enabled but it doesn't pop up & request root privs on my unlocked, open desktop of the phone.

Of course, my TW doesn't need it because USB-DAC works fine as-is.



Mine is a D2att. Which is the North American Galaxy S3 for AT&T. :)

If nothing pops up and the program doesnt throw up an error then everything is working as expected. The allow permission is probably being remembered.

Forgive me if I am missing something but is there any particular reason you are testing this if your ROM is already working? :p Or are you after CM10.1 with full USB DAC support?
 

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Forgive me if I am missing something but is there any particular reason you are testing this if your ROM is already working? :p Or are you after CM10.1 with full USB DAC support?

Hahah. Yes, USB-DAC works beautifully as-is with the stock TW ROM on Galaxy S3 ATT.
But I'm a CM10/AOKP fiend. I need my customization fix! hahah

If nothing pops up and the program doesnt throw up an error then everything is working as expected. The allow permission is probably being remembered.

Nope, it's the same error as before. It's tough to catch a screenshot before it goes away, but I just barely managed (see pic below).
This is not on CM10.1, it's on the rooted TW ROM. I'm just trying to flash it to help out. It doesn't actually need it. :)
 

Attachments

  • error2.jpg
    error2.jpg
    32.3 KB · Views: 216

jacknorris

Senior Member
Nov 8, 2010
55
83
Hahah. Yes, USB-DAC works beautifully as-is with the stock TW ROM on Galaxy S3 ATT.
But I'm a CM10/AOKP fiend. I need my customization fix! hahah



Nope, it's the same error as before. It's tough to catch a screenshot before it goes away, but I just barely managed (see pic below).
This is not on CM10.1, it's on the rooted TW ROM. I'm just trying to flash it to help out. It doesn't actually need it. :)

Hah fair enough, well I have CM10.1 for the d2att compiling now I'll see how far I get.

In the meantime could you try download the following for me? Extract it to a folder and run debug.bat and then please PM me the contents of debug.txt ? It will dump out your init.rc file, root directory listing and build.prop file.
It may just be that your deodexed rom has no BOOTCLASSPATH entry at all, I've not seen that before but there's a first for everything!

https://dl.dropbox.com/u/30612286/USB_AUDIO_SUPPORT/debug.zip
 
  • Like
Reactions: CZ Eddie

jacknorris

Senior Member
Nov 8, 2010
55
83
But I'm a CM10/AOKP fiend. I need my customization fix! hahah

Okay you might need to fill in some blanks for me here, I don't have access to an NA S3 and I haven't really been following the device so I am totally out of the loop.

Looking at the d2att kernel the USB audio drivers should be compiled in by default, so in theory my patch should enable hot plugging for the device. I assume the reason it does not work is exactly the same as with the Nexus 7 - there is simply no code to say "Hey Android... Switch the audio to USB!". That is effectively what my patch does.

As a test I have compiled a copy of CM10.1 with USB audio drivers and my USB audio patch built in. If you could test this on your device at some point it would be appreciated.

cm-10.1-20130124-usb-audio-test-1-UNOFFICIAL-d2att.zip
 

CynicalMushroom

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

Jack, any tips on kernels with usb audio drivers? I've been asking around and PM:ed a few kernel devs but it seems like that most of them don't have usb audio implemented.

For ex: the cm10.1 kernel has the usb drivers but they're not "activated" (for lack of a better word), and your patch sorta activates the drivers, correct?

Will be flashing cm10.1 and your patch in the afternoon, I'll share my results, maybe even a little step by step guide if I get it to work :)

Sent from my GT-I9300 using xda premium
 

Darkii89

Member
Nov 24, 2012
16
3
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?

Okay you might need to fill in some blanks for me here, I don't have access to an NA S3 and I haven't really been following the device so I am totally out of the loop.

Looking at the d2att kernel the USB audio drivers should be compiled in by default, so in theory my patch should enable hot plugging for the device. I assume the reason it does not work is exactly the same as with the Nexus 7 - there is simply no code to say "Hey Android... Switch the audio to USB!". That is effectively what my patch does.

As a test I have compiled a copy of CM10.1 with USB audio drivers and my USB audio patch built in. If you could test this on your device at some point it would be appreciated.

cm-10.1-20130124-usb-audio-test-1-UNOFFICIAL-d2att.zip

umm, i m trying to get fiio e07k to work in my international note 2, fiio e07k works with note 2 US stock rom but it doesn't work with note 2 international stock, it seems that theres something in note 2 US kernel that get the e07k to work, btw which rom ur friend using??official cm10.1 or custom cm10.1?
 
Last edited:

yukster

Senior Member
Apr 3, 2006
60
1
Tokyo
I think I got it to work on my Nexus 7. I had some problems with the Faux123 kernel that I had installed, so I tried the Timur kernel that recommended on the OP. It also looks like you have to install the volume control mod for everything to work as well.
 

yukster

Senior Member
Apr 3, 2006
60
1
Tokyo
Jack, everything works great, except for the volume control. I installed the n7 volume control patch, and when I press the volume controls on my USB headset, the volume control appears on the tablet, but pressing vol up or down does not change the volume, nor does the slider move. I did a factory rest, and installed the timur kernel, along with your patches.

Otherwise, great job on the patch!

Thanks!
 

CynicalMushroom

Senior Member
Dec 1, 2012
129
41
It works! :D

Had an old nandroid of the CM10.1 nightlies, just restored, plugged in, ran the program, reboot and BAM! It works!

Can't explain how happy I am right now! Thank you Jack!

Oh and btw, Jukster, you're not supposed to change the volume on your phone since it's using the external dac for volumes and such. It's actually more accurate than stock (you could change the volume on the phone while the dac was plugged in, giving the impression that the phone was still using the internal dac).

Thanks again Jack, I'll inform the guys over at head-fi, everyone with a i9300/N7 will come streaming over here :D
 
Last edited:

jacknorris

Senior Member
Nov 8, 2010
55
83
Jack, everything works great, except for the volume control. I installed the n7 volume control patch, and when I press the volume controls on my USB headset, the volume control appears on the tablet, but pressing vol up or down does not change the volume, nor does the slider move. I did a factory rest, and installed the timur kernel, along with your patches.

Otherwise, great job on the patch!

Thanks!
I have not tested volume control with 4.2.1 actually. I will go test this and upload a new volume patch if required.


It works! :D

Had an old nandroid of the CM10.1 nightlies, just restored, plugged in, ran the program, reboot and BAM! It works!

Can't explain how happy I am right now! Thank you Jack!

Oh and btw, Jukster, you're not supposed to change the volume on your phone since it's using the external dac for volumes and such. It's actually more accurate than stock (you could change the volume on the phone while the dac was plugged in, giving the impression that the phone was still using the internal dac).

Thanks again Jack, I'll inform the guys over at head-fi, everyone with a i9300/N7 will come streaming over here :D

Glad to hear it's working for you! :)
Not sure on the US S3 yet - hopefully CZ Eddie can give the patch + custom d2att CM10.1 ROM that I compiled a go. If it doesn't work it would at the very least provide me with some logs that I can ponder over.


The download URL said ( cm ..... ) ... Does it work on any other ROMs ?!

The patcher program should work across roms and devices, the kernels in the original post should be okay on other roms but it is not guaranteed. I have personally tested them with the exception of Timurs kernel on stock, aosp and cyanogenmod and they work fine. Please note however that the kernels listed in the first post are only compatible with the WiFi Nexus 7.
 
Last edited:

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Looking at the d2att kernel the USB audio drivers should be compiled in by default, so in theory my patch should enable hot plugging for the device. I assume the reason it does not work is exactly the same as with the Nexus 7 - there is simply no code to say "Hey Android... Switch the audio to USB!". That is effectively what my patch does.

As a test I have compiled a copy of CM10.1 with USB audio drivers and my USB audio patch built in. If you could test this on your device at some point it would be appreciated.

cm-10.1-20130124-usb-audio-test-1-UNOFFICIAL-d2att.zip

Hi Jack,

I flashed the ROM you posted above on my Galaxy S3 d2att.
But it did not send audio out to my Behringer 202 DAC. :)

I still have the ROM flashed in case you need any logs or anything from it.
I tried the debug but it didn't work in CM10.1 like it did in TW.

----------------
Unknown id: /init.rc

unknown option -- a



Usage: su [options] [--] [-] [LOGIN] [--] [args...]



Options:

-c, --command COMMAND pass COMMAND to the invoked shell

-h, --help display this help message and exit

-, -l, --login pretend the shell to be a login shell

-m, -p,

--preserve-environment do not change environment variables

-s, --shell SHELL use SHELL instead of the default /system/bin/sh

-v, --version display version number and exit

-V display version code and exit,

this is used almost exclusively by Superuser.apk

Unknown id: /system/build.prop
 

karistep

Member
Aug 18, 2008
25
0
Hi Jack,

I flashed the ROM you posted above on my Galaxy S3 d2att.
But it did not send audio out to my Behringer 202 DAC. :)

I still have the ROM flashed in case you need any logs or anything from it.
I tried the debug but it didn't work in CM10.1 like it did in TW.

----------------
Unknown id: /init.rc

unknown option -- a



Usage: su [options] [--] [-] [LOGIN] [--] [args...]



Options:

-c, --command COMMAND pass COMMAND to the invoked shell

-h, --help display this help message and exit

-, -l, --login pretend the shell to be a login shell

-m, -p,

--preserve-environment do not change environment variables

-s, --shell SHELL use SHELL instead of the default /system/bin/sh

-v, --version display version number and exit

-V display version code and exit,

this is used almost exclusively by Superuser.apk

Unknown id: /system/build.prop
:)



I m a newbie on nexus 7, can i use this patch on a stock nexus without root ?

where can i found step by step guide.

Thank
 

djthread

Senior Member
Jul 30, 2010
95
5
Detroit
jacknorris! My hero!!!

Ok, but it hasn't quite worked for me, either. I wiped my i747 clean, installed your rom + gapps, booted up. Plugging in my DAC didn't apparently have any affect and when I play music, it comes out the phone's speaker and not the DAC.

My DAC is an Intruder from raysamuelsaudio.com, and it works just fine with the stock touchwiz firmware.
 

WiR3D-kNiGhT

Member
Apr 15, 2011
34
3
Pretoria
Wow thanks for this, cannot tell you how many people over at head-fi are gonna get very happy.

Me personally too, once i get time to breathe I'll be flashing wither Liquidsmooth or CM10.1 and giving it a whack.
 
Last edited:

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.

[edited by CZ Eddie for clarity]
  1. adb shell
  2. su
  3. cat /init.rc > /sdcard/cat_output
Thanks

Attached is the output from my i747 d2att Galaxy S3 on CM10.1 in case it helps. :good:
 

Attachments

  • cat_output.zip
    4.9 KB · Views: 4

jacknorris

Senior Member
Nov 8, 2010
55
83
Attached is the output from my i747 d2att Galaxy S3 on CM10.1 in case it helps. :good:

Hi CZ Eddie/djthread

Please can you download and run this? (You will need to be rooted of course)
download-device-logs.zip

  1. Restart device
  2. Plug in DAC
  3. Wait 15 seconds
  4. Unplug DAC
  5. Run download-logs.bat
  6. Send me the "logs" folder

If download-logs.bat doesn't work for you please re-try ALL of the steps above substituting download-logs.bat with the below.

adb.exe shell su
dmesg > /sdcard/dmesg.txt
logcat -d -v time > /sdcard/logcat.txt

Please then send me dmesg.txt and logcat.txt from your sdcard

Thank you!
 
Last edited:

CZ Eddie

Senior Member
Sep 27, 2011
6,397
2,442
Austin, TX
Please then send me dmesg.txt and logcat.txt from your sdcard

Thank you!

Hi Jack,

Attached is the files you requested from my d2att Galaxy S3 on CM10.1.
I'll do the same soon, for the TW ROM that already works, just so you can compare any differences. If that helps.
 

Attachments

  • d2att_cm10.1_dmesg_logcat.zip
    70.4 KB · Views: 2

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.