summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-10-08 15:52:45 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-08 15:54:28 +0200
commit89e99ca4a4e5081d95c6d152c42c5699abd323a9 (patch)
tree0525cd5b3675c955361a44c18b0ca61b88644cd0
parentfc6a5bcad7df1b234bd0fbd2aa5b89f7bcd443b8 (diff)
downloadconnman-89e99ca4a4e5081d95c6d152c42c5699abd323a9.tar.gz
connman-89e99ca4a4e5081d95c6d152c42c5699abd323a9.tar.bz2
connman-89e99ca4a4e5081d95c6d152c42c5699abd323a9.zip
technology: Do not update a technology blocked counter when unchanged
Some buggy rfkill driver send rfkill CHANGE events while the actual rfkill status has not changed. ConnMan should just ignore those.
-rw-r--r--src/technology.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/technology.c b/src/technology.c
index 0a585120..37414d75 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -661,7 +661,7 @@ int __connman_technology_update_rfkill(unsigned int index,
{
struct connman_technology *technology;
struct connman_rfkill *rfkill;
- connman_bool_t blocked;
+ connman_bool_t blocked, old_blocked;
DBG("index %u soft %u hard %u", index, softblock, hardblock);
@@ -673,10 +673,14 @@ int __connman_technology_update_rfkill(unsigned int index,
if (rfkill == NULL)
return -ENXIO;
+ old_blocked = (rfkill->softblock || rfkill->hardblock) ? TRUE : FALSE;
+ blocked = (softblock || hardblock) ? TRUE : FALSE;
+
rfkill->softblock = softblock;
rfkill->hardblock = hardblock;
- blocked = (softblock || hardblock) ? TRUE : FALSE;
+ if (blocked == old_blocked)
+ return 0;
if (blocked) {
guint n_blocked;