From 69c3b1813e4f6d1c902e010cfb16f6ae8cb63535 Mon Sep 17 00:00:00 2001 From: skrll Date: Sat, 8 Oct 2005 06:19:46 +0000 Subject: [PATCH] Use the new scan command for monitor mode as well. --- sys/dev/pci/if_iwi.c | 17 +++++++++-------- sys/dev/pci/if_iwireg.h | 16 ++++------------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 012129d1d994..b100d95f2819 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwi.c,v 1.29 2005/09/29 19:57:36 skrll Exp $ */ +/* $NetBSD: if_iwi.c,v 1.30 2005/10/08 06:19:46 skrll Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.29 2005/09/29 19:57:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.30 2005/10/08 06:19:46 skrll Exp $"); /*- * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver @@ -2082,17 +2082,18 @@ static int iwi_set_chan(struct iwi_softc *sc, struct ieee80211_channel *chan) { struct ieee80211com *ic = &sc->sc_ic; - struct iwi_scan scan; + struct iwi_scan_v2 scan; (void)memset(&scan, 0, sizeof scan); - scan.type = IWI_SCAN_TYPE_PASSIVE; - scan.dwelltime = htole16(2000); - scan.channels[0] = 1 | (IEEE80211_IS_CHAN_5GHZ(chan) ? IWI_CHAN_5GHZ : - IWI_CHAN_2GHZ); + + scan.dwelltime[IWI_SCAN_TYPE_PASSIVE] = htole16(2000); + scan.channels[0] = 1 | + (IEEE80211_IS_CHAN_5GHZ(chan) ? IWI_CHAN_5GHZ : IWI_CHAN_2GHZ); scan.channels[1] = ieee80211_chan2ieee(ic, chan); + iwi_scan_type_set(scan, 1, IWI_SCAN_TYPE_PASSIVE); DPRINTF(("Setting channel to %u\n", ieee80211_chan2ieee(ic, chan))); - return iwi_cmd(sc, IWI_CMD_SCAN, &scan, sizeof scan, 1); + return iwi_cmd(sc, IWI_CMD_SCAN_V2, &scan, sizeof scan, 1); } static int diff --git a/sys/dev/pci/if_iwireg.h b/sys/dev/pci/if_iwireg.h index 1f755b185d3e..68e7d0408893 100644 --- a/sys/dev/pci/if_iwireg.h +++ b/sys/dev/pci/if_iwireg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwireg.h,v 1.10 2005/09/29 19:45:57 skrll Exp $ */ +/* $NetBSD: if_iwireg.h,v 1.11 2005/10/08 06:19:46 skrll Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -334,17 +334,6 @@ struct iwi_associate { #define IWI_SCAN_TYPE_ACTIVE_BDIRECT 4 #define IWI_SCAN_TYPES 5 -/* structure for command IWI_CMD_SCAN */ -struct iwi_scan { - uint8_t type; - uint16_t dwelltime; - uint8_t channels[IWI_SCAN_CHANNELS]; -#define IWI_CHAN_5GHZ (0 << 6) -#define IWI_CHAN_2GHZ (1 << 6) - - uint8_t reserved[3]; -} __attribute__((__packed__)); - #define iwi_scan_type_set(s, i, t) \ do { \ if ((i) % 2 == 0) \ @@ -357,6 +346,9 @@ struct iwi_scan { struct iwi_scan_v2 { u_int32_t fsidx; u_int8_t channels[IWI_SCAN_CHANNELS]; +#define IWI_CHAN_5GHZ (0 << 6) +#define IWI_CHAN_2GHZ (1 << 6) + struct { u_int8_t msn:4; u_int8_t lsn:4;