Rerouting android's loud speaker calls audio to left audio channel (ROOT)

My Android phone's right speaker stopped working today, so any audio going to the right audio channel was gone, and my phone uses the right channel when calling with loud speaker.

And I'm not a fan of switching phone's too quickly before giving things a try.

So I found out how to reroute the loud-speaker audio channel in android to go to the left audio channel, so all audio comes out from the working speaker (left).

Android's audio devices config files can be found in /vendor/etc/mixer_paths_*.xml

With little searching I found out that my phone's audio devices config file is /vendor/etc/mixer_paths_tasha.xml

After reading the file a bit, I found out the loud speaker call config.

speaker-mono: left speaker (notice SpkrLeft) speaker-mono-2: right speaker (notice SpkrRight)

    <path name="speaker-mono">
        <ctl name="COMP7 Switch" value="1" />
        <ctl name="SLIM RX0 MUX" value="AIF_MIX1_PB" />
        <ctl name="SLIM_0_RX Channels" value="One" />
        <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
        <ctl name="SpkrLeft COMP Switch" value="1" />
        <ctl name="SpkrLeft BOOST Switch" value="1" />
        <ctl name="SpkrLeft VISENSE Switch" value="1" />
        <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
    </path>

    <path name="speaker-mono-2">
        <ctl name="COMP8 Switch" value="1" />
        <ctl name="SLIM RX1 MUX" value="AIF_MIX1_PB" />
        <ctl name="SLIM_0_RX Channels" value="One" />
        <ctl name="RX INT8_1 MIX1 INP0" value="RX1" />
        <ctl name="RX8 Digital Volume" value="84" />
        <ctl name="SpkrRight COMP Switch" value="1" />
        <ctl name="SpkrRight BOOST Switch" value="1" />
        <ctl name="SpkrRight VISENSE Switch" value="1" />
        <ctl name="SpkrRight SWR DAC_Port Switch" value="1" />
    </path>

All we have to do is replace the right speaker's config, with the left speaker's config like so.

    <path name="speaker-mono">
        <ctl name="COMP7 Switch" value="1" />
        <ctl name="SLIM RX0 MUX" value="AIF_MIX1_PB" />
        <ctl name="SLIM_0_RX Channels" value="One" />
        <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
        <ctl name="SpkrLeft COMP Switch" value="1" />
        <ctl name="SpkrLeft BOOST Switch" value="1" />
        <ctl name="SpkrLeft VISENSE Switch" value="1" />
        <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
    </path>

    <path name="speaker-mono-2">
        <ctl name="COMP7 Switch" value="1" />
        <ctl name="SLIM RX0 MUX" value="AIF_MIX1_PB" />
        <ctl name="SLIM_0_RX Channels" value="One" />
        <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
        <ctl name="SpkrLeft COMP Switch" value="1" />
        <ctl name="SpkrLeft BOOST Switch" value="1" />
        <ctl name="SpkrLeft VISENSE Switch" value="1" />
        <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
    </path>

Now the loud speaker call audio will come out from the left speaker :)