Fix no sound in incoming calls bug. Sometimes there is no sound in incoming call on Neo Freerunner. I was able to reproduce this bug by applying reverted no_voip.patch and by changing ringtone to this one: http://activationrecord.net/radekp/pub/phonering.wav The problem is caused by unnecessary switching audio states. First when incomming call is picked up, the state is switched to gsmhandset.state and then immediately it's switched to gsmspeakerout.state. The switch to gsmspeakerout.state causes no sound. Now what causes the double state switching. First switch to gsmhandset.state is done when incoming call is picked up. This is handled in CallAudioHandler::activateAudio() and IPC call to setDomain("Phone") is made. Set domain picks up most suitable alsa state which is gsmhandset.state. After that CallAudioHandler::activateAudio() is called second time. This time transferAudio() is called because we have request to set gsm speaker profile and setProfile("PhoneSpeaker") IPC call sets gsmspeakerout.state. The request for gsmspeaker is for some unknown reason set in DialProxy::acceptIncoming() function (as if Speaker key was pressed). So we just remove this request and now state switching for incomming call is handled like this stereoout->gsmhandset->stereoout ^ ^ call picked call ended Logs used to debug this follow: Sat Sep 5 14:08:15 CEST 2009 alsactl called with -f /usr/share/openmoko/scenarios/gsmhandset.state restore Sat Sep 5 14:08:17 CEST 2009 alsactl called with -f /usr/share/openmoko/scenarios/gsmspeakerout.state restore Sat Sep 5 14:08:20 CEST 2009 alsactl called with -f /usr/share/openmoko/scenarios/stereoout.state restore Sep 5 14:09:34 neo Qtopia: AtChat : N : "%CSQ: 21, 99, 2" Sep 5 14:09:34 neo Qtopia: AtChat : N : "+CIEV: 1, 3" Sep 5 14:09:35 neo Qtopia: AtChat : N : "%CPI: 1,4,0,1,1,0,"+420123456789",145,"Evula"" Sep 5 14:09:50 neo Qtopia: AudioState : Trying to set profile to: "PhoneSpeaker" Sep 5 14:09:50 neo Qtopia: AudioState : virtual bool SpeakerphoneAudioState::leave() Sep 5 14:09:50 neo Qtopia: AudioState : HHandsetAudioState::enter() isPhone true Sep 5 14:09:51 neo Qtopia: AudioState : setAudioScenario(); using "/usr/share/openmoko/scenarios/gsmhandset.state" Sep 5 14:09:51 neo Qtopia: AudioState : QAudioStateManager::stateChanged Sep 5 14:09:51 neo Qtopia: AudioState : From State: QAudioStateInfo( true , "Phone" , "PhoneSpeakerphone" , "Speakerphone" , 100 ) 3 Sep 5 14:09:51 neo Qtopia: AudioState : To State: QAudioStateInfo( true , "Phone" , "PhoneSpeaker" , "Handset" , 50 ) 3 Sep 5 14:10:01 neo Qtopia: AudioState : Trying to set profile to: "PhoneSpeakerphone" Sep 5 14:10:02 neo Qtopia: AudioState : virtual bool SpeakerphoneAudioState::enter(QAudio::AudioCapability) Sep 5 14:10:02 neo Qtopia: AudioState : setAudioScenario(); using "/usr/share/openmoko/scenarios/gsmspeakerout.state" Sep 5 14:10:02 neo Qtopia: AudioState : QAudioStateManager::stateChanged Sep 5 14:10:03 neo Qtopia: AudioState : From State: QAudioStateInfo( true , "Phone" , "PhoneSpeaker" , "Handset" , 50 ) 3 Sep 5 14:10:03 neo Qtopia: AudioState : To State: QAudioStateInfo( true , "Phone" , "PhoneSpeakerphone" , "Speakerphone" , 100 ) 3 Sep 5 14:10:17 neo Qtopia: AtChat : T : "^Z" Sep 5 14:10:19 neo Qtopia: AudioState : Finding highest priority state for domain: "Media" and capability: 2 Sep 5 14:10:19 neo Qtopia: AudioState : AudioState found was: QAudioStateInfo( true , "Media" , "MediaSpeaker" , "Stereo Speaker" , 150 ) Sep 5 14:10:19 neo Qtopia: AudioState : virtual bool SpeakerphoneAudioState::leave() Sep 5 14:10:19 neo Qtopia: AudioState : MediaSpeakerAudioState::enter() isPhone true Sep 5 14:10:19 neo Qtopia: AtChat : W : "" Sep 5 14:10:19 neo Qtopia: AtChat : W : "OK" Sep 5 14:10:19 neo Qtopia: AtChat : T : "AT+CHLD=1" Sep 5 14:10:19 neo Qtopia: AtChat : N : "%CPI: 1,1,0,0,1,0,"+420123456789",145,"Evula"" Sep 5 14:10:20 neo Qtopia: AtChat : F : "OK" Sep 5 14:10:20 neo Qtopia: AtChat : N : "%CPI: 1,7,0,0,1,0,"+420123456789",145,"Evula"" Sep 5 14:10:20 neo Qtopia: AudioState : setAudioScenario(); using "/usr/share/openmoko/scenarios/stereoout.state" Sep 5 14:10:20 neo Qtopia: AudioState : QAudioStateManager::stateChanged Sep 5 14:10:20 neo Qtopia: AudioState : From State: QAudioStateInfo( true , "Phone" , "PhoneSpeakerphone" , "Speakerphone" , 100 ) 3 Sep 5 14:10:20 neo Qtopia: AudioState : To State: QAudioStateInfo( true , "Media" , "MediaSpeaker" , "Stereo Speaker" , 150 ) 2 Sep 5 14:10:24 neo Qtopia: AtChat : N : "%CSQ: 26, 99, 3" Sep 5 14:10:24 neo Qtopia: AtChat : N : "+CIEV: 1, 4" Sep 5 14:11:06 neo Qtopia: AtChat : N : "%CSQ: 23, 99, 2" Sep 5 14:11:06 neo Qtopia: AtChat : N : "+CIEV: 1, 4" ============ From mediaserver process #0 0x42101bf8 in setAudioScenario(NeoAudioScenario) () from /opt/qtmoko/plugins/audiohardware/libneoaudiohardware.so #1 0x4210254c in HandsetAudioState::enter(QAudio::AudioCapability) () from /opt/qtmoko/plugins/audiohardware/libneoaudiohardware.so #2 0x4034060c in QAudioStateManagerPrivate::setState(QAudioState*, QAudio::AudioCapability) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #3 0x40341758 in QAudioStateManagerPrivate::setDefaultState(QByteArray const&, QAudio::AudioCapability) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #4 0x40341ad4 in QAudioStateManager::setDomain(QByteArray const&, QAudio::AudioCapability) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #5 0x40343ef4 in QAudioStateManagerService::setDomain(QByteArray const&, int) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #6 0x40354dac in QAudioStateManagerService::qt_metacall(QMetaObject::Call, int, void**) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #7 0x40716bcc in QSlotInvoker::invoke(QList const&) () from /opt/qtmoko/lib/libqtopiabase.so.4 #8 0x4072a960 in QtopiaIpcAdaptor::received(QString const&, QByteArray const&) () from /opt/qtmoko/lib/libqtopiabase.so.4 #9 0x4072ba40 in ?? () from /opt/qtmoko/lib/libqtopiabase.so.4 #10 0x4072ba40 in ?? () from /opt/qtmoko/lib/libqtopiabase.so.4 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) c Continuing. Breakpoint 1, 0x42101bf8 in setAudioScenario(NeoAudioScenario) () from /opt/qtmoko/plugins/audiohardware/libneoaudiohardware.so (gdb) bt #0 0x42101bf8 in setAudioScenario(NeoAudioScenario) () from /opt/qtmoko/plugins/audiohardware/libneoaudiohardware.so #1 0x421023f4 in SpeakerphoneAudioState::enter(QAudio::AudioCapability) () from /opt/qtmoko/plugins/audiohardware/libneoaudiohardware.so #2 0x4034060c in QAudioStateManagerPrivate::setState(QAudioState*, QAudio::AudioCapability) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #3 0x40342820 in QAudioStateManagerPrivate::setProfile(QByteArray const&) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #4 0x40342890 in QAudioStateManager::setProfile(QByteArray const&) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #5 0x40343f2c in QAudioStateManagerService::setProfile(QByteArray const&) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #6 0x40354df8 in QAudioStateManagerService::qt_metacall(QMetaObject::Call, int, void**) () from /opt/qtmoko/lib/libqtopiaaudio.so.4 #7 0x40716bcc in QSlotInvoker::invoke(QList const&) () from /opt/qtmoko/lib/libqtopiabase.so.4 #8 0x4072a960 in QtopiaIpcAdaptor::received(QString const&, QByteArray const&) () from /opt/qtmoko/lib/libqtopiabase.so.4 #9 0x4072ba40 in ?? () from /opt/qtmoko/lib/libqtopiabase.so.4 #10 0x4072ba40 in ?? () from /opt/qtmoko/lib/libqtopiabase.so.4 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) info display There are no auto-display expressions now. (gdb) help List of classes of commands: ============ From phone Breakpoint 1, 0x001afe58 in CallAudioHandler::activateAudio(bool) () (gdb) bt #0 0x001afe58 in CallAudioHandler::activateAudio(bool) () #1 0x001d28c0 in ThemedCallScreenView::stateChanged() () #2 0x00262308 in PhoneLauncher::stateChanged() () #3 0x002b452c in PhoneLauncher::qt_metacall(QMetaObject::Call, int, void**) () #4 0x41724850 in QMetaObject::activate(QObject*, int, int, void**) () from /opt/qtmoko/lib/libQtCore.so.4 #5 0x002accac in DialerControl::stateChanged() () #6 0x001e07a0 in DialerControl::callStateChanged(QPhoneCall const&) () #7 0x002ad344 in DialerControl::qt_metacall(QMetaObject::Call, int, void**) () #8 0x41724850 in QMetaObject::activate(QObject*, int, int, void**) () from /opt/qtmoko/lib/libQtCore.so.4 #9 0x40201de8 in ?? () from /opt/qtmoko/lib/libqtopiaphone.so.4 #10 0x40201de8 in ?? () from /opt/qtmoko/lib/libqtopiaphone.so.4 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) c Continuing. Breakpoint 2, 0x001b055c in CallAudioHandler::transferAudio(QByteArray const&) () (gdb) bt #0 0x001b055c in CallAudioHandler::transferAudio(QByteArray const&) () #1 0x001b0438 in CallAudioHandler::activateAudio(bool) () #2 0x001d28c0 in ThemedCallScreenView::stateChanged() () #3 0x00262308 in PhoneLauncher::stateChanged() () #4 0x002b452c in PhoneLauncher::qt_metacall(QMetaObject::Call, int, void**) () #5 0x41724850 in QMetaObject::activate(QObject*, int, int, void**) () from /opt/qtmoko/lib/libQtCore.so.4 #6 0x002accac in DialerControl::stateChanged() () #7 0x001e07a0 in DialerControl::callStateChanged(QPhoneCall const&) () #8 0x002ad344 in DialerControl::qt_metacall(QMetaObject::Call, int, void**) () #9 0x41724850 in QMetaObject::activate(QObject*, int, int, void**) () from /opt/qtmoko/lib/libQtCore.so.4 #10 0x40201de8 in ?? () from /opt/qtmoko/lib/libqtopiaphone.so.4 #11 0x40201de8 in ?? () from /opt/qtmoko/lib/libqtopiaphone.so.4 Backtrace stopped: previous frame identical to this frame (corrupt stack?) # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: src/server/phone/telephony/dialproxy/dialproxy.cpp # # Untracked files: # (use "git add ..." to include in what will be committed) # # 0001-Added-support-of-uploading-screenshots-to-scap.linux.patch # 0001-PackageManager-recieving-of-package-list-works-aga.patch # config.cache # config.status # keyboard_open_by_path.patch # sdk/ # src/3rdparty/applications/arora/ # src/3rdparty/applications/arora2/ # src/3rdparty/applications/qmplayer/Makefile # src/3rdparty/applications/qmplayer/moc_qmplayer.cpp # src/3rdparty/applications/qmplayer/qmplayer # src/3rdparty/applications/qmplayer/qmplayer.pro.user # src/3rdparty/applications/qx/Makefile # src/3rdparty/applications/qx/fullscreen.cpp # src/3rdparty/applications/qx/fullscreen.h # src/3rdparty/applications/qx/fullscreenwidget.cpp # src/3rdparty/applications/qx/fullscreenwidget.h # src/3rdparty/applications/qx/moc_apprunningscreen.cpp # src/3rdparty/applications/qx/moc_qx.cpp # src/3rdparty/applications/qx/qx # src/3rdparty/applications/qx/qx.pro.user # src/3rdparty/applications/qx_helper/qbuild.pro # src/build/mkconf/build_mkconfargs # src/build/mkconf/configure # src/build/mkconf/force_build_mkconfargs # src/build/mkconf/mkconfargs # src/build/mkconf/userargs # udev_dump.patch # vt.patch