Last active
April 5, 2023 14:00
-
-
Save ThEMarD/cd31bb69731ef004891b128832ed92c3 to your computer and use it in GitHub Desktop.
How to logcat Audio stuff from stock ROMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some stock ROMs don't want you using audio logcat level 7 which is required for the audio logs... so for that? You'll need to root your stock ROM with something like Magisk and then use adb with these commands: | |
adb shell | |
su | |
stop | |
setprop sys.init_log_level 7 | |
logcat -G 4M | |
start | |
exit | |
That should get it working with log level 7 (not sure if that log_level command changed with newer versions of Android as the stock ROM on my LeEco Le Max 2 is marshmallow...) | |
On Some devices like the LeEco Le 2 (s2) you need to enable all logs like this: | |
Press Dialer *#*#76937#*#* | |
Select "Enable All Logs" | |
(special thanks to kiraryu for providing that bit of info) | |
Now you can use commands like this to clear your logcat and then start logging before you check the audio source. | |
adb logcat -c | |
adb logcat *V > logcatname.log | |
And then to find the sources? I search for stuff like out_snd_device or in_snd_device and for video calls on an app like Facebook Messenger you'll be greeted with something like this: | |
audio_hw_primary: select_devices: out_snd_device(25: voice-speaker-nb) in_snd_device(83: voice-speaker-mic) | |
Now we know for our audio what sound device names they use. | |
Now to find the ACDB ID's of both... | |
If you're searching for voice calls? Search for acdb_rx and you should find a line like this: | |
D ACDB-LOADER: ACDB -> send_voice_cal, acdb_rx = 14, acdb_tx = 42, feature_set = 0 | |
rx is sound out, tx is sound in. | |
It's also good to search for echo_reference to see what it's trying to use for echo reference if you're trying to fix noise cancelling issues during voice calls and you'll find a line like this: | |
D msm8974_platform: platform_set_echo_reference: enabling echo-reference-audio-ec-speaker | |
So using these examples, we could build a text file with our notes of actual sound device names and the ACDB ID's we need for them. | |
Facebook speaker VoIP Call Out: | |
out_snd_device(25: voice-speaker-nb) | |
in_snd_device(83: voice-speaker-mic) | |
acdb_id = 14 | |
acdb_id = 42 | |
platform_set_echo_reference: enabling echo-reference-audio-ec-speaker | |
For just audio recording or sound out? you'll want to search for either out_snd_device or in_snd_device and for my example I'll use Telegram audio recording and you'll come across something like this: | |
D audio_hw_primary: select_devices: out_snd_device(0: ) in_snd_device(61: handset-mic) | |
and then you'll want to search for acdb_id and you'll come across a line like this: | |
V msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(61) acdb_id(34) | |
Now we know enough to make a table | |
Telegram quicktile Audio Rec: | |
in_snd_device(61: handset-mic) | |
acdb_id = 34 | |
If you're trying to logcat usb headsets and your stock ROM won't allow adb over WiFi?? I'd recommend checking the play store for adb over wifi app as there's some that require root and work fine on my marshmallow stock ROM for my LeEco Le Max 2. | |
Final note, once you have a table of stuff built and you're ready to fix your audio_platform_info.xml? Here's a guide to extract the ACDB ID's and sound device names to reference your table against and see what you need to fix in your files. | |
https://gist.github.com/ThEMarD/0d6041fd38d6147e99130307e094f807 | |
An example of me using the stuff from this guide is here: | |
https://review.lineageos.org/c/LineageOS/android_device_leeco_x2/+/217071 | |
There you go! Good luck! :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment