RIL: return error to requests when freeze is going on
authorPaul Kocialkowski <contact@paulk.fr>
Fri, 31 Aug 2012 16:19:37 +0000 (18:19 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Fri, 31 Aug 2012 16:19:37 +0000 (18:19 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
at.c
hayes-ril.c

diff --git a/at.c b/at.c
index b0d47c9..427292b 100644 (file)
--- a/at.c
+++ b/at.c
@@ -690,6 +690,8 @@ void at_handling_init(void)
        pthread_mutex_init(&(at_handling.sync_requests_queue.mutex), NULL);
        pthread_mutex_init(&(at_handling.async_requests_queue.mutex), NULL);
 
+       at_handling.freeze = AT_FREEZE_OFF;
+
        // First lock to the queues mutexes
        AT_RESPONSES_QUEUE_LOCK();
        AT_SYNC_QUEUE_LOCK();
index 50b4701..4a66fd0 100644 (file)
@@ -35,6 +35,11 @@ struct ril_dispatch_unsol ril_dispatch_unsol[] = {
 
 void ril_on_request(int request, void *data, size_t length, RIL_Token t)
 {
+       if(at_freeze_get() != AT_FREEZE_OFF) {
+               RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0);
+               return;
+       }
+
        switch(request) {
                // Power
                case RIL_REQUEST_RADIO_POWER: