From 42fb2a7c0fb2a361a02eac1ad68eaeb650af5a3c Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 19 Sep 2016 20:35:57 -0500 Subject: [PATCH] device: Add device_set_scan_results --- src/device.c | 15 ++++++++++++--- src/device.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index 6959e865..dcce9830 100644 --- a/src/device.c +++ b/src/device.c @@ -319,10 +319,12 @@ static bool bss_match(const void *a, const void *b) return !memcmp(bss_a->addr, bss_b->addr, sizeof(bss_a->addr)); } -static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, - struct l_queue *bss_list, void *userdata) +/* + * Used when scan results were obtained; either from passive scan running + * inside device.c or active scans running in other state machines, e.g. wsc.c + */ +void device_set_scan_results(struct device *device, struct l_queue *bss_list) { - struct device *device = userdata; struct network *network; const struct l_queue_entry *bss_entry; struct timespec now; @@ -375,7 +377,14 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, if (device->state == DEVICE_STATE_AUTOCONNECT) device_autoconnect_next(device); +} +static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, + struct l_queue *bss_list, void *userdata) +{ + struct device *device = userdata; + + device_set_scan_results(device, bss_list); return true; } diff --git a/src/device.h b/src/device.h index 228acb27..360e2988 100644 --- a/src/device.h +++ b/src/device.h @@ -66,6 +66,7 @@ uint32_t device_add_state_watch(struct device *device, device_destroy_func_t destroy); bool device_remove_state_watch(struct device *device, uint32_t id); +void device_set_scan_results(struct device *device, struct l_queue *bss_list); struct network *device_network_find(struct device *device, const char *ssid, enum security security);