Skip to content

Instantly share code, notes, and snippets.

@ThEMarD
Last active May 8, 2023 04:36
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ThEMarD/0d6041fd38d6147e99130307e094f807 to your computer and use it in GitHub Desktop.
Save ThEMarD/0d6041fd38d6147e99130307e094f807 to your computer and use it in GitHub Desktop.
How to use acdb_get & get_snd_names
First you'll need to clone acdb_extract. I used the one by J510-Dev which is originally based on the one by luca020400.
git clone https://github.com/J510-Dev/acdb_extract
Then, as the README says you must generate the acdb header. For Qualcomm devices? The stock audio hal would be audio.primary.msm8996.so which is found on my stock ROM from /system/lib/hw/audio.primary.msm8996.so which I could just copy into the acdb_get folder... so for example, I'd use this:
./generate_acdb_data.sh audio.primary.msm8996.so
which will generate a file called acdb_data.h which is needed for the next step.
Since acdb_extract doesn't require being built in the AOSP environment? You can just build it using...
make acdb_extract
then using the same audio HAL as before? You would then use the acdb_extract script. My example would be...
./acdb_extract audio.primary.msm8996.so > acdb_table.txt
You can of course change the output file name to whatever you want, but this will give you an acdb_table.txt with all the ACDB ID's it can find from this Audio HAL. Sometimes though? You might be unfortunate enough to have an OEM who uses all kinds of haxxs in their audio HAL which will result in a lot of these ACDB ID's being wrong... so it's recommended to also check the audio_platform_info.xml to see what they have there and pray that it's the right ACDB ID's... worst case if they're not? You'll need to logcat your stock ROM to find the actual ACDB ID's like this gist I wrote here:
https://gist.github.com/ThEMarD/cd31bb69731ef004891b128832ed92c3
get_snd_dev_names is a little tougher to do as it does require to be built in the AOSP environment. In my example since my stock ROM is marshmallow? I used the LeEco Le Max 2 repos for LineageOS 13.0 which worked fine for me.
Either git clone the acdb_get into the device tree folder or copy and paste it from the last place you git clone'd it from... then add this to your device.mk
# get snd dev names
PRODUCT_PACKAGES += \
get_snd_dev_names
and save the device.mk and then build the ROM.
Then search your out/target/product/*Insert_Product_Name_here* folder for get_snd_dev_names but it should be in system/bin.
If it's there? Good! Copy it to your device and then open a local terminal app and give it root permissions.
Now, copy that bin /data/data/ folder within a folder in there so you can give it execute permissions. I was lazy and copied mine to in /data/data/com.topjohnwu.magisk/
then cd into the folder you placed it in and...
chmod a+x get_snd_dev_names
just like my acdb_extract guide? the Audio HAL for Qualcomm devices will have a name like audio.primary.msm8996.so which I'll be using in my example like this:
./get_snd_dev_names /system/lib/hw/audio.primary.msm8996.so > /sdcard/device_names.h
sweet! Now on the root of your user data storage you'll have that device_names.h file with all your device names. You might need to clean it up as it's not perfect and sometimes needs to be fixed.
An example of me using the stuff from this guide is here:
https://review.lineageos.org/c/LineageOS/android_device_leeco_x2/+/217071
@Claymore1297
Copy link

solved speaker-protection issue on hima-family - thank you very much for this nice tutorial! :-)

@ThEMarD
Copy link
Author

ThEMarD commented Jun 2, 2019

Heyyo Claymore1297, glad it helped! :)

I still have my old HTC One M7 and it was my first Android smartphone and I loved that thing! If their prices weren't so high compared to some of the most cost-effective Android brands? I probably would have gotten one of those HTC 10's or something instead of my LeEco Le Max 2... but I guess HTC does compete in the Android space in a different manner than some of the cheaper priced brands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment