From 8d60016b23447e1ef4e05c5bbd4ae4dca9b7e91a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 11 Jul 2011 15:03:38 +0200 Subject: 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. --- drivers/atmodem/devinfo.c | 31 +++++++++++++++++-------------- 1 file 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) -- cgit v1.2.3