diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-06 11:57:24 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-07 20:07:43 +0200 |
commit | 2599645bc0c2f37fbda67cabf21dfefe156837b7 (patch) | |
tree | 620696991dc4fd1457e495c49c31519a52831504 /src/technology.c | |
parent | 8e273c5f42e72158da0a11529dcdad11a7079d95 (diff) | |
download | connman-2599645bc0c2f37fbda67cabf21dfefe156837b7.tar.gz connman-2599645bc0c2f37fbda67cabf21dfefe156837b7.tar.bz2 connman-2599645bc0c2f37fbda67cabf21dfefe156837b7.zip |
technology: Track rfkill blocked state
Diffstat (limited to 'src/technology.c')
-rw-r--r-- | src/technology.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/technology.c b/src/technology.c index 46fb23f7..b255236a 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; } |