All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] add interface property to primary context
@ 2009-11-09  7:37 Martin Xu
  2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Martin Xu @ 2009-11-09  7:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

---
 include/gprs-context.h |    1 +
 src/gprs.c             |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index c4ebd23..adb0820 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -37,6 +37,7 @@ struct ofono_gprs_context;
 struct ofono_gprs_primary_context {
 	unsigned int cid;
 	int direction;
+	char *interface;
 	char apn[OFONO_GPRS_MAX_APN_LENGTH + 1];
 	char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
 	char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
diff --git a/src/gprs.c b/src/gprs.c
index 0253109..18ae82a 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -185,6 +185,10 @@ static DBusMessage *pri_get_properties(DBusConnection *conn,
 	ofono_dbus_dict_append(&dict, "Password", DBUS_TYPE_STRING,
 				&strvalue);
 
+	strvalue = ctx->context.interface;
+	ofono_dbus_dict_append(&dict, "Interface", DBUS_TYPE_STRING,
+				&strvalue);
+ 
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver
  2009-11-09  7:37 [PATCH 1/4] add interface property to primary context Martin Xu
@ 2009-11-09  7:37 ` Martin Xu
  2009-11-09  7:38   ` [PATCH 3/4] add function ofono_gprs_context_get_modem Martin Xu
  2009-11-09 16:59   ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Denis Kenzior
  2009-11-09  7:42 ` [PATCH */4] add interface property to primary context Xu, Martin
  2009-11-09 16:57 ` [PATCH 1/4] " Denis Kenzior
  2 siblings, 2 replies; 9+ messages in thread
From: Martin Xu @ 2009-11-09  7:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]

---
 include/gprs-context.h |    4 ++++
 src/gprs.c             |   20 ++++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index adb0820..b8c770d 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -57,6 +57,10 @@ struct ofono_gprs_context_driver {
 	void (*deactivate_primary)(struct ofono_gprs_context *gc,
 					unsigned int id,
 					ofono_gprs_context_cb_t cb, void *data);
+	void (*create_interface)(struct ofono_gprs_context *gc,
+				struct ofono_gprs_primary_context *ctx);
+	void (*destroy_interface)(struct ofono_gprs_context *gc,
+				struct ofono_gprs_primary_context *ctx);
 };
 
 void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc, unsigned id);
diff --git a/src/gprs.c b/src/gprs.c
index 18ae82a..60d26ec 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -498,21 +498,29 @@ static struct pri_context *pri_context_create(struct ofono_gprs *gprs,
 						const char *name,
 						enum gprs_context_type type)
 {
-	struct pri_context *context = g_try_new0(struct pri_context, 1);
+	struct ofono_gprs_context *gc = gprs->context_driver;
+	struct pri_context *ctx = g_try_new0(struct pri_context, 1);
 
-	if (!context)
+	if (!ctx)
 		return NULL;
 
-	context->gprs = gprs;
-	strcpy(context->name, name);
-	context->type = type;
+	ctx->gprs = gprs;
+	strcpy(ctx->name, name);
+	ctx->type = type;
+
+	if (gc->driver->create_interface)
+		gc->driver->create_interface(gc, &ctx->context);
 
-	return context;
+	return ctx;
 }
 
 static void pri_context_destroy(gpointer userdata)
 {
 	struct pri_context *ctx = userdata;
+	struct ofono_gprs_context *gc = ctx->gprs->context_driver;
+
+	if (gc->driver->destroy_interface)
+		gc->driver->destroy_interface(gc, &ctx->context);
 
 	if (ctx->path)
 		g_free(ctx->path);
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] add function ofono_gprs_context_get_modem
  2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
@ 2009-11-09  7:38   ` Martin Xu
  2009-11-09  7:38     ` [PATCH 4/4] add mbm_gprs_create/destroy_interface to mbm gprs_context_driver Martin Xu
  2009-11-09 16:59   ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Denis Kenzior
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Xu @ 2009-11-09  7:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

---
 include/gprs-context.h |    2 ++
 src/gprs.c             |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index b8c770d..2a788ef 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -76,6 +76,8 @@ void ofono_gprs_context_remove(struct ofono_gprs_context *gc);
 void ofono_gprs_context_set_data(struct ofono_gprs_context *gc, void *data);
 void *ofono_gprs_context_get_data(struct ofono_gprs_context *gc);
 
+struct ofono_modem *ofono_gprs_context_get_modem(struct ofono_gprs_context *gc);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gprs.c b/src/gprs.c
index 60d26ec..025b944 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1249,6 +1249,11 @@ void *ofono_gprs_context_get_data(struct ofono_gprs_context *gc)
 	return gc->driver_data;
 }
 
+struct ofono_modem *ofono_gprs_context_get_modem(struct ofono_gprs_context *gc)
+{
+	return __ofono_atom_get_modem(gc->atom);
+}
+
 int ofono_gprs_driver_register(const struct ofono_gprs_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] add mbm_gprs_create/destroy_interface to mbm gprs_context_driver
  2009-11-09  7:38   ` [PATCH 3/4] add function ofono_gprs_context_get_modem Martin Xu
@ 2009-11-09  7:38     ` Martin Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Xu @ 2009-11-09  7:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]

---
 drivers/mbmmodem/gprs-context.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index ecbafa0..d3e03b7 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -172,6 +172,25 @@ error:
 	CALLBACK_WITH_FAILURE(cb, data);
 }
 
+static void mbm_gprs_create_interface(struct ofono_gprs_context *gc,
+					struct ofono_gprs_primary_context *ctx)
+{
+	const char *interface;
+	struct ofono_modem *modem = ofono_gprs_context_get_modem(gc);
+
+	interface = ofono_modem_get_string(modem, "NetworkInterface");
+
+	g_free(ctx->interface);
+	ctx->interface = g_strdup(interface);
+}
+
+static void mbm_gprs_destroy_interface(struct ofono_gprs_context *gc,
+					struct ofono_gprs_primary_context *ctx)
+{
+	g_free(ctx->interface);
+	ctx->interface = NULL;
+}
+
 static void e2nap_notifier(GAtResult *result, gpointer user_data)
 {
 	struct ofono_gprs_context *gc = user_data;
@@ -237,6 +256,8 @@ static struct ofono_gprs_context_driver driver = {
 	.remove			= mbm_gprs_context_remove,
 	.activate_primary	= mbm_gprs_activate_primary,
 	.deactivate_primary	= mbm_gprs_deactivate_primary,
+	.create_interface	= mbm_gprs_create_interface,
+	.destroy_interface	= mbm_gprs_destroy_interface,
 };
 
 void mbm_gprs_context_init()
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH */4] add interface property to primary context
  2009-11-09  7:37 [PATCH 1/4] add interface property to primary context Martin Xu
  2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
@ 2009-11-09  7:42 ` Xu, Martin
  2009-11-10  3:28   ` How does ConnMan works with Ofono? " Xu, Martin
  2009-11-09 16:57 ` [PATCH 1/4] " Denis Kenzior
  2 siblings, 1 reply; 9+ messages in thread
From: Xu, Martin @ 2009-11-09  7:42 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

Hi:
"Interface" property of Primary Context is needed by ofono plugin for Connman.
These patches are used to implement "interface" property for Primary Context. Below is the way to implement it.
1.	Create "interface" in Primary Context creating 
2.	 Destroy "interface" in Primary Context destroying
3.	"interface" is created/destroyed by ofono_gprs_context_driver
   a)	"interface" of MBM is inherited from NetworkInterface of modem which is exported from kernel
   b)	Others can use ofono_gprs_context_driver->create/destroy_interface() to create/destroy interface such as ppp0 and tun0.
Please review it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] add interface property to primary context
  2009-11-09  7:37 [PATCH 1/4] add interface property to primary context Martin Xu
  2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
  2009-11-09  7:42 ` [PATCH */4] add interface property to primary context Xu, Martin
@ 2009-11-09 16:57 ` Denis Kenzior
  2 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2009-11-09 16:57 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Hi Martin,

> @@ -37,6 +37,7 @@ struct ofono_gprs_context;
>  struct ofono_gprs_primary_context {
>  	unsigned int cid;
>  	int direction;
> +	char *interface;
>  	char apn[OFONO_GPRS_MAX_APN_LENGTH + 1];
>  	char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
>  	char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];

Logically this does not belong here.  It should be added to 
ofono_gprs_context, or perhaps to pri_context.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver
  2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
  2009-11-09  7:38   ` [PATCH 3/4] add function ofono_gprs_context_get_modem Martin Xu
@ 2009-11-09 16:59   ` Denis Kenzior
  1 sibling, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2009-11-09 16:59 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

Hi Martin,

> @@ -57,6 +57,10 @@ struct ofono_gprs_context_driver {
>  	void (*deactivate_primary)(struct ofono_gprs_context *gc,
>  					unsigned int id,
>  					ofono_gprs_context_cb_t cb, void *data);
> +	void (*create_interface)(struct ofono_gprs_context *gc,
> +				struct ofono_gprs_primary_context *ctx);
> +	void (*destroy_interface)(struct ofono_gprs_context *gc,
> +				struct ofono_gprs_primary_context *ctx);
>  };

I suggest we don't do this, but instead notify the core of the interface name 
in 'activate_primary' callback, assuming the activate was successful.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 9+ messages in thread

* How does ConnMan works with Ofono? RE: [PATCH */4] add interface property to primary context
  2009-11-09  7:42 ` [PATCH */4] add interface property to primary context Xu, Martin
@ 2009-11-10  3:28   ` Xu, Martin
  2009-11-10  4:52     ` Xu, Martin
  0 siblings, 1 reply; 9+ messages in thread
From: Xu, Martin @ 2009-11-10  3:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

Hi Marcel/Denis
In order to implement interface property. I think we need to clarify how does ConnMan work with Ofono firstly

In my opinion ConnMan and ofono works like below. Could you review and give out your opinions? Thanks!

PC_i: PrimaryContext_(internet type):
______________________________________
Ofono                         ConnMan
------------------------------------------------------------------

1.Modem                    device
  |
  | (create/load)
  |
  V
2.PC_i                     Network
  |
  |(powered up)
  |
  V
3.Attached PC_i----------->    Service (ready)
                         |
                         |(connect)
                         |
                         V 
4.Activated PC_i           Service (associated)
                         |
                         |(configure/dhcp)
                         |
                         V
5.                       Service (READY)

1. ConnMan detects the Modem from Ofono and create corresponding device
2. ConnMan detects the PC_i and create corresponding Network(First time, ConnMan will ask Ofono to create PC_i)
3. Once the PC_i attached ConnMan will create service
4. When user connects service, ConnMan will ask ofono to activate PC_i.
   When PC_i is activated, Service in ConnMan is associated.
5. ConnMan will configure/dhcp to ipconfigure the service, and then service in READY state

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: How does ConnMan works with Ofono? RE: [PATCH */4] add interface property to primary context
  2009-11-10  3:28   ` How does ConnMan works with Ofono? " Xu, Martin
@ 2009-11-10  4:52     ` Xu, Martin
  0 siblings, 0 replies; 9+ messages in thread
From: Xu, Martin @ 2009-11-10  4:52 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

> ______________________________________
> Ofono                         ConnMan
> ------------------------------------------------------------------
> 
> 1.Modem                    device
>   |
>   | (create/load)
>   |
>   V
> 2.PC_i                     Network
>   |
>   |(powered up)
>   |
>   V
> 3.Attached PC_i----------->    Service (ready)
 3.Attached PC_i----------->    Service (idle)

>                          |
>                          |(connect)
>                          |
>                          V
> 4.Activated PC_i           Service (associated)
>                          |
>                          |(configure/dhcp)
>                          |
>                          V
> 5.                       Service (READY)
> 
> 1. ConnMan detects the Modem from Ofono and create corresponding device
> 2. ConnMan detects the PC_i and create corresponding Network(First time,
> ConnMan will ask Ofono to create PC_i)
> 3. Once the PC_i attached ConnMan will create service
> 4. When user connects service, ConnMan will ask ofono to activate PC_i.
>    When PC_i is activated, Service in ConnMan is associated.
> 5. ConnMan will configure/dhcp to ipconfigure the service, and then service in
> READY state
> _______________________________________________
> connman mailing list
> connman(a)connman.net
> http://lists.connman.net/listinfo/connman

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-11-10  4:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-09  7:37 [PATCH 1/4] add interface property to primary context Martin Xu
2009-11-09  7:37 ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Martin Xu
2009-11-09  7:38   ` [PATCH 3/4] add function ofono_gprs_context_get_modem Martin Xu
2009-11-09  7:38     ` [PATCH 4/4] add mbm_gprs_create/destroy_interface to mbm gprs_context_driver Martin Xu
2009-11-09 16:59   ` [PATCH 2/4] add create/destroy_interface to ofono_gprs_context_driver Denis Kenzior
2009-11-09  7:42 ` [PATCH */4] add interface property to primary context Xu, Martin
2009-11-10  3:28   ` How does ConnMan works with Ofono? " Xu, Martin
2009-11-10  4:52     ` Xu, Martin
2009-11-09 16:57 ` [PATCH 1/4] " Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.