HTC Delivering Ads Straight to Sense Home

HTC’s 2015 has been a year marked by a desperate search for revenue.The HTC One M9 … more

Galaxy S6 & Edge get €100 Price Cut—New Models Incoming

Samsung has dropped the price of both the Galaxy S6 and S6 Edge by … more

How To Port Fully Featured Sony Xperia Z4 Camera

Xperia Z4’s hardware may not impress, but its software is definitely … more

Experimental TWRP Available For Moto G 2015

XDA Senior Member squid2 has posted experimental builds of TWRP for the Moto G … more

[Q] CM 10.1 USB Audio DAC

30 posts
Thanks Meter: 1
By pasimetes, Member on 1st June 2013, 05:22 PM
Post Reply Subscribe to Thread Email Thread
First of all.. my setup:

  • Nightly (2013-05-31) CyanogenMod 10.1
  • GLADOS Kernel v2.3 (flashed it on top of CM in attempt to make USB DAC work)

The problem:
It doesn't work :) The DAC itself is recognized and after installing GLADOS Kernel and insmod'ing a couple of usb-audio related modules it is also listed as a soundcard, but audio is not routed through the DAC.

Before installing GLADOS kernel, with stock CM 10.1, I've also tried USB Audio Tester app and.. it worked, audio was successfully routed through the DAC, so the DAC itself works and gets enough power from the phone.

After days of researching and Google'ing I've started to believe that it's a CyanogenMod related issue (found reports that USB DACs work on AOSP ROMs, but not CM). I've also found this, which, I think, might be related:

But before me trying AOSP ROM or patching my CM with the patch above, I decided to post here, so maybe I am not the only one, who confronted this problem and someone could shed some light on the CM USB Audio issue :)

Lastly, some debug info:

1) Installed latest nightly CM.
2) Installed GLADOS v2.3
3) Then..
shell@android:/ # insmod /system/modules/snd-hwdep.ko
shell@android:/ # insmod /system/modules/snd-rawmidi.ko
shell@android:/ # insmod /system/modules/snd-usbmidi-lib.ko
shell@android:/ # insmod /system/modules/snd-usb-audio.ko

5) Logcat says this:
D/EventHub(  434): No input device configuration file found for device 'HiFimeDIY Audio HiFimeDIY DAC'.
W/ContextImpl(  434): Calling a method in the system process without a qualified user:$000:38
6) dmesg says this:
<6>[  638.367095] fsa9480 4-0025: cable detect change, from 'unknown/none' to 'usb-host'
<6>[  638.944702] usb 1-1: new full speed USB device number 4 using musb-hdrc
<3>[  639.144012] usb 1-1: device v1852 p7022 is not supported
<6>[  639.144073] usb 1-1: New USB device found, idVendor=1852, idProduct=7022
<6>[  639.144195] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
<6>[  639.144317] usb 1-1: Product: HiFimeDIY DAC
<6>[  639.144378] usb 1-1: Manufacturer: HiFimeDIY Audio
<6>[  639.154876] input: HiFimeDIY Audio HiFimeDIY DAC as /devices/platform/omap/musb-omap2430/musb-hdrc/usb1/1-1/1-1:1.0/input/input8
<6>[  639.155334] generic-usb 0003:1852:7022.0003: input: USB HID v1.00 Device [HiFimeDIY Audio HiFimeDIY DAC] on usb-musb-hdrc-1/input0
7) shell@android:/ # cat /proc/asound/cards
 0 [Tuna           ]: OMAP4 - Tuna
                      TI OMAP4 Board
 2 [DAC            ]: USB-Audio - HiFimeDIY DAC
                      HiFimeDIY Audio HiFimeDIY DAC at usb-musb-hdrc-1, full speed

9) Logcat has this to say:
I/EventHub(  434): Removing device '/dev/input/event6' due to inotify event
Hope this helps, thx in advance :)
Last edited by pasimetes; 1st June 2013 at 05:25 PM.
The Following User Says Thank You to pasimetes For This Useful Post: [ View ]
4th June 2013, 09:00 AM |#2  
pasimetes's Avatar
OP Member
Thanks Meter: 1
18th June 2013, 01:45 AM |#3  
Junior Member
Thanks Meter: 1

I'm trying to find a 4.2 ROM that will work with my Samsung GS3 and USB audio. I already tried nightlies of CM10.1 and AOKP but none of them works. When I connect my audio DAC sound stops being routed through the builtin speaker but nothing comes out through the DAC. When you say that there are AOSP ROMs where this works, which ones in particular are you referring to?


13th July 2013, 08:14 PM |#4  
Junior Member
Thanks Meter: 1
Looks like I've found the solution for this issue. At leas I was able to make FiiO E07K work on One X running latest CM10.1 nightly, and even playing at 96/24

Initial situation was exactly like yours, usb audio mod (this one) made no impact as well.

Maybe it will work for you as well, so try the following (sorry, if I will write it very detailed, like for complete newbies. Just to be sure, you know. And for everyone else's use ):
1)download alsa utils (kingbeatz have them, for example. They are in system/bin, but don't forget the permissions )
2)connect your dac and check if it's connected running "alsa_aplay -l" as #su
3)If it is listed (probably at the very end), it should state it's ALSA name (It's the first, before the full name in brackets. Mine was DACE07K)
4)try running "cat /proc/asound/card*your card number here, from previous step*/stream0". It should give you the details about supported frequencies and bit formats. (I had 8-96khz and S16_LE/S24_3LE formats)
5)(optional/worked for me, but not sure that it won't screw up your system)go to /system/etc/audio_policy.conf and add (if they are not there already) AUDIO_FORMAT_PCM_24_BIT|AUDIO_FORMAT_PCM_32_BIT to the primary formats, and sampling rates. It should look like this:
audio_hw_modules {
  primary {
    outputs {
      primary {
        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|96000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
6)(main step)go to /system/etc/asound.conf. Add new device and ctl for your DAC, and reroute music stream (as well as general streams for specific frequencies) to your DAC.
pcm.DACE07K {
	type plug
	slave {
		pcm "DACE07K,0"
		channels 2
		format S24_3LE /put your desired bit format here from step 2
		rate 96000 /put your desired frequency rate from step 2

ctl.DACE07K {
	type hw
	card DACE07K
} {
	type plug
	slave {
		pcm "DACE07K,0"
		channels 2
		format S24_3LE
		rate 96000

pcm.sample_rate_96k { /if you frequency from pcm.DACE07K and isn't mention add it
	type plug
	slave {
		pcm "hw:DACE07K,0"
		channels 2
		rate 96000
the remaining frequencies should be done the same way
7)create init.d script with the following lines:
mount -t debugfs debugfs /sys/kernel/debug 

mount -o rw,remount /system

chmod 777 /dev/snd/*;
chown 0.0 /dev/snd/*;

export AUDIODRIVER=alsa;
setprop AUDIODRIVER alsa;
setprop ro.sound.driver alsa;

mount -o ro,remount /system
8)reboot and check your DAC

This done the trick for me, everything works (as well as volume control during playback), audio is routed at 96/24, DAC is hotpluggable (but don't disconnect it during playback, for some reason i have to reboot after this to make it work again). When DAC is not connected the audio is routed the usual way (speaker/headphones).

PS:It's safer to start with 48/16 (rate 48000 and format S16_LE), because they are default for android and thus definitely supported. If it works - you can try to increase it by the method described above. Not sure that it will work on completely stock CM, 'cause I have another set of alsa libs and kernel with 32bit audio support (not sure if it helps here, though ). But main switching part through asound.conf and init.d is tested on stock CM. Probably you can use libs from KingBeatz mod since it's universal and supposed to have at least 96/24 support. And it improves a lot of sound aspects as well, like increasing resampling quality.
Last edited by Raenmor; 13th July 2013 at 08:27 PM.
The Following User Says Thank You to Raenmor For This Useful Post: [ View ]
16th July 2013, 11:19 AM |#5  
pasimetes's Avatar
OP Member
Thanks Meter: 1
Wow, thanks for all the info, I'll try to find some time today to play with it.
26th August 2013, 01:19 AM |#6  
Junior Member
Thanks Meter: 0
Where do I get alsa uitls
Can you please explain a bit more on where to download alsa utils? What version? Are they compiled files just to copy to the system/bin directory?

1)download alsa utils (kingbeatz have them, for example. They are in system/bin, but don't forget the permissions )
26th August 2013, 03:11 PM |#7  
Junior Member
Thanks Meter: 1
This guide is obsolete now, since it does double resampling (44.1-48-96) with noticeable quality loss. You can find another approach here. It's not that easy to use, but provides much better quality.

But to answer you question - alsa-libs for android are pre-compiled (I think by aznrice2k4), and included in his universal KingBeatz mod. You can simply take it from there and put it into your /bin folder.
Post Reply Subscribe to Thread

audio, dac, otg, usb
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes