[PATCH 6/6] atmodem: packet switch bearer support

2011-01-20 Thread Rémi Denis-Courmont
---
 drivers/atmodem/gprs.c |   33 +
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index defb154..daa3933 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -200,6 +200,37 @@ static void xdatastat_notify(GAtResult *result, gpointer 
user_data)
}
 }
 
+static void cpsb_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   GAtResultIter iter;
+   gint bearer;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, +CPSB:))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, NULL))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, bearer))
+   return;
+
+   ofono_gprs_bearer_notify(gprs, bearer);
+}
+
+static void cpsb_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   struct gprs_data *gd = ofono_gprs_get_data(gprs);
+
+   if (!ok)
+   return;
+
+   g_at_chat_register(gd-chat, +CPSB:, cpsb_notify, FALSE, gprs, NULL);
+}
+
 static void gprs_initialized(gboolean ok, GAtResult *result, gpointer 
user_data)
 {
struct ofono_gprs *gprs = user_data;
@@ -208,6 +239,8 @@ static void gprs_initialized(gboolean ok, GAtResult 
*result, gpointer user_data)
g_at_chat_register(gd-chat, +CGEV:, cgev_notify, FALSE, gprs, NULL);
g_at_chat_register(gd-chat, +CGREG:, cgreg_notify,
FALSE, gprs, NULL);
+   g_at_chat_send(gd-chat, AT+CPSB=1, none_prefix,
+   cpsb_set_cb, gprs, NULL);
 
switch (gd-vendor) {
case OFONO_VENDOR_IFX:
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 6/6] atmodem: packet switch bearer support

2011-01-20 Thread Marcel Holtmann
Hi Remi,

  drivers/atmodem/gprs.c |   33 +
  1 files changed, 33 insertions(+), 0 deletions(-)

I did apply this patch, but I fixed it up later ...

 diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
 index defb154..daa3933 100644
 --- a/drivers/atmodem/gprs.c
 +++ b/drivers/atmodem/gprs.c
 @@ -200,6 +200,37 @@ static void xdatastat_notify(GAtResult *result, gpointer 
 user_data)
   }
  }
  
 +static void cpsb_notify(GAtResult *result, gpointer user_data)
 +{
 + struct ofono_gprs *gprs = user_data;
 + GAtResultIter iter;
 + gint bearer;
 +
 + g_at_result_iter_init(iter, result);
 +
 + if (!g_at_result_iter_next(iter, +CPSB:))
 + return;
 +
 + if (!g_at_result_iter_next_number(iter, NULL))
 + return;
 +
 + if (!g_at_result_iter_next_number(iter, bearer))
 + return;
 +
 + ofono_gprs_bearer_notify(gprs, bearer);
 +}
 +
 +static void cpsb_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
 +{
 + struct ofono_gprs *gprs = user_data;
 + struct gprs_data *gd = ofono_gprs_get_data(gprs);
 +
 + if (!ok)
 + return;
 +
 + g_at_chat_register(gd-chat, +CPSB:, cpsb_notify, FALSE, gprs, NULL);
 +}

... since we normally don't bother with this kind of conditional
registration for notifications. We just register them.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 6/6] atmodem: packet switch bearer support

2011-01-19 Thread Rémi Denis-Courmont
---
 drivers/atmodem/gprs.c |   33 +
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index defb154..daa3933 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -200,6 +200,37 @@ static void xdatastat_notify(GAtResult *result, gpointer 
user_data)
}
 }
 
+static void cpsb_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   GAtResultIter iter;
+   gint bearer;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, +CPSB:))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, NULL))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, bearer))
+   return;
+
+   ofono_gprs_bearer_notify(gprs, bearer);
+}
+
+static void cpsb_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   struct gprs_data *gd = ofono_gprs_get_data(gprs);
+
+   if (!ok)
+   return;
+
+   g_at_chat_register(gd-chat, +CPSB:, cpsb_notify, FALSE, gprs, NULL);
+}
+
 static void gprs_initialized(gboolean ok, GAtResult *result, gpointer 
user_data)
 {
struct ofono_gprs *gprs = user_data;
@@ -208,6 +239,8 @@ static void gprs_initialized(gboolean ok, GAtResult 
*result, gpointer user_data)
g_at_chat_register(gd-chat, +CGEV:, cgev_notify, FALSE, gprs, NULL);
g_at_chat_register(gd-chat, +CGREG:, cgreg_notify,
FALSE, gprs, NULL);
+   g_at_chat_send(gd-chat, AT+CPSB=1, none_prefix,
+   cpsb_set_cb, gprs, NULL);
 
switch (gd-vendor) {
case OFONO_VENDOR_IFX:
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 6/6] atmodem: packet switch bearer support

2011-01-13 Thread Rémi Denis-Courmont
---
 drivers/atmodem/gprs.c |   33 +
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index defb154..daa3933 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -200,6 +200,37 @@ static void xdatastat_notify(GAtResult *result, gpointer 
user_data)
}
 }
 
+static void cpsb_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   GAtResultIter iter;
+   gint bearer;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, +CPSB:))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, NULL))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, bearer))
+   return;
+
+   ofono_gprs_bearer_notify(gprs, bearer);
+}
+
+static void cpsb_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct ofono_gprs *gprs = user_data;
+   struct gprs_data *gd = ofono_gprs_get_data(gprs);
+
+   if (!ok)
+   return;
+
+   g_at_chat_register(gd-chat, +CPSB:, cpsb_notify, FALSE, gprs, NULL);
+}
+
 static void gprs_initialized(gboolean ok, GAtResult *result, gpointer 
user_data)
 {
struct ofono_gprs *gprs = user_data;
@@ -208,6 +239,8 @@ static void gprs_initialized(gboolean ok, GAtResult 
*result, gpointer user_data)
g_at_chat_register(gd-chat, +CGEV:, cgev_notify, FALSE, gprs, NULL);
g_at_chat_register(gd-chat, +CGREG:, cgreg_notify,
FALSE, gprs, NULL);
+   g_at_chat_send(gd-chat, AT+CPSB=1, none_prefix,
+   cpsb_set_cb, gprs, NULL);
 
switch (gd-vendor) {
case OFONO_VENDOR_IFX:
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono