[Replicant] PROBING AUDIO LINES ON THE i9305 Samsung Galaxy SIII LTE

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Aug 11 01:54:02 UTC 2023


On Fri, 4 Aug 2023 18:13:04 +0100
J05HYYY <lovell.joshyyy at gmail.com> wrote:

> > alsactl: https://github.com/LineageOS/android_external_alsa-utils
> 
> I am getting too many errors trying to compile this. It would probably
> be easier for me to write (a) busybox/toybox script(s) to save and
> restore settings using tinyalsa utils.
[...]
> On an x86_64 pc I ran alsactl from alsa-utils and stored the card
> setting. I don't think I will be able to replicate the same file
> format/behaviour if I were to write the scripts (unfortunately) ...
> the format looks a bit complicated for me to RE. Instead I will
> probably create a couple CSVs with the controls and their respective
> values, one without dialling and one in-call.
I am probably missing something here. Do you want to run GNU/Linux on
the phone? 

Because if not tinyalsa utils is probably easiest.

For instance here we can dump the status easily:
> $ adb root
> restarting adbd as root
> $ adb shell
> root at i9300:/ # tinymix
> Mixer name: 'Midas_WM1811'
> Number of controls: 260
> ctl	type	num	name                                     value
> 0	ENUM	1	AIF1DRC1 Mode                            voice call DRC
> 1	ENUM	1	AIF1DRC2 Mode                            voice call DRC
> 2	ENUM	1	AIF2DRC Mode                             voice call DRC
> 3	INT	1	AIF1DAC1 EQ1 Volume                      9
> 4	INT	1	AIF1DAC1 EQ2 Volume                      7
> 5	INT	1	AIF1DAC1 EQ3 Volume                      10
> 6	INT	1	AIF1DAC1 EQ4 Volume                      13
> 7	INT	1	AIF1DAC1 EQ5 Volume                      12
> 8	INT	1	AIF1DAC2 EQ1 Volume                      12
> 9	INT	1	AIF1DAC2 EQ2 Volume                      12
> 10	INT	1	AIF1DAC2 EQ3 Volume                      12
> 11	INT	1	AIF1DAC2 EQ4 Volume                      12
> 12	INT	1	AIF1DAC2 EQ5 Volume                      12
> 13	INT	1	AIF2 EQ1 Volume                          12
> 14	INT	1	AIF2 EQ2 Volume                          12
> 15	INT	1	AIF2 EQ3 Volume                          12
> 16	INT	1	AIF2 EQ4 Volume                          12
> 17	INT	1	AIF2 EQ5 Volume                          12
> 18	INT	1	IN1L Volume                              11
> 19	BOOL	1	IN1L Switch                              On
> 20	BOOL	1	IN1L ZC Switch                           Off
> 21	INT	1	IN1R Volume                              10
> 22	BOOL	1	IN1R Switch                              On
> 23	BOOL	1	IN1R ZC Switch                           Off
> 24	INT	1	IN2L Volume                              11
> 25	BOOL	1	IN2L Switch                              On
> 26	BOOL	1	IN2L ZC Switch                           Off
> 27	INT	1	IN2R Volume                              11
> 28	BOOL	1	IN2R Switch                              On
> 29	BOOL	1	IN2R ZC Switch                           Off
> 30	INT	1	MIXINL IN2L Volume                       1
> 31	INT	1	MIXINL IN1L Volume                       1
> 32	INT	1	MIXINL Output Record Volume              0
> 33	INT	1	MIXINL IN1LP Volume                      0
> 34	INT	1	MIXINL Direct Voice Volume               0
> 35	INT	1	MIXINR IN2R Volume                       1
> 36	INT	1	MIXINR IN1R Volume                       1
> 37	INT	1	MIXINR Output Record Volume              0
> 38	INT	1	MIXINR IN1RP Volume                      0
> 39	INT	1	MIXINR Direct Voice Volume               0
> 40	INT	1	Left Output Mixer IN2RN Volume           7
> 41	INT	1	Left Output Mixer IN2LN Volume           7
> 42	INT	1	Left Output Mixer IN2LP Volume           7
> 43	INT	1	Left Output Mixer IN1L Volume            7
> 44	INT	1	Left Output Mixer IN1R Volume            7
> 45	INT	1	Left Output Mixer Right Input Volume     7
> 46	INT	1	Left Output Mixer Left Input Volume      7
> 47	INT	1	Left Output Mixer DAC Volume             7
> 48	INT	1	Right Output Mixer IN2LN Volume          7
> 49	INT	1	Right Output Mixer IN2RN Volume          7
> 50	INT	1	Right Output Mixer IN1L Volume           7
> 51	INT	1	Right Output Mixer IN1R Volume           7
> 52	INT	1	Right Output Mixer IN2RP Volume          7
> 53	INT	1	Right Output Mixer Left Input Volume     7
> 54	INT	1	Right Output Mixer Right Input Volume    7
> 55	INT	1	Right Output Mixer DAC Volume            7
> 56	INT	2	Output Volume                            57 57
> 57	BOOL	2	Output Switch                            On On
> 58	BOOL	2	Output ZC Switch                         Off Off
> 59	BOOL	1	Earpiece Switch                          On
> 60	INT	1	Earpiece Volume                          1
> 61	INT	1	SPKL Input Volume                        1
> 62	INT	1	SPKL IN1LP Volume                        1
> 63	INT	1	SPKL Output Volume                       1
> 64	INT	1	SPKR Input Volume                        1
> 65	INT	1	SPKR IN1RP Volume                        1
> 66	INT	1	SPKR Output Volume                       1
> 67	INT	2	Speaker Mixer Volume                     3 3
> 68	INT	2	Speaker Volume                           57 57
> 69	BOOL	2	Speaker Switch                           On On
> 70	BOOL	2	Speaker ZC Switch                        Off Off
> 71	INT	2	Speaker Boost Volume                     4 4
> 72	ENUM	1	Speaker Reference                        SPKVDD/2
> 73	ENUM	1	Speaker Mode                             Class D
> 74	INT	2	Headphone Volume                         45 45
> 75	BOOL	2	Headphone Switch                         On On
> 76	BOOL	2	Headphone ZC Switch                      Off Off
> 77	BOOL	1	LINEOUT1N Switch                         Off
> 78	BOOL	1	LINEOUT1P Switch                         Off
> 79	INT	1	LINEOUT1 Volume                          1
> 80	BOOL	1	LINEOUT2N Switch                         Off
> 81	BOOL	1	LINEOUT2P Switch                         Off
> 82	INT	1	LINEOUT2 Volume                          1
> 83	INT	2	AIF1ADC1 Volume                          96 96
> 84	INT	2	AIF1ADC2 Volume                          96 96
> 85	INT	2	AIF2ADC Volume                           96 96
> 86	ENUM	1	AIF1ADCL Source                          Left
> 87	ENUM	1	AIF1ADCR Source                          Right
> 88	ENUM	1	AIF2ADCL Source                          Left
> 89	ENUM	1	AIF2ADCR Source                          Right
> 90	ENUM	1	AIF1DACL Source                          Left
> 91	ENUM	1	AIF1DACR Source                          Right
> 92	ENUM	1	AIF2DACL Source                          Left
> 93	ENUM	1	AIF2DACR Source                          Left
> 94	INT	2	AIF1DAC1 Volume                          96 96
> 95	INT	2	AIF1DAC2 Volume                          96 96
> 96	INT	2	AIF2DAC Volume                           96 96
> 97	INT	1	AIF1 Boost Volume                        0
> 98	INT	1	AIF2 Boost Volume                        0
> 99	BOOL	1	AIF1DAC1 EQ Switch                       On
> 100	BOOL	1	AIF1DAC2 EQ Switch                       Off
> 101	BOOL	1	AIF2 EQ Switch                           Off
> 102	BOOL	1	AIF1DAC1 DRC Switch                      Off
> 103	BOOL	1	AIF1ADC1L DRC Switch                     Off
> 104	BOOL	1	AIF1ADC1R DRC Switch                     Off
> 105	BOOL	1	AIF1DAC2 DRC Switch                      Off
> 106	BOOL	1	AIF1ADC2L DRC Switch                     Off
> 107	BOOL	1	AIF1ADC2R DRC Switch                     Off
> 108	BOOL	1	AIF2DAC DRC Switch                       Off
> 109	BOOL	1	AIF2ADCL DRC Switch                      Off
> 110	BOOL	1	AIF2ADCR DRC Switch                      Off
> 111	INT	1	DAC1 Right Sidetone Volume               0
> 112	INT	1	DAC1 Left Sidetone Volume                0
> 113	INT	1	DAC2 Right Sidetone Volume               12
> 114	INT	1	DAC2 Left Sidetone Volume                12
> 115	ENUM	1	Sidetone HPF Mux                         2.7kHz
> 116	BOOL	1	Sidetone HPF Switch                      Off
> 117	ENUM	1	AIF1ADC1 HPF Mode                        HiFi
> 118	BOOL	2	AIF1ADC1 HPF Switch                      Off Off
> 119	ENUM	1	AIF1ADC2 HPF Mode                        HiFi
> 120	BOOL	2	AIF1ADC2 HPF Switch                      Off Off
> 121	ENUM	1	AIF2ADC HPF Mode                         HiFi
> 122	BOOL	2	AIF2ADC HPF Switch                       Off Off
> 123	ENUM	1	ADC OSR                                  High Performance
> 124	ENUM	1	DAC OSR                                  Low Power
> 125	INT	2	DAC1 Volume                              96 96
> 126	BOOL	2	DAC1 Switch                              On On
> 127	INT	2	DAC2 Volume                              96 96
> 128	BOOL	2	DAC2 Switch                              On On
> 129	INT	1	SPKL DAC2 Volume                         1
> 130	INT	1	SPKL DAC1 Volume                         1
> 131	INT	1	SPKR DAC2 Volume                         1
> 132	INT	1	SPKR DAC1 Volume                         1
> 133	INT	1	AIF1DAC1 3D Stereo Volume                0
> 134	BOOL	1	AIF1DAC1 3D Stereo Switch                Off
> 135	INT	1	AIF1DAC2 3D Stereo Volume                0
> 136	BOOL	1	AIF1DAC2 3D Stereo Switch                Off
> 137	INT	1	AIF2DAC 3D Stereo Volume                 0
> 138	BOOL	1	AIF2DAC 3D Stereo Switch                 Off
> 139	INT	1	AIF3 Boost Volume                        0
> 140	BOOL	1	AIF1DAC1 Noise Gate Switch               Off
> 141	ENUM	1	AIF1DAC1 Noise Gate Hold Time            30ms
> 142	INT	1	AIF1DAC1 Noise Gate Threshold Volume     3
> 143	BOOL	1	AIF1DAC2 Noise Gate Switch               Off
> 144	ENUM	1	AIF1DAC2 Noise Gate Hold Time            30ms
> 145	INT	1	AIF1DAC2 Noise Gate Threshold Volume     3
> 146	BOOL	1	AIF2DAC Noise Gate Switch                Off
> 147	ENUM	1	AIF2DAC Noise Gate Hold Time             30ms
> 148	INT	1	AIF2DAC Noise Gate Threshold Volume      3
> 149	BOOL	1	AIF2ADCL DAT Invert                      Off
> 150	BOOL	1	AIF2ADCR DAT Invert                      Off
> 151	BOOL	1	HP Switch                                Off
> 152	BOOL	1	SPK Switch                               On
> 153	BOOL	1	RCV Switch                               Off
> 154	BOOL	1	FM In Switch                             Off
> 155	BOOL	1	LINE Switch                              Off
> 156	BOOL	1	HDMI Switch                              Off
> 157	BOOL	1	Main Mic Switch                          Off
> 158	BOOL	1	Sub Mic Switch                           Off
> 159	BOOL	1	Third Mic Switch                         On
> 160	BOOL	1	Headset Mic Switch                       Off
> 161	ENUM	1	AIF2 Mode                                Slave
> 162	ENUM	1	KPCS Mode                               
> 163	ENUM	1	Input Clamp                              Off
> 164	ENUM	1	LineoutSwitch Mode                       Off
> 165	ENUM	1	AIF2 digital mute                        Off
> 166	ENUM	1	ADCR Mux                                 ADC
> 167	ENUM	1	ADCL Mux                                 ADC
> 168	ENUM	1	Right Headphone Mux                      Mixer
> 169	ENUM	1	Left Headphone Mux                       Mixer
> 170	BOOL	1	SPKR DAC2 Switch                         Off
> 171	BOOL	1	SPKR Input Switch                        Off
> 172	BOOL	1	SPKR IN1RP Switch                        Off
> 173	BOOL	1	SPKR Output Switch                       Off
> 174	BOOL	1	SPKR DAC1 Switch                         On
> 175	BOOL	1	SPKL DAC2 Switch                         Off
> 176	BOOL	1	SPKL Input Switch                        Off
> 177	BOOL	1	SPKL IN1LP Switch                        Off
> 178	BOOL	1	SPKL Output Switch                       Off
> 179	BOOL	1	SPKL DAC1 Switch                         On
> 180	ENUM	1	AIF3ADC Mux                              AIF2ADCDAT
> 181	ENUM	1	AIF2DACR Mux                             AIF2
> 182	ENUM	1	AIF2DACL Mux                             AIF2
> 183	ENUM	1	Mono PCM Out Mux                         None
> 184	ENUM	1	AIF2ADC Mux                              AIF2ADCDAT
> 185	ENUM	1	AIF2DAC Mux                              AIF2DACDAT
> 186	ENUM	1	AIF1DAC Mux                              AIF1DACDAT
> 187	BOOL	1	DAC1R Mixer Right Sidetone Switch        Off
> 188	BOOL	1	DAC1R Mixer Left Sidetone Switch         Off
> 189	BOOL	1	DAC1R Mixer AIF2 Switch                  Off
> 190	BOOL	1	DAC1R Mixer AIF1.2 Switch                Off
> 191	BOOL	1	DAC1R Mixer AIF1.1 Switch                On
> 192	BOOL	1	DAC1L Mixer Right Sidetone Switch        Off
> 193	BOOL	1	DAC1L Mixer Left Sidetone Switch         Off
> 194	BOOL	1	DAC1L Mixer AIF2 Switch                  Off
> 195	BOOL	1	DAC1L Mixer AIF1.2 Switch                Off
> 196	BOOL	1	DAC1L Mixer AIF1.1 Switch                On
> 197	ENUM	1	Right Sidetone                           ADC/DMIC1
> 198	ENUM	1	Left Sidetone                            ADC/DMIC1
> 199	BOOL	1	AIF2DAC2R Mixer Right Sidetone Switch    On
> 200	BOOL	1	AIF2DAC2R Mixer Left Sidetone Switch     Off
> 201	BOOL	1	AIF2DAC2R Mixer AIF2 Switch              Off
> 202	BOOL	1	AIF2DAC2R Mixer AIF1.2 Switch            Off
> 203	BOOL	1	AIF2DAC2R Mixer AIF1.1 Switch            Off
> 204	BOOL	1	AIF2DAC2L Mixer Right Sidetone Switch    Off
> 205	BOOL	1	AIF2DAC2L Mixer Left Sidetone Switch     On
> 206	BOOL	1	AIF2DAC2L Mixer AIF2 Switch              Off
> 207	BOOL	1	AIF2DAC2L Mixer AIF1.2 Switch            Off
> 208	BOOL	1	AIF2DAC2L Mixer AIF1.1 Switch            Off
> 209	BOOL	1	AIF1ADC2R Mixer DMIC Switch              Off
> 210	BOOL	1	AIF1ADC2R Mixer AIF2 Switch              Off
> 211	BOOL	1	AIF1ADC2L Mixer DMIC Switch              Off
> 212	BOOL	1	AIF1ADC2L Mixer AIF2 Switch              Off
> 213	BOOL	1	AIF1ADC1R Mixer ADC/DMIC Switch          On
> 214	BOOL	1	AIF1ADC1R Mixer AIF2 Switch              Off
> 215	BOOL	1	AIF1ADC1L Mixer ADC/DMIC Switch          On
> 216	BOOL	1	AIF1ADC1L Mixer AIF2 Switch              Off
> 217	BOOL	1	LINEOUT2P Mixer Right Output Switch      On
> 218	BOOL	1	LINEOUT2N Mixer Left Output Switch       On
> 219	BOOL	1	LINEOUT2N Mixer Right Output Switch      Off
> 220	BOOL	1	LINEOUT1P Mixer Left Output Switch       On
> 221	BOOL	1	LINEOUT1N Mixer Left Output Switch       Off
> 222	BOOL	1	LINEOUT1N Mixer Right Output Switch      On
> 223	BOOL	1	SPKR Boost Direct Voice Switch           Off
> 224	BOOL	1	SPKR Boost SPKL Switch                   Off
> 225	BOOL	1	SPKR Boost SPKR Switch                   On
> 226	BOOL	1	SPKL Boost Direct Voice Switch           Off
> 227	BOOL	1	SPKL Boost SPKL Switch                   On
> 228	BOOL	1	SPKL Boost SPKR Switch                   On
> 229	BOOL	1	Earpiece Mixer Direct Voice Switch       Off
> 230	BOOL	1	Earpiece Mixer Left Output Switch        On
> 231	BOOL	1	Earpiece Mixer Right Output Switch       On
> 232	BOOL	1	Right Output Mixer Left Input Switch     Off
> 233	BOOL	1	Right Output Mixer Right Input Switch    Off
> 234	BOOL	1	Right Output Mixer IN2LN Switch          Off
> 235	BOOL	1	Right Output Mixer IN2RN Switch          Off
> 236	BOOL	1	Right Output Mixer IN1L Switch           Off
> 237	BOOL	1	Right Output Mixer IN1R Switch           Off
> 238	BOOL	1	Right Output Mixer IN2RP Switch          Off
> 239	BOOL	1	Right Output Mixer DAC Switch            On
> 240	BOOL	1	Left Output Mixer Right Input Switch     Off
> 241	BOOL	1	Left Output Mixer Left Input Switch      Off
> 242	BOOL	1	Left Output Mixer IN2RN Switch           Off
> 243	BOOL	1	Left Output Mixer IN2LN Switch           Off
> 244	BOOL	1	Left Output Mixer IN2LP Switch           Off
> 245	BOOL	1	Left Output Mixer IN1R Switch            Off
> 246	BOOL	1	Left Output Mixer IN1L Switch            Off
> 247	BOOL	1	Left Output Mixer DAC Switch             On
> 248	BOOL	1	MIXINR IN2R Switch                       Off
> 249	BOOL	1	MIXINR IN1R Switch                       Off
> 250	BOOL	1	MIXINL IN2L Switch                       Off
> 251	BOOL	1	MIXINL IN1L Switch                       Off
> 252	BOOL	1	IN2R PGA IN2RP Switch                    On
> 253	BOOL	1	IN2R PGA IN2RN Switch                    On
> 254	BOOL	1	IN2L PGA IN2LP Switch                    On
> 255	BOOL	1	IN2L PGA IN2LN Switch                    On
> 256	BOOL	1	IN1R PGA IN1RP Switch                    On
> 257	BOOL	1	IN1R PGA IN1RN Switch                    On
> 258	BOOL	1	IN1L PGA IN1LP Switch                    On
> 259	BOOL	1	IN1L PGA IN1LN Switch                    On

If your goal is GNU/Linux, you could still do the tests on Android and
then when you have your diff, try to manually do the control changes
with alsamixer or some other tool (and also use alsactl too to be able
to restore before and after your manual changes).

Note that you can still run GNU/Linux in a chroot in the phone but
that's far from trivial to do as the kernel is old, so you'd need to
find an old version of a distribution that works on armv7 and find a
way to copy the chroot to the phone and then use the utilities there to
dump and restore the control states.

This also affect statically compiling things for ARM as here the if the
libc used in the cross compilation is built with kernel headers for
kernels that are too recent that won't work.

Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20230811/3a6611bd/attachment-0001.asc>


More information about the Replicant mailing list