[Samsung Galaxy Tab E  ROMs, Kernels, Recoveries, &] vaihaito:
I've tried to add audio support.

The initial error message is

03-24 15:06:56.933 211 211 E SoundTriggerHwService: couldn't load sound trigger module sound_trigger.primary (No such file or directory)
03-24 15:07:09.331 484 484 W SoundTriggerHelper: listModules status=0, # of modules=0

I've compared the code with CM11, and changed these items:

- Deactivated generic audio, activated tinyalsa

- Added PRODUCT_PACKAGES for audio

- Added PRODUCT_COPY_FILES for audio

- I have copied the audio directory android_hardware_sprd/audio/ to hardware/sprd

Looking at hardware/sprd/audio/sc8830/Android.mk: The hw specific audio drivers are only compiled, when BOARD_USES_TINYALSA_AUDIO is true.

As a result specific sc8830 audio object files turn up in the package:

./target/product/gtelwifi/system/lib/hw/audio.primary.sc8830.so

./target/product/gtelwifi/system/lib/hw/audio_policy.sc8830.so

and these are loaded, but it crashes (parsing XML):

03-28 08:02:57.892 204 204 W audio_hw_primary: adev_open
03-28 08:02:57.892 204 204 E audio_hw_primary: ----adev_modem_i2s_parse----000-
03-28 08:02:57.897 204 204 I audio_hw_primary: The device name is sc8830-audio
03-28 08:02:57.898 204 204 D audio_hw_primary: The modem num is '2'
03-28 08:02:57.898 204 204 D audio_hw_primary: peter: modem num is 2
--------- beginning of crash
03-28 08:02:57.898 204 204 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 204 (audioserver)
03-28 08:02:57.908 178 178 W : debuggerd: handling request: pid=204 uid=1041 gid=1005 tid=204
03-28 08:02:57.922 235 235 I cm : Welcome to Android 7.1.2 / LineageOS-14.1-20180328-UNOFFICIAL-gtelwifi
03-28 08:02:57.942 241 241 E : debuggerd: Unable to connect to activity manager (connect failed: Connection refused)
03-28 08:02:57.993 241 241 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-28 08:02:57.993 241 241 F DEBUG : LineageOS Version: '14.1-20180328-UNOFFICIAL-gtelwifi'
03-28 08:02:57.993 241 241 F DEBUG : Build fingerprint: 'samsung/gtelwifixx/gtelwifi:4.4.4/KTU84P/T560XXU0APL1:user/release-keys'
03-28 08:02:57.993 241 241 F DEBUG : Revision: '0'
03-28 08:02:57.993 241 241 F DEBUG : ABI: 'arm'
03-28 08:02:57.994 241 241 F DEBUG : pid: 204, tid: 204, name: audioserver >>> /system/bin/audioserver <<<
03-28 08:02:57.994 241 241 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
03-28 08:02:57.994 241 241 F DEBUG : r0 00000000 r1 b6df6f78 r2 00000000 r3 00000000
03-28 08:02:57.994 241 241 F DEBUG : r4 b618d200 r5 be957678 r6 ffffffff r7 00000000
03-28 08:02:57.994 241 241 F DEBUG : r8 00000000 r9 b61a1c60 sl b618e524 fp b618e520
03-28 08:02:57.994 241 241 F DEBUG : ip b6df6f78 sp be9573b8 lr b6dec533 pc b6ac82dc cpsr a0030030
03-28 08:02:58.003 241 241 F DEBUG :
03-28 08:02:58.003 241 241 F DEBUG : backtrace:
03-28 08:02:58.003 241 241 F DEBUG : #00 pc 000182dc /system/lib/libc.so (strcmp+47)
03-28 08:02:58.003 241 241 F DEBUG : #01 pc 0001452f /system/lib/hw/audio.primary.sc8830.so
03-28 08:02:58.003 241 241 F DEBUG : #02 pc 000067d1 /system/lib/libexpat.so
03-28 08:02:58.003 241 241 F DEBUG : #03 pc 00005b97 /system/lib/libexpat.so
03-28 08:02:58.003 241 241 F DEBUG : #04 pc 00005609 /system/lib/libexpat.so
03-28 08:02:58.003 241 241 F DEBUG : #05 pc 000042f7 /system/lib/libexpat.so
03-28 08:02:58.003 241 241 F DEBUG : #06 pc 00003f23 /system/lib/libexpat.so (XML_ParseBuffer+82)
03-28 08:02:58.003 241 241 F DEBUG : #07 pc 0000e50f /system/lib/hw/audio.primary.sc8830.so
03-28 08:02:58.003 241 241 F DEBUG : #08 pc 000248cf /system/lib/libaudioflinger.so
03-28 08:02:58.004 241 241 F DEBUG : #09 pc 0002804b /system/lib/libaudioflinger.so
03-28 08:02:58.004 241 241 F DEBUG : #10 pc 0000bb33 /system/lib/libaudiopolicyservice.so
03-28 08:02:58.004 241 241 F DEBUG : #11 pc 00024385 /system/lib/libaudiopolicymanagerdefault.so (_ZN7android18AudioPolicyManagerC1EPNS_26AudioPolicyClientInterfaceE+692)
03-28 08:02:58.004 241 241 F DEBUG : #12 pc 0000082f /system/lib/libaudiopolicymanager.so (createAudioPolicyManager+14)
03-28 08:02:58.004 241 241 F DEBUG : #13 pc 0000603f /system/lib/libaudiopolicyservice.so
03-28 08:02:58.004 241 241 F DEBUG : #14 pc 00001d8f /system/bin/audioserver
03-28 08:02:58.004 241 241 F DEBUG : #15 pc 0000182b /system/bin/audioserver
03-28 08:02:58.004 241 241 F DEBUG : #16 pc 00016c7d /system/lib/libc.so (__libc_init+48)
03-28 08:02:58.004 241 241 F DEBUG : #17 pc 0000156c /system/bin/audioserver

Before digging further into this:

- Is it better to select "generic audio"? Or is it better to go the "tiny alsa + Speadtrum" way?

- How can I find the source code line based on the backtrace?

- Can I attach a debugger via adb?

- Is it possible to replace only the XML file and/or audio.primary.sc8830.so?

- Any other suggestions?

Ciao

V.

P. S. Added the patch as attachment