From: Samuel Ortiz Date: Wed, 6 Oct 2010 09:57:24 +0000 (+0200) Subject: technology: Track rfkill blocked state X-Git-Tag: 0.63~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2599645bc0c2f37fbda67cabf21dfefe156837b7;p=platform%2Fupstream%2Fconnman.git technology: Track rfkill blocked state --- diff --git a/src/technology.c b/src/technology.c index 46fb23f..b255236 100644 --- a/src/technology.c +++ b/src/technology.c @@ -36,6 +36,8 @@ static GSList *technology_list = NULL; struct connman_rfkill { unsigned int index; enum connman_service_type type; + connman_bool_t softblock; + connman_bool_t hardblock; }; enum connman_technology_state { @@ -611,18 +613,18 @@ int __connman_technology_add_rfkill(unsigned int index, DBG("index %u type %d soft %u hard %u", index, type, softblock, hardblock); + technology = technology_get(type); + if (technology == NULL) + return -ENXIO; + rfkill = g_try_new0(struct connman_rfkill, 1); if (rfkill == NULL) return -ENOMEM; rfkill->index = index; rfkill->type = type; - - technology = technology_get(type); - if (technology == NULL) { - g_free(rfkill); - return -ENXIO; - } + rfkill->softblock = softblock; + rfkill->hardblock = hardblock; g_hash_table_replace(rfkill_table, &index, technology); @@ -636,6 +638,7 @@ int __connman_technology_update_rfkill(unsigned int index, connman_bool_t hardblock) { struct connman_technology *technology; + struct connman_rfkill *rfkill; DBG("index %u soft %u hard %u", index, softblock, hardblock); @@ -643,6 +646,13 @@ int __connman_technology_update_rfkill(unsigned int index, if (technology == NULL) return -ENXIO; + rfkill = g_hash_table_lookup(technology->rfkill_list, &index); + if (rfkill == NULL) + return -ENXIO; + + rfkill->softblock = softblock; + rfkill->hardblock = hardblock; + return 0; }