summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-02-01 16:43:55 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-02-04 01:15:35 +0100
commit1c5a44950001604b346480d3dfc2a6c0596a5146 (patch)
tree4a8761daa9de2d5bb2ad80dafbbd57a434fcfb59 /src/device.c
parent9117fc54fe370eac7f575f0fee44e469ad897a44 (diff)
downloadconnman-1c5a44950001604b346480d3dfc2a6c0596a5146.tar.gz
connman-1c5a44950001604b346480d3dfc2a6c0596a5146.tar.bz2
connman-1c5a44950001604b346480d3dfc2a6c0596a5146.zip
device: Return success if scan succeeded for at least one device
Return success on requesting device scan if at least one of the devices reported success. If scanning was unsuccessful for all devices, return the error from the last one.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c
index 55a6d8e7..e191194c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1159,6 +1159,8 @@ struct connman_device *__connman_device_find_device(
int __connman_device_request_scan(enum connman_service_type type)
{
+ connman_bool_t success = FALSE;
+ int last_err = -ENOSYS;
GSList *list;
int err;
@@ -1188,14 +1190,18 @@ int __connman_device_request_scan(enum connman_service_type type)
}
err = device_scan(device);
- if (err < 0 && err != -EINPROGRESS) {
- DBG("err %d", err);
- /* XXX maybe only a continue? */
- return err;
+ if (err == 0 || err == -EALREADY || err == -EINPROGRESS) {
+ success = TRUE;
+ } else {
+ last_err = err;
+ DBG("device %p err %d", device, err);
}
}
- return 0;
+ if (success == TRUE)
+ return 0;
+
+ return last_err;
}
int __connman_device_request_hidden_scan(struct connman_device *device,