From: Jessica Nilsson jessica.j.nils...@stericsson.com
---
drivers/isimodem/debug.c |1 +
drivers/isimodem/devinfo.c | 161
drivers/isimodem/info.h|3 +
3 files changed, 136 insertions(+), 29 deletions(-)
diff --git a/drivers/isimodem/debug.c b/drivers/isimodem/debug.c
index c14acc2..10d0201 100644
--- a/drivers/isimodem/debug.c
+++ b/drivers/isimodem/debug.c
@@ -481,6 +481,7 @@ const char *info_message_id_name(enum info_message_id value)
const char *info_subblock_name(enum info_subblock value)
{
switch (value) {
+ _(INFO_SB_MODEMSW_VERSION);
_(INFO_SB_PRODUCT_INFO_NAME);
_(INFO_SB_PRODUCT_INFO_MANUFACTURER);
_(INFO_SB_SN_IMEI_PLAIN);
diff --git a/drivers/isimodem/devinfo.c b/drivers/isimodem/devinfo.c
index 3bf05f4..ebe4273 100644
--- a/drivers/isimodem/devinfo.c
+++ b/drivers/isimodem/devinfo.c
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) ST-Ericsson SA 2011.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -46,6 +47,8 @@
struct devinfo_data {
GIsiClient *client;
+ GIsiClient *primary;
+ GIsiClient *secondary;
};
static void info_resp_cb(const GIsiMessage *msg, void *data)
@@ -82,7 +85,8 @@ static void info_resp_cb(const GIsiMessage *msg, void *data)
if (id != INFO_SB_PRODUCT_INFO_MANUFACTURER
id != INFO_SB_PRODUCT_INFO_NAME
id != INFO_SB_MCUSW_VERSION
- id != INFO_SB_SN_IMEI_PLAIN)
+ id != INFO_SB_SN_IMEI_PLAIN
+ id != INFO_SB_MODEMSW_VERSION)
continue;
if (g_isi_sb_iter_get_len(iter) 5)
@@ -111,17 +115,22 @@ static void isi_query_manufacturer(struct ofono_devinfo
*info,
struct devinfo_data *dev = ofono_devinfo_get_data(info);
struct isi_cb_data *cbd = isi_cb_data_new(dev, cb, data);
+ if (cbd == NULL || dev == NULL)
+ goto error;
+
+ if (g_isi_client_resource(dev-client) == PN_MODEM_INFO) {
+ goto error;
+ } else {
+
const uint8_t msg[] = {
INFO_PRODUCT_INFO_READ_REQ,
INFO_PRODUCT_MANUFACTURER
};
size_t len = sizeof(msg);
- if (cbd == NULL || dev == NULL)
- goto error;
-
if (g_isi_client_send(dev-client, msg, len, info_resp_cb, cbd, g_free))
return;
+ }
error:
CALLBACK_WITH_FAILURE(cb, , data);
@@ -135,17 +144,22 @@ static void isi_query_model(struct ofono_devinfo *info,
struct devinfo_data *dev = ofono_devinfo_get_data(info);
struct isi_cb_data *cbd = isi_cb_data_new(dev, cb, data);
+ if (cbd == NULL || dev == NULL)
+ goto error;
+
+ if (g_isi_client_resource(dev-client) == PN_MODEM_INFO) {
+ goto error;
+ } else {
+
const uint8_t msg[] = {
INFO_PRODUCT_INFO_READ_REQ,
INFO_PRODUCT_NAME
};
size_t len = sizeof(msg);
- if (cbd == NULL || dev == NULL)
- goto error;
-
if (g_isi_client_send(dev-client, msg, len, info_resp_cb, cbd, g_free))
return;
+ }
error:
CALLBACK_WITH_FAILURE(cb, , data);
@@ -159,24 +173,51 @@ static void isi_query_revision(struct ofono_devinfo *info,
struct devinfo_data *dev = ofono_devinfo_get_data(info);
struct isi_cb_data *cbd = isi_cb_data_new(dev, cb, data);
- const uint8_t msg[] = {
- INFO_VERSION_READ_REQ,
- 0x00, INFO_MCUSW,
- 0x00, 0x00, 0x00, 0x00
- };
- size_t len = sizeof(msg);
+ unsigned char *msg = NULL;
+ unsigned char msg_size = 0;
+ size_t len;
if (cbd == NULL || dev == NULL)
goto error;
+ if (g_isi_client_resource(dev-client) == PN_MODEM_INFO) {
+ goto error;
+ } else {
+ msg_size = 7;
+ msg = g_try_malloc0(msg_size);
+ msg[0] = INFO_VERSION_READ_REQ;
+ msg[1] = 0x00;
+ msg[2] = INFO_MCUSW;
+ msg[3] = 0x00;
+ msg[4] = 0x00;
+ msg[5] = 0x00;
+ msg[6] = 0x00;
+ }
+
+ len = sizeof(msg);
+
if (g_isi_client_send(dev-client, msg, len, info_resp_cb, cbd, g_free))
- return;
+ goto out;
error:
CALLBACK_WITH_FAILURE(cb, , data);
+out:
+ g_free(msg);
g_free(cbd);
}
+static gboolean send_serial_number_read_req(GIsiClient *client, void *cbd,
+ GDestroyNotify