Lines Matching refs:data
35 struct bgscan_simple_data *data = eloop_ctx; in bgscan_simple_timeout() local
36 struct wpa_supplicant *wpa_s = data->wpa_s; in bgscan_simple_timeout()
41 params.ssids[0].ssid = data->ssid->ssid; in bgscan_simple_timeout()
42 params.ssids[0].ssid_len = data->ssid->ssid_len; in bgscan_simple_timeout()
43 params.freqs = data->ssid->scan_freq; in bgscan_simple_timeout()
54 eloop_register_timeout(data->scan_interval, 0, in bgscan_simple_timeout()
55 bgscan_simple_timeout, data, NULL); in bgscan_simple_timeout()
57 if (data->scan_interval == data->short_interval) { in bgscan_simple_timeout()
58 data->short_scan_count++; in bgscan_simple_timeout()
64 if (data->short_scan_count > data->max_short_scans) { in bgscan_simple_timeout()
65 data->scan_interval = data->long_interval; in bgscan_simple_timeout()
69 } else if (data->short_scan_count > 0) { in bgscan_simple_timeout()
76 data->short_scan_count--; in bgscan_simple_timeout()
78 os_get_reltime(&data->last_bgscan); in bgscan_simple_timeout()
83 static int bgscan_simple_get_params(struct bgscan_simple_data *data, in bgscan_simple_get_params() argument
91 data->short_interval = atoi(params); in bgscan_simple_get_params()
97 data->signal_threshold = atoi(pos); in bgscan_simple_get_params()
105 data->long_interval = atoi(pos); in bgscan_simple_get_params()
115 struct bgscan_simple_data *data; in bgscan_simple_init() local
117 data = os_zalloc(sizeof(*data)); in bgscan_simple_init()
118 if (data == NULL) in bgscan_simple_init()
120 data->wpa_s = wpa_s; in bgscan_simple_init()
121 data->ssid = ssid; in bgscan_simple_init()
122 if (bgscan_simple_get_params(data, params) < 0) { in bgscan_simple_init()
123 os_free(data); in bgscan_simple_init()
126 if (data->short_interval <= 0) in bgscan_simple_init()
127 data->short_interval = 30; in bgscan_simple_init()
128 if (data->long_interval <= 0) in bgscan_simple_init()
129 data->long_interval = 30; in bgscan_simple_init()
133 data->signal_threshold, data->short_interval, in bgscan_simple_init()
134 data->long_interval); in bgscan_simple_init()
136 if (data->signal_threshold && in bgscan_simple_init()
137 wpa_drv_signal_monitor(wpa_s, data->signal_threshold, 4) < 0) { in bgscan_simple_init()
142 data->scan_interval = data->short_interval; in bgscan_simple_init()
143 data->max_short_scans = data->long_interval / data->short_interval + 1; in bgscan_simple_init()
144 if (data->signal_threshold) { in bgscan_simple_init()
148 siginfo.current_signal >= data->signal_threshold) in bgscan_simple_init()
149 data->scan_interval = data->long_interval; in bgscan_simple_init()
152 data->scan_interval); in bgscan_simple_init()
153 eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout, in bgscan_simple_init()
154 data, NULL); in bgscan_simple_init()
162 os_get_reltime(&data->last_bgscan); in bgscan_simple_init()
164 return data; in bgscan_simple_init()
170 struct bgscan_simple_data *data = priv; in bgscan_simple_deinit() local
171 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL); in bgscan_simple_deinit()
172 if (data->signal_threshold) in bgscan_simple_deinit()
173 wpa_drv_signal_monitor(data->wpa_s, 0, 0); in bgscan_simple_deinit()
174 os_free(data); in bgscan_simple_deinit()
181 struct bgscan_simple_data *data = priv; in bgscan_simple_notify_scan() local
185 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL); in bgscan_simple_notify_scan()
186 eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout, in bgscan_simple_notify_scan()
187 data, NULL); in bgscan_simple_notify_scan()
212 struct bgscan_simple_data *data = priv; in bgscan_simple_notify_signal_change() local
216 if (data->short_interval == data->long_interval || in bgscan_simple_notify_signal_change()
217 data->signal_threshold == 0) in bgscan_simple_notify_signal_change()
224 if (data->scan_interval == data->long_interval && !above) { in bgscan_simple_notify_signal_change()
227 data->scan_interval = data->short_interval; in bgscan_simple_notify_signal_change()
229 if (now.sec > data->last_bgscan.sec + 1 && in bgscan_simple_notify_signal_change()
230 data->short_scan_count <= data->max_short_scans) in bgscan_simple_notify_signal_change()
238 else if (data->last_bgscan.sec + data->long_interval > in bgscan_simple_notify_signal_change()
239 now.sec + data->scan_interval) { in bgscan_simple_notify_signal_change()
244 eloop_cancel_timeout(bgscan_simple_timeout, data, in bgscan_simple_notify_signal_change()
246 eloop_register_timeout(data->scan_interval, 0, in bgscan_simple_notify_signal_change()
247 bgscan_simple_timeout, data, in bgscan_simple_notify_signal_change()
250 } else if (data->scan_interval == data->short_interval && above) { in bgscan_simple_notify_signal_change()
253 data->scan_interval = data->long_interval; in bgscan_simple_notify_signal_change()
254 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL); in bgscan_simple_notify_signal_change()
255 eloop_register_timeout(data->scan_interval, 0, in bgscan_simple_notify_signal_change()
256 bgscan_simple_timeout, data, NULL); in bgscan_simple_notify_signal_change()
263 if (now.sec > data->last_bgscan.sec + 10) in bgscan_simple_notify_signal_change()
269 eloop_cancel_timeout(bgscan_simple_timeout, data, NULL); in bgscan_simple_notify_signal_change()
270 eloop_register_timeout(0, 0, bgscan_simple_timeout, data, in bgscan_simple_notify_signal_change()