From: "Gustavo F. Padovan" <[email protected]>

---
 plugins/sap.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/plugins/sap.c b/plugins/sap.c
index 28b07e7..850ed2f 100644
--- a/plugins/sap.c
+++ b/plugins/sap.c
@@ -127,6 +127,7 @@ static void sap_connect_reply(DBusPendingCall *call, 
gpointer user_data)
        struct sap_data *data = ofono_modem_get_data(modem);
        DBusError derr;
        DBusMessage *reply;
+       int fd, err;
 
        DBG("");
 
@@ -138,16 +139,29 @@ static void sap_connect_reply(DBusPendingCall *call, 
gpointer user_data)
                goto done;
 
        dbus_error_init(&derr);
-       if (!dbus_set_error_from_message(&derr, reply))
+       if (dbus_set_error_from_message(&derr, reply)) {
+
+               DBG("Connect reply: %s", derr.message);
+
+               dbus_error_free(&derr);
                goto done;
+       }
 
-       DBG("Connect reply: %s", derr.message);
+       if (!dbus_message_get_args(reply, NULL, DBUS_TYPE_UNIX_FD, &fd,
+                               DBUS_TYPE_INVALID))
+               goto done;
 
-       ofono_modem_set_powered(modem, FALSE);
+       data->hw_modem = sap_hw_modem;
+       data->sap_driver = sap_hw_driver;
 
-       dbus_error_free(&derr);
+       err = data->sap_driver->enable(data->hw_modem, modem, fd);
+       if (err == -EINPROGRESS) {
+               dbus_message_unref(reply);
+               return;
+       }
 
 done:
+       ofono_modem_set_powered(modem, FALSE);
        dbus_message_unref(reply);
 }
 
-- 
1.7.6.2

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to