phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.36k stars 658 forks source link

[Moto E5] Audio jack not working for TRS connections #386

Open malfatti opened 5 years ago

malfatti commented 5 years ago

Hello!

I have a Moto E5 Nora XT1944-4, and I'm using AOSP v109 vanilla-nosu, magisk installed, no audio mods enabled. Amazing ROM, using it for ~1 week :D

I noticed that if I plug a 4-pin (TRRS) earphone, everything works as expected, sound is routed to earphones and phone speaker is muted. If instead I plug a 3-pin (TRS) earphone, the sound is not routed to the earphones and keeps playing through phone speaker. Maybe it is something related to the mic not being detected (because plugging a TRS male in a TRRS female connects the last ring to the sleeve, usually connecting the microphone input to ground).

Here are the (trimmed) logs. I started playing music, plug a TRRS earphone, locked screen, unplugged the TRRS earphone and repeated the process for a TRS computer speaker box.

dmesg.log event.log getevent_TRRS.txt getevent_TRS.txt getprop.txt logcat.log

Cheers :)

phhusson commented 5 years ago

Damn that's a perfect bug report, congrats.

Could you add the result of of adb shell dumpsys media.audio_policy in the three cases? (TRS, TRRS, nothing)

Le jeu. 31 janv. 2019 à 18:23, T. Malfatti notifications@github.com a écrit :

Hello!

I have a Moto E5 Nora XT1944-4, and I'm using AOSP v109 vanilla-nosu, magisk installed, no audio mods enabled. Amazing ROM, using it for ~1 week :D

I noticed that if I plug a 4-pin (TRRS) earphone, everything works as expected, sound is routed to earphones and phone speaker is muted. If instead I plug a 3-pin (TRS) earphone, the sound is not routed to the earphones and keeps playing through phone speaker. Maybe it is something related to the mic not being detected (because plugging a TRS male in a TRRS female connects the last ring to the sleeve, usually connecting the microphone input to ground).

Here are the (trimmed) logs. I started playing music, plug a TRRS earphone, locked screen, unplugged the TRRS earphone and repeated the process for a TRS computer speaker box.

dmesg.log https://github.com/phhusson/treble_experimentations/files/2818301/dmesg.log event.log https://github.com/phhusson/treble_experimentations/files/2818302/event.log getevent_TRRS.txt https://github.com/phhusson/treble_experimentations/files/2818303/getevent_TRRS.txt getevent_TRS.txt https://github.com/phhusson/treble_experimentations/files/2818304/getevent_TRS.txt getprop.txt https://github.com/phhusson/treble_experimentations/files/2818305/getprop.txt logcat.log https://github.com/phhusson/treble_experimentations/files/2818306/logcat.log

Cheers :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/386, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOOkUjQGO6dQBmraQoW1yEItcePuBaks5vIyaOgaJpZM4acx8h .

malfatti commented 5 years ago

Oh crap I was trying to give you everything in the first post :P

Here they are. dumpsys.txt dumpsys_TRRS.txt dumpsys_TRS.txt

The size alone tells me that the TRS and [none] are the same.

Cheers

phhusson commented 5 years ago

Ah I'll need also /vendor/etc/audio_policy_configuration.xml and /vendor/etc/audio/audio_policy_configuration.xml if it exists

Le jeu. 31 janv. 2019 à 18:40, T. Malfatti notifications@github.com a écrit :

Oh crap I was trying to give you everything in the first post :P

Here they are. dumpsys.txt https://github.com/phhusson/treble_experimentations/files/2818373/dumpsys.txt dumpsys_TRRS.txt https://github.com/phhusson/treble_experimentations/files/2818374/dumpsys_TRRS.txt dumpsys_TRS.txt https://github.com/phhusson/treble_experimentations/files/2818375/dumpsys_TRS.txt

The size alone tells me that the TRS and [none] are the same.

Cheers

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/386#issuecomment-459436260, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOOk9b80gjVSQDt4mRSMpXq6vDqPfEks5vIypygaJpZM4acx8h .

malfatti commented 5 years ago

Sure :) I don't have the audio/ folder, and I added the .txt extension because github was refusing to upload a .xml file.

audio_policy_configuration.xml.txt

Cheers

phhusson commented 5 years ago

I can't really see the issue... What I see:

grep 'Audio route' logcat.log 
01-31 13:28:52.277 V/MediaRouter( 2038): Audio routes updated: AudioRoutesInfo{ type=HEADSET }, a2dp=false
01-31 13:29:22.452 V/MediaRouter( 2038): Audio routes updated: AudioRoutesInfo{ type=SPEAKER }, a2dp=false
01-31 13:31:27.062 V/MediaRouter( 2038): Audio routes updated: AudioRoutesInfo{ type=HEADSET }, a2dp=false

So it's detected as headset (not headphone?)

01-31 13:28:51.893 V/WiredAccessoryManager( 1301): notifyWiredAccessoryChanged: when=4822142005000 bits=SW_HEADPHONE_INSERT SW_MICROPHONE_INSERT mask=94
...
01-31 13:31:26.690 V/WiredAccessoryManager( 1301): notifyWiredAccessoryChanged: when=4976938929000 bits=SW_HEADPHONE_INSERT SW_MICROPHONE_INSERT mask=94

It says microphone insert twice, so for both TRS and TRRS? I don't really see any error either...?

malfatti commented 5 years ago

If microphone appears twice in the log then I think of 2 explanations: 1) I put the TRRS twice when I took the log 2) It is trying to enable a microphone for the TRS, but if that was the case the problem would be that I have sound output to phones and no input.

In the dumpsys of None and TRS I see only a difference in device number, while in the TRRS one a lot more changes (I just vimdiff'ed dumpsys.txt and dumpsy_TRS.txt).

Also, upgrading to v110 didn't change anything. I also installed Viper4Android and AudioModificationsLibrary on magisk, and nothing changed regarding the TRS problem.

Sorry I took so long to write back, and thanks a lot for looking into this :) If there is any more info/tests/logs needed just let me know.