[MTCB Android Head Units Q&A] aluver:
USB Audio (DAC) support for digital out

UPDATE: The new guide is here

So, I am glad to say, we have USB Audio (DACs) support now.

If you want to build a serious car sound system, you have to make a digital out to your amp (or DSP) instead of using our head units line outs.

I will try to write in more detail and more simply as to repeat it.

For the redirection of all sounds of the Android to your USB device (a sound card, DAC) it is necessary:

1. To be convinced that a system's kernel version is 3.0.36+ . The version of a firmware can be any. At me I was KLD-1.98 and 4.2.2. But despite it I pulled out driver modules from a tablet firmware on the Android 4.4.2.

2. Get root, root explorer and Android terminal emulator.

3. Copy by root explorer USB Audio support modules *.ko from the applied archive in /system/lib/modules/, and set them permissions to 0644.

4. It is obligatory to try loading modules manually from the terminal exactly in that order:

u0_a71@android:/ $ su
root@android:/ # insmod /system/lib/modules/snd-hwdep.ko
root@android:/ # insmod /system/lib/modules/snd-rawmidi.ko
root@android:/ # insmod /system/lib/modules/snd-usbmidi-lib.ko
root@android:/ # insmod /system/lib/modules/snd-usb-audio.ko

If the device reboots at execution of this commands, these drivers don't suit to you (though probability of it is small as our HU are identical)

If system silently swallowed your commands - everything normally, we go further.

5. Connect your USB device to one of the back USB ports intended for 3G/Wifi (as we surely need port with support of USB-host).

6. In the terminal enter the following commands and check your device, what number it was defined.

root@android:/ # ls dev/snd
controlC0
controlC1
controlC2
pcmC0D0c
pcmC0D0p
pcmC1D0p
[COLOR="Red"]pcmC2D0c
pcmC2D0p[/COLOR]
timer
root@android:/ # cat /proc/asound/cards
0 [RK29WM8731 ]: RK29_WM8731 - RK29_WM8731
RK29_WM8731
1 [RKHDMII2S ]: RK-HDMI-I2S - RK-HDMI-I2S
RK-HDMI-I2S
[COLOR="red"]2 [Headset ]: USB-Audio - Plantronics Headset
Plantronics Plantronics Headset at usb-usb20_host-1.3, full speed[/COLOR]
root@android:/ #

Apparently from replies of system, my test Plantronics headset received the address pcmC2D0p - that is Card 2 Device 0. Remembered these figures. Due to the identical architecture of our HU, I think, it will be similar for all of us.

7. To make modules *.ko were loaded at each start of a system, it is necessary to copy by root explorer install-recovery.sh script from archive to /system/etc/install-recovery.sh, set permissions 0755.

8. For providing the redirection of a sound to our USB device it is necessary to deceive system. For this purpose it is necessary to replace number of the device (card) in file /system/lib/hw/audio.primary.rk30board.so. You need find 'pcmC0D0p' string and change it to your remembered value (pcmC2D0p, I think so). It is best of all to make it on the computer by any binary files editor. But I put already my edition of the audio.primary.rk30board.so file with pcmC2D0p value. Don't forget to set it permission 0644. And it is obligatory to make a backup of the original file for ability to return to an initial state.