Monday, 1 August 2016

How does /etc/mixer_paths.xml TinyAlsa ctl/path routing work?

/etc/mixer_paths.xml is apparently related to TinyAlsa (https://stackoverflow.com/questions/...xml-in-android).

The file can be edited to reroute or alter audio. "adb root && adb remount && push mixer_paths.xml /etc/"

The file starts with a series of default parameters. I assume each corresponds to a hardware/ALSA value or rounting preference.


Code:


    <ctl name="Voice Rx Device Mute" id="0" value="0" />
        "id" is used when multiple controls appear under the same name. It's like an indexing scheme.
    <ctl name="Voip Mode Config" value="12" />
    <ctl name="SLIM_0_RX Channels" value="One" />
    <ctl name="SLIM_0_TX Channels" value="One" />


Then there are a series of profiles, which override default parameters.


Code:


    <path name="headphones">
        ...
        <ctl name="HPHL DAC Switch" value="1" />
        <ctl name="HPHL Volume" value="20" />
        <ctl name="HPHR Volume" value="20" />
        <ctl name="RX1 Digital Volume" value="82" />
        <ctl name="RX2 Digital Volume" value="82" />
        <ctl name="COMP1 Switch" value="1" />
    </path>


I observed that changed "RX1/2 Digital Volume" changed the output volume. "HPHL/R Volume" had no effect.

Some paths include an inner "path name=" tag. I assume this inherits settings.


Code:


    <path name="voice-line">
        <path name="voice-headphones" />
    </path>

    <path name="voice-headphones">
        <path name="headphones" />
        <ctl name="COMP1 Switch" value="1" />
        <ctl name="HPHL Volume" value="20" />
        <ctl name="HPHR Volume" value="20" />
        <ctl name="RX1 Digital Volume" value="78" />
        <ctl name="RX2 Digital Volume" value="78" />
    </path>


--------

Now the kicker... What do path names mean?

For example, "headphones" obviously means headphone port, and "speaker" means speakers.

However, there are literally hundreds of speaker, headphones, headsets, handsets, mic, sidetone-iir, tty, etc... How does Android choose which path to enable?

If I'm trying to decrease headphone volume (for earbuds), which settings do I have to change? "headphones" only, or some unknown set of options?

I noticed an interesting <path name="ADSP testfwk">... What could that mean?

A Google search took me to http://www.perkel.com/x/snd_soc_msm . Searching `snd_soc_msm` took me to https://android.googlesource.com/pla...sm/snd_soc_msm... The log link references "mako" (Nexus 4), not my Nexus 5X (this is the first commit the file appears). Additionally, the file is not available in "master" branch (replace the hex with master), as apparently libalsa was removed.

No comments:

Post a Comment