• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Q] CM 10.1 USB Audio DAC

Search This thread

pasimetes

Member
Jun 20, 2009
30
1
First of all.. my setup:

HARDWARE:

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

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:
https://github.com/CyanogenMod/andr...mmit/09d3f13837b9e0d6580b121daac1eac1fda01990

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..
Code:
[email protected]:/ # insmod /system/modules/snd-hwdep.ko
[email protected]:/ # insmod /system/modules/snd-rawmidi.ko
[email protected]:/ # insmod /system/modules/snd-usbmidi-lib.ko
[email protected]:/ # insmod /system/modules/snd-usb-audio.ko

4) * I CONNECT THE USB DAC *

5) Logcat says this:
Code:
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: android.app.ContextImpl.sendBroadcast:1084 com.android.server.usb.UsbSettingsManager.deviceAttached:619 com.android.server.usb.UsbHostManager.usbDeviceAdded:156 com.android.server.usb.UsbHostManager.monitorUsbHostBus:-2 com.android.server.usb.UsbHostManager.access$000:38

6) dmesg says this:
Code:
<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) [email protected]:/ # cat /proc/asound/cards
Code:
 0 [Tuna           ]: OMAP4 - Tuna
                      TI OMAP4 Board
 1 [OMAP4HDMI      ]: OMAP4HDMI - OMAP4HDMI
                      OMAP4HDMI
 2 [DAC            ]: USB-Audio - HiFimeDIY DAC
                      HiFimeDIY Audio HiFimeDIY DAC at usb-musb-hdrc-1, full speed

8) * I DISCONNECT THE USB OTG CABLE (with DAC attached to it) FROM THE PHONE *

9) Logcat has this to say:
Code:
I/EventHub(  434): Removing device '/dev/input/event6' due to inotify event

Hope this helps, thx in advance :)
 
Last edited:
  • Like
Reactions: hcengar

hcengar

Member
Mar 5, 2013
18
1
Hi,

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?

Thanks,

Hector
 

Raenmor

New member
Mar 10, 2012
4
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 :victory:

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 :highfive:):
1)download alsa utils (kingbeatz have them, for example. They are in system/bin, but don't forget the permissions :p)
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:
Code:
audio_hw_modules {
  primary {
    outputs {
      primary {
        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|96000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT|AUDIO_FORMAT_PCM_32
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.
Code:
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
}

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

pcm.sample_rate_96k { /if you frequency from pcm.DACE07K and pcm.music 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:
Code:
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 :D). 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:
  • Like
Reactions: pasimetes

6V6GT

New member
May 8, 2011
4
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 :p)
 

Raenmor

New member
Mar 10, 2012
4
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.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    First of all.. my setup:

    HARDWARE:

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

    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:
    https://github.com/CyanogenMod/andr...mmit/09d3f13837b9e0d6580b121daac1eac1fda01990

    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..
    Code:
    [email protected]:/ # insmod /system/modules/snd-hwdep.ko
    [email protected]:/ # insmod /system/modules/snd-rawmidi.ko
    [email protected]:/ # insmod /system/modules/snd-usbmidi-lib.ko
    [email protected]:/ # insmod /system/modules/snd-usb-audio.ko

    4) * I CONNECT THE USB DAC *

    5) Logcat says this:
    Code:
    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: android.app.ContextImpl.sendBroadcast:1084 com.android.server.usb.UsbSettingsManager.deviceAttached:619 com.android.server.usb.UsbHostManager.usbDeviceAdded:156 com.android.server.usb.UsbHostManager.monitorUsbHostBus:-2 com.android.server.usb.UsbHostManager.access$000:38

    6) dmesg says this:
    Code:
    <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) [email protected]:/ # cat /proc/asound/cards
    Code:
     0 [Tuna           ]: OMAP4 - Tuna
                          TI OMAP4 Board
     1 [OMAP4HDMI      ]: OMAP4HDMI - OMAP4HDMI
                          OMAP4HDMI
     2 [DAC            ]: USB-Audio - HiFimeDIY DAC
                          HiFimeDIY Audio HiFimeDIY DAC at usb-musb-hdrc-1, full speed

    8) * I DISCONNECT THE USB OTG CABLE (with DAC attached to it) FROM THE PHONE *

    9) Logcat has this to say:
    Code:
    I/EventHub(  434): Removing device '/dev/input/event6' due to inotify event

    Hope this helps, thx in advance :)
    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 :victory:

    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 :highfive:):
    1)download alsa utils (kingbeatz have them, for example. They are in system/bin, but don't forget the permissions :p)
    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:
    Code:
    audio_hw_modules {
      primary {
        outputs {
          primary {
            sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|96000
            channel_masks AUDIO_CHANNEL_OUT_STEREO
            formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT|AUDIO_FORMAT_PCM_32
    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.
    Code:
    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
    }
    
    pcm.music {
    	type plug
    	slave {
    		pcm "DACE07K,0"
    		channels 2
    		format S24_3LE
    		rate 96000
    	}
    }
    
    pcm.sample_rate_96k { /if you frequency from pcm.DACE07K and pcm.music 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:
    Code:
    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 :D). 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.