All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] devinfo: Add support of IMEISV
@ 2016-03-31  7:32 Samrat Guha Niyogi
  2016-03-31 15:20 ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-31  7:32 UTC (permalink / raw)
  To: ofono

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

---
 include/devinfo.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/devinfo.h b/include/devinfo.h
index a9acce9..9d1834f 100644
--- a/include/devinfo.h
+++ b/include/devinfo.h
@@ -46,6 +46,8 @@ struct ofono_devinfo_driver {
 			ofono_devinfo_query_cb_t cb, void *data);
 	void (*query_revision)(struct ofono_devinfo *info,
 			ofono_devinfo_query_cb_t cb, void *data);
+	void (*query_svn)(struct ofono_devinfo *info,
+			ofono_devinfo_query_cb_t cb, void *data);
 };
 
 int ofono_devinfo_driver_register(const struct ofono_devinfo_driver *d);
-- 
1.9.1


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

* [PATCH] devinfo: Add support of IMEISV
@ 2016-03-31  7:36 Samrat Guha Niyogi
  0 siblings, 0 replies; 6+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-31  7:36 UTC (permalink / raw)
  To: ofono

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

---
 src/modem.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/modem.c b/src/modem.c
index 2de8d98..a4d4490 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -94,6 +94,7 @@ struct ofono_devinfo {
 	char *model;
 	char *revision;
 	char *serial;
+	char *svn;
 	unsigned int dun_watch;
 	const struct ofono_devinfo_driver *driver;
 	void *driver_data;
@@ -815,6 +816,11 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
 			ofono_dbus_dict_append(dict, "Serial",
 						DBUS_TYPE_STRING,
 						&info->serial);
+
+		if (info->svn)
+			ofono_dbus_dict_append(dict, "SoftwareVersionNumber",
+						DBUS_TYPE_STRING,
+						&info->svn);
 	}
 
 	interfaces = g_new0(char *, g_slist_length(modem->interface_list) + 1);
@@ -1343,6 +1349,32 @@ void ofono_modem_remove_interface(struct ofono_modem *modem,
 	modem->interface_update = g_idle_add(trigger_interface_update, modem);
 }
 
+static void query_svn_cb(const struct ofono_error *error,
+				const char *svn, void *user)
+{
+	struct ofono_devinfo *info = user;
+	DBusConnection *conn = ofono_dbus_get_connection();
+	const char *path = __ofono_atom_get_path(info->atom);
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
+		return;
+
+	info->svn = g_strdup(svn);
+
+	ofono_dbus_signal_property_changed(conn, path,
+						OFONO_MODEM_INTERFACE,
+						"SoftwareVersionNumber", DBUS_TYPE_STRING,
+						&info->svn);
+}
+
+static void query_svn(struct ofono_devinfo *info)
+{
+	if (info->driver->query_svn == NULL)
+		return;
+
+	info->driver->query_svn(info, query_svn_cb, info);
+}
+
 static void query_serial_cb(const struct ofono_error *error,
 				const char *serial, void *user)
 {
@@ -1351,7 +1383,7 @@ static void query_serial_cb(const struct ofono_error *error,
 	const char *path = __ofono_atom_get_path(info->atom);
 
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
-		return;
+		goto out;
 
 	info->serial = g_strdup(serial);
 
@@ -1359,6 +1391,8 @@ static void query_serial_cb(const struct ofono_error *error,
 						OFONO_MODEM_INTERFACE,
 						"Serial", DBUS_TYPE_STRING,
 						&info->serial);
+out:
+	query_svn(info);
 }
 
 static void query_serial(struct ofono_devinfo *info)
@@ -1619,6 +1653,9 @@ static void devinfo_unregister(struct ofono_atom *atom)
 
 	g_free(info->serial);
 	info->serial = NULL;
+
+	g_free(info->svn);
+	info->svn = NULL;
 }
 
 void ofono_devinfo_register(struct ofono_devinfo *info)
-- 
1.9.1


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

* [PATCH] devinfo: Add support of IMEISV
@ 2016-03-31  7:38 Samrat Guha Niyogi
  0 siblings, 0 replies; 6+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-31  7:38 UTC (permalink / raw)
  To: ofono

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

---
 drivers/rilmodem/devinfo.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/rilmodem/devinfo.c b/drivers/rilmodem/devinfo.c
index bb1e642..2419762 100644
--- a/drivers/rilmodem/devinfo.c
+++ b/drivers/rilmodem/devinfo.c
@@ -96,6 +96,47 @@ static void ril_query_revision(struct ofono_devinfo *info,
 	CALLBACK_WITH_FAILURE(cb, NULL, data);
 }
 
+static void query_svn_cb(struct ril_msg *message, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_devinfo_query_cb_t cb = cbd->cb;
+	GRil *ril = cbd->user;
+	struct parcel rilp;
+	char *imeisv;
+
+	if (message->error != RIL_E_SUCCESS)
+		goto error;
+
+	g_ril_init_parcel(message, &rilp);
+
+	imeisv = parcel_r_string(&rilp);
+
+	g_ril_append_print_buf(ril, "{%s}", imeisv);
+	g_ril_print_response(ril, message);
+
+	CALLBACK_WITH_SUCCESS(cb, imeisv, cbd->data);
+	g_free(imeisv);
+	return;
+
+error:
+	CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
+}
+
+static void ril_query_svn(struct ofono_devinfo *info,
+				ofono_devinfo_query_cb_t cb,
+				void *data)
+{
+	GRil *ril = ofono_devinfo_get_data(info);
+	struct cb_data *cbd = cb_data_new(cb, data, ril);
+
+	if (g_ril_send(ril, RIL_REQUEST_GET_IMEISV, NULL,
+			query_svn_cb, cbd, g_free) > 0)
+		return;
+
+	g_free(cbd);
+	CALLBACK_WITH_FAILURE(cb, NULL, data);
+}
+
 static void query_serial_cb(struct ril_msg *message, gpointer user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -178,7 +219,8 @@ static struct ofono_devinfo_driver driver = {
 	.query_manufacturer	= ril_query_manufacturer,
 	.query_model		= ril_query_model,
 	.query_revision		= ril_query_revision,
-	.query_serial		= ril_query_serial
+	.query_serial		= ril_query_serial,
+	.query_svn		= ril_query_svn
 };
 
 void ril_devinfo_init(void)
-- 
1.9.1


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

* [PATCH] devinfo: Add support of IMEISV
@ 2016-03-31  7:46 Samrat Guha Niyogi
  0 siblings, 0 replies; 6+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-31  7:46 UTC (permalink / raw)
  To: ofono

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

---
 doc/modem-api.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 9fd23ba..c0a575f 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -90,6 +90,11 @@ Properties	boolean Powered [readwrite]
 			"hfp") this corresponds to the Bluetooth Device
 			Address of the remote device.
 
+		string SoftwareVersionNumber [readonly, optional]
+
+			String representing the software version number of the
+			modem device.
+
 		array{string} Features [readonly]
 
 			List of currently enabled features. It uses simple
-- 
1.9.1


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

* [PATCH] devinfo: Add support of IMEISV
@ 2016-03-31  7:47 Samrat Guha Niyogi
  0 siblings, 0 replies; 6+ messages in thread
From: Samrat Guha Niyogi @ 2016-03-31  7:47 UTC (permalink / raw)
  To: ofono

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

---
 test/test-modem | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/test-modem b/test/test-modem
index aa38b1f..59e9163 100755
--- a/test/test-modem
+++ b/test/test-modem
@@ -39,6 +39,9 @@ if __name__ == "__main__":
 	if 'Serial' in properties:
 		print("Serial: %s" % (properties['Serial']))
 
+	if 'SoftwareVersionNumber' in properties:
+		print("SoftwareVersionNumber: %s" % (properties['SoftwareVersionNumber']))
+
 	if 'Powered' in properties:
 		print("Powered: %s" % (properties['Powered']))
 
-- 
1.9.1


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

* Re: [PATCH] devinfo: Add support of IMEISV
  2016-03-31  7:32 [PATCH] devinfo: Add support of IMEISV Samrat Guha Niyogi
@ 2016-03-31 15:20 ` Denis Kenzior
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2016-03-31 15:20 UTC (permalink / raw)
  To: ofono

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

Hi Samrat,

On 03/31/2016 02:32 AM, Samrat Guha Niyogi wrote:
> ---
>   include/devinfo.h | 2 ++
>   1 file changed, 2 insertions(+)
>

I applied all your IMESV patches, but somehow these all had the same 
commit description.  So I tweaked the commit descriptions to be a bit 
more proper.

Regards,
-Denis

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

end of thread, other threads:[~2016-03-31 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31  7:32 [PATCH] devinfo: Add support of IMEISV Samrat Guha Niyogi
2016-03-31 15:20 ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2016-03-31  7:36 Samrat Guha Niyogi
2016-03-31  7:38 Samrat Guha Niyogi
2016-03-31  7:46 Samrat Guha Niyogi
2016-03-31  7:47 Samrat Guha Niyogi

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.