Hi,

I got the audio control values using script get_control_values.sh and
took the difference between in-call and out-of-call controls on
LineageOS. Below is controls.txt for in-call.

====Start of file controls.txt====
24      IN2L Volume     28
31      MIXINL IN1L Volume      0
67      Speaker Mixer Volume    0
68      Speaker Volume  0
71      Speaker Boost Volume    0
77      LINEOUT1N Switch        1
78      LINEOUT1P Switch        1       
99      AIF1DAC1 EQ Switch      0
118     AIF1ADC1 HPF Switch     0
152     SPK Switch      0
153     RCV Switch      1       
186     DAC1R Mixer AIF2 Switch 1
191     DAC1L Mixer AIF2 Switch 1
====End of file controls.txt====

I then installed scintill's version of Replicant 6, dialled a call and
ran set_control_values. Unfortunately I did not get audio. Here is the
output.

====Start of output from set_control_values.sh====
./set_control_values.sh controls_call.txt
       < Attempting to set controls, saving old controls to reverse.txt
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting IN2L Volume to 28
... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting MIXINL IN1L Volume
to 0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting Speaker Mixer
Volume to 0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting Speaker Volume to
0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting Speaker Boost
Volume to 0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting LINEOUT1N Switch
to 1 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting LINEOUT1P Switch
to 1 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting AIF1DAC1 EQ Switch
to 0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting AIF1ADC1 HPF
Switch to 0 ... Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting SPK Switch to 0 ...
Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting RCV Switch to 1 ...
Successfully set control
WARNING: linker: ./tinymix has text relocations. This is wasting memory
and prevents security hardening. Please fix. Setting DAC1R Mixer AIF2
Switch to 1 ... Successfully set control
====End of output from set_control_values.sh====

You will see that there is lots of warnings. This is because I used a
compiled version of tinymix. The script set_control_values.sh requires
this version. (I get "Invalid control" errors when using the default
version of tinymix and this script on replicant 6.)

Below are the last versions of the scripts I used; get_control_values.sh
and set_control_values.sh . The former generates controls.txt.
The latter uses controls.txt and saves a file called reverse.txt, so
you can reverse the settings once you exit call.

I don't know what to do now regarding the device. I will probably try
pmos and modify the firmware loading script as was the suggestion by
Jack Knightly previously on this list. All the best, Josh.

====Start of script get_control_values.sh====
#!/system/bin/sh
#run with: ./get_control_values.sh 2>/dev/null 1>controls.txt
#format: <control num> <control name> <value>

if [ "$(which tinymix)" = "" ]; then
        tinymix="./tinymix"
else
        tinymix="tinymix"
fi

if [ "$tinymix" = "tinymix" ]; then
        controls="$($tinymix -D 0)"
        first="no"
        second="no"
        third="no"
        printf "%s\n" "$controls" | while read line; do
                if [ "$first" = "yes" ]; then
                        if [ "$second" = "yes" ]; then
                                if [ "$third" = "yes" ]; then
                                        value="$(echo "$line" | grep -o
"  .*" | grep -o "[A-Z|a-z|0-9].*")"

                                        if [ "$(echo "$value" | grep
                                        "(")" != "" ]; then
                                        value="$(echo "$value" | cut -d
                                        '(' -f1 2>/dev/null)" elif [
                                        "$(echo "$value" | grep ">")"
                                        != "" ]; then value="$(echo
                                        "$value" | cut -d '>' -f2
                                        2>/dev/null | cut -d ',' -f1 |
                                        tr -d " ")" elif [ "$(echo
                                        $value | cut -d ',' -f1)" =
                                        "Off" ]; then value="0" elif [
                                        "$(echo $value | cut -d ','
                                        -f1)" = "On" ]; then value="1"
                                        fi

                                        printf "%s\t%s\t%s\n" "$(echo
                                        "$line" | cut -f 1)" "$(echo
                                        "$line" | cut -f 4 | rev | grep
                                        -o "  .*" | grep -o
                                        "[A-Z|a-z|0-9].*" | rev)"
                                        "$value" fi third="yes" fi
                                        second="yes" fi first="yes"
        done
else
        controls="$($tinymix -D 0 controls)"

        first="no"
        second="no"
        printf "%s\n" "$controls" | while read line; do
                if [ "$first" = "yes" ]; then
                        if [ "$second" = "yes" ]; then
                                value="$($tinymix -D 0 get $(echo
        "$line" | cut -f1) | cut -d "(" -f1)" if [ "$(echo "$value" |
        grep "(")" != "" ]; then value="$(echo "$value" | cut -d '('
        -f1 2>/dev/null)" elif [ "$(echo "$value" | grep ">")" != "" ];
        then value="$(echo "$value" | cut -d '>' -f2 2>/dev/null | cut
        -d ',' -f1 | tr -d " ")" elif [ "$(echo $value | cut -d ','
        -f1)" = "Off" ]; then value="0"
                                elif [ "$(echo $value | cut -d ','
        -f1)" = "On" ]; then value="1"
                                fi
                                printf "%s\t%s\t%s\n" "$(echo "$line" |
        cut -f1)" "$(echo "$line" | cut -f 4)" "$value" fi
                        second="yes"
                fi
        first=yes
        done

fi
====End of script get_control_values.sh====

====Start of script set_control_values.sh====
#!/system/bin/sh
#run with
#./set_control_values.sh controls.txt
#or
#./set_control_values.sh reverse
#to reverse
#
#format: <control num> <control name> <value>
thefile=""
if [ "$1" = "reverse" ]; then
        echo "Reversing controls with reverse.txt"
        thefile="reverse.txt"
elif [ -f "$1" ]; then
        echo "Attempting to set controls, saving old controls to
reverse.txt" thefile="$1"
else
        echo "Argv1: [ <control file> | "reverse"]"
        exit
fi

tinymix="./tinymix"

if [ "$thefile" != "reverse.txt" ]; then 
        if [ -f "reverse.txt" ]; then
                rm "reverse.txt" 
        fi
fi

cat "$thefile" | while read line; do
control="$(echo "$line" | cut -f 2)"
oldvalue="$($tinymix -D 0 get "$control")"
        if [ "$(echo "$oldvalue" | grep "(")" != "" ]; then
                oldvalue="$(echo "$oldvalue" | cut -d '(' -f1
2>/dev/null)" elif [ "$(echo "$oldvalue" | grep ">")" != "" ]; then
                oldvalue="$(echo "$oldvalue" | cut -d '>' -f2
2>/dev/null | cut -d ',' -f1 | tr -d " ")" elif [ "$(echo $oldvalue |
2>cut -d ',' -f1)" = "Off" ]; then
                oldvalue="0"
        elif [ "$(echo $oldvalue | cut -d ',' -f1)" = "On" ]; then
                oldvalue="1"
        fi

if [ "$thefile" != "reverse.txt" ]; then 
        printf "%s\t%s\t%s\n" "$(echo "$line" | cut -f1)" "$control"
"$oldvalue" >> "reverse.txt" fi

value="$(echo "$line" | cut -f 3)"
        if [ "$value" != "unknown" ] && [ "$value" != "" ]; then
                echo "Setting $control to $value ..."
                checkforerror="$($tinymix set "$control" "$value" 2>&1)"
                if [ "$?" = 0 ] && [ "$(echo "$checkforerror" | grep
"Error:")" = "" ] && [ "$(echo "$checkforerror" | grep "Invalid")" = ""
]; then echo "Successfully set control" else
                        if [ "$(echo "$checkforerror" | grep "Error:")"
!= "" ]; then echo "$(echo $checkforerror | grep -o "Error:.*")"
                        fi
                fi
        else
                echo "Not setting; value is unknown or blank"
        fi
done
====End of script set_control_values.sh====
_______________________________________________
Replicant mailing list
Replicant@osuosl.org
https://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to