Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deadman96385/97c804bcceb9d4f18602ae2673062900 to your computer and use it in GitHub Desktop.
Save deadman96385/97c804bcceb9d4f18602ae2673062900 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment