Example #1
0
static int wl1271_event_scan_complete(struct wl1271 *wl,
				      struct event_mailbox *mbox)
{
	wl1271_debug(DEBUG_EVENT, "status: 0x%x",
		     mbox->scheduled_scan_status);

	if (test_bit(WL1271_FLAG_SCANNING, &wl->flags)) {
		if (wl->scan.state == WL1271_SCAN_BAND_DUAL) {
			/* 2.4 GHz band scanned, scan 5 GHz band, pretend
			 * to the wl1271_cmd_scan function that we are not
			 * scanning as it checks that.
			 */
			clear_bit(WL1271_FLAG_SCANNING, &wl->flags);
			/* FIXME: ie missing! */
			wl1271_cmd_scan(wl, wl->scan.ssid, wl->scan.ssid_len,
						NULL, 0,
						wl->scan.active,
						wl->scan.high_prio,
						WL1271_SCAN_BAND_5_GHZ,
						wl->scan.probe_requests);
		} else {
			mutex_unlock(&wl->mutex);
			ieee80211_scan_completed(wl->hw, false);
			mutex_lock(&wl->mutex);
			clear_bit(WL1271_FLAG_SCANNING, &wl->flags);
		}
	}
	return 0;
}
Example #2
0
static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
			     struct cfg80211_scan_request *req)
{
	struct wl1271 *wl = hw->priv;
	int ret;
	u8 *ssid = NULL;
	size_t ssid_len = 0;

	wl1271_debug(DEBUG_MAC80211, "mac80211 hw scan");

	if (req->n_ssids) {
		ssid = req->ssids[0].ssid;
		ssid_len = req->ssids[0].ssid_len;
	}

	mutex_lock(&wl->mutex);

	ret = wl1271_ps_elp_wakeup(wl, false);
	if (ret < 0)
		goto out;

	ret = wl1271_cmd_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);

	wl1271_ps_elp_sleep(wl);

out:
	mutex_unlock(&wl->mutex);

	return ret;
}
static int wl1271_event_scan_complete(struct wl1271 *wl,
				      struct event_mailbox *mbox)
{
	int size = sizeof(struct wl12xx_probe_req_template);
	wl1271_debug(DEBUG_EVENT, "status: 0x%x",
		     mbox->scheduled_scan_status);

	if (wl->scanning) {
		if (wl->scan.state == WL1271_SCAN_BAND_DUAL) {
			wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4,
						NULL, size);
			/* 2.4 GHz band scanned, scan 5 GHz band, pretend
			 * to the wl1271_cmd_scan function that we are not
			 * scanning as it checks that.
			 */
			wl->scanning = false;
			wl1271_cmd_scan(wl, wl->scan.ssid, wl->scan.ssid_len,
						wl->scan.active,
						wl->scan.high_prio,
						WL1271_SCAN_BAND_5_GHZ,
						wl->scan.probe_requests);
		} else {
			if (wl->scan.state == WL1271_SCAN_BAND_2_4_GHZ)
				wl1271_cmd_template_set(wl,
						CMD_TEMPL_CFG_PROBE_REQ_2_4,
						NULL, size);
			else
				wl1271_cmd_template_set(wl,
						CMD_TEMPL_CFG_PROBE_REQ_5,
						NULL, size);

			mutex_unlock(&wl->mutex);
			ieee80211_scan_completed(wl->hw, false);
			mutex_lock(&wl->mutex);
			wl->scanning = false;
		}
	}
	return 0;
}