}
 
 int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+                   struct ieee80211_channel *channels[],
                    unsigned int n_channels, unsigned int n_probes)
 {
        struct wl1251_cmd_scan *cmd;
                memset(&cmd->channels[i].bssid_msb, 0xff, 2);
                cmd->channels[i].early_termination = 0;
                cmd->channels[i].tx_power_att = 0;
-               cmd->channels[i].channel = i + 1;
+               cmd->channels[i].channel = channels[i]->hw_value;
        }
 
        cmd->params.ssid_len = ssid_len;
 
 
 #include "wl1251.h"
 
+#include <net/cfg80211.h>
+
 struct acx_header;
 
 int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
 int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
                            void *buf, size_t buf_len);
 int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
+                   struct ieee80211_channel *channels[],
                    unsigned int n_channels, unsigned int n_probes);
 int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout);
 
 #define WL1251_SCAN_MIN_DURATION 30000
 #define WL1251_SCAN_MAX_DURATION 60000
 
+#define WL1251_SCAN_NUM_PROBES 3
+
 struct wl1251_scan_parameters {
        u32 rx_config_options;
        u32 rx_filter_options;
 
 
        wl->scanning = true;
 
-       ret = wl1251_cmd_scan(wl, ssid, ssid_len, 13, 3);
+       ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels,
+                             req->n_channels, WL1251_SCAN_NUM_PROBES);
        if (ret < 0) {
                wl->scanning = false;
                goto out_sleep;