summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem/devinfo.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-07-11 15:03:38 +0200
committerMarcel Holtmann <marcel@holtmann.org>2011-07-11 15:03:38 +0200
commit8d60016b23447e1ef4e05c5bbd4ae4dca9b7e91a (patch)
treed866339d67c31c231b475f0f3cafbc94754f6168 /drivers/atmodem/devinfo.c
parent6549cb63460908c04884b8c8c6c60a5ec4087899 (diff)
downloadofono-8d60016b23447e1ef4e05c5bbd4ae4dca9b7e91a.tar.bz2
atmodem: Request device capabilities from devinfo driver
The result of the capabilities command is currently not used to identify GSM support or not. However for debugging purposes the information are part of the AT command debug log now.
Diffstat (limited to 'drivers/atmodem/devinfo.c')
-rw-r--r--drivers/atmodem/devinfo.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/atmodem/devinfo.c b/drivers/atmodem/devinfo.c
index 4c802f1a..8845da08 100644
--- a/drivers/atmodem/devinfo.c
+++ b/drivers/atmodem/devinfo.c
@@ -35,6 +35,8 @@
#include "atmodem.h"
+static const char *gcap_prefix[] = { "+GCAP:", NULL };
+
static void attr_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
@@ -122,22 +124,22 @@ static void at_query_serial(struct ofono_devinfo *info,
CALLBACK_WITH_FAILURE(cb, NULL, data);
}
-static gboolean at_devinfo_register(gpointer user_data)
+static void capability_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_devinfo *info = user_data;
ofono_devinfo_register(info);
-
- return FALSE;
}
static int at_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
void *data)
{
- GAtChat *chat = data;
+ GAtChat *chat = g_at_chat_clone(data);
+
+ ofono_devinfo_set_data(info, chat);
- ofono_devinfo_set_data(info, g_at_chat_clone(chat));
- g_idle_add(at_devinfo_register, info);
+ g_at_chat_send(chat, "AT+GCAP", gcap_prefix,
+ capability_cb, info, NULL);
return 0;
}
@@ -146,18 +148,19 @@ static void at_devinfo_remove(struct ofono_devinfo *info)
{
GAtChat *chat = ofono_devinfo_get_data(info);
- g_at_chat_unref(chat);
ofono_devinfo_set_data(info, NULL);
+
+ g_at_chat_unref(chat);
}
static struct ofono_devinfo_driver driver = {
- .name = "atmodem",
- .probe = at_devinfo_probe,
- .remove = at_devinfo_remove,
- .query_manufacturer = at_query_manufacturer,
- .query_model = at_query_model,
- .query_revision = at_query_revision,
- .query_serial = at_query_serial
+ .name = "atmodem",
+ .probe = at_devinfo_probe,
+ .remove = at_devinfo_remove,
+ .query_manufacturer = at_query_manufacturer,
+ .query_model = at_query_model,
+ .query_revision = at_query_revision,
+ .query_serial = at_query_serial,
};
void at_devinfo_init(void)