Trying to fix the bug with using headphones/line-out without mic [SOLVED]
The solution:
http://forum.xda-developers.com/show...8&postcount=14
I'm trying to fix the bug that when using normal stereo headphones (without mic) or a 3.5mm jack -> 2xrca cable is used, the internal mic is disabled.
I've gotten so far that I have modified rpc_server_handset.c to set value of /sys/class/switch/h2w/state to 2 when headphones are inserted.
Now logcat shows:
Quote:
V/HeadsetObserver( 148): Intent.ACTION_HEADSET_PLUG: state: 1 name: ksatta headphones mic: 0
D/musicUtils( 829): wired_headset
E/AudioFlinger( 96): EQtype is 0, deviceType is 0
E/SRS_wowhd_binder( 96): startEqualizer EQtype is 0, deviceType is 0
E/SRS_wowhd_binder( 96): startEqualizer bSpeaker is 0
E/SRS_wowhd_binder( 96): equalizer1 EQtype = Default
|
Without the modifications logcat shows:
Quote:
V/HeadsetObserver( 149): Intent.ACTION_HEADSET_PLUG: state: 1 name: Headset mic: 1
D/musicUtils( 788): speaker
E/AudioFlinger( 96): EQtype is 0, deviceType is 2
E/SRS_wowhd_binder( 96): startEqualizer EQtype is 0, deviceType is 2
E/SRS_wowhd_binder( 96): startEqualizer bSpeaker is 1
E/SRS_wowhd_binder( 96): equalizer1 EQtype = Default
|
So the logs look like my mod is working correctly, however now I can't hear anything from the phone or headphones and also the internal mic is disabled. I've been trying to debug this further, but I can't find where the SRS_wowhd_binder, musicUtils and AudioFlinger logs are generated. Looks like huawei modified some other files than the kernel files, but they haven't released sources for those?
I've tried tags android-2.2.1_r2 and android-2.2.1_r1 from android.git.kernel.org, I found the line where "Intent.ACTION_HEADSET_PLUG: state:..." is logged from HeadsetObserver.java, but I haven't found the others.
Looking further into this..
Anyone have any ideas/suggestions?
edit: looks like Huawei has modified AudioService.class from framework.jar. AudioService handles ACTION_HEADSET_PLUG and and determines if a headset or headphone is connected. Next I think I'll try to decompile the classes and see what's been changed. Or then I'll just try to stick the git version of AudioService on the phone (I wonder what other consequences this'll have, AudioServer handles a bunch of other stuff too).
edit2: I decompiled the phone's AudioService class, it totally ignores the microphone=0 variable

Jeez, I wonder why Huawei is cheaper than some others.. Oh well, it's possible to fix. Next step is to edit the decompiled AudioService class and see if that works. Progress
edit3: Actually looks the mic = 0 isn't ignored, the decompiled class just looks really funky. For example "while (true) { return; ...". Might be effects of the decompilation process. Investigating further. The problem might also be in the native libmedia.so
edit4: I found this:
http://code.google.com/p/toggleheadset2/ It is used to set output and input to headset.
Might be easiest to fix using a similar way to set output to headphones/line-out and leave the internal mic on.. Looking into that now, I'll post here if I get it to work.