if_wi channel set problem

Andrew Thompson thompsa at FreeBSD.org
Fri Sep 14 15:39:22 PDT 2007


On Sat, Aug 25, 2007 at 07:05:18PM -0300, JoaoBR wrote:
> 
> Hi
> 
> I sent this some time ago but nothing changed.
> 
> Whatever channel I try to set on a wi card it stays at channel 3, I use hostap
> 
> Even hardcoding the default channel in if_wi.c does not help, it is not 
> possible setting the channel to anything else as channel 3 which it is 
> already when the driver comes up
> 
> somebody has a help for me?

Can you please test this patch.


Andrew
-------------- next part --------------
Index: if_wi.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/wi/if_wi.c,v
retrieving revision 1.213
diff -u -p -r1.213 if_wi.c
--- if_wi.c	5 Sep 2007 21:31:32 -0000	1.213
+++ if_wi.c	14 Sep 2007 22:36:16 -0000
@@ -608,7 +608,7 @@ wi_power(struct wi_softc *sc, int why)
 		break;
 	case PWR_RESUME:
 		if (ifp->if_flags & IFF_UP) {
-			wi_init(ifp);
+			wi_init(sc);
 			(void)wi_intr(sc);
 		}
 		break;
@@ -3536,8 +3536,17 @@ wi_set_channel(struct ieee80211com *ic)
 	struct wi_softc *sc = ifp->if_softc;
 
 	WI_LOCK(sc);
-	if (!(sc->sc_flags & WI_FLAGS_SCANNING)) {
+	if (sc->sc_enabled && !(sc->sc_flags & WI_FLAGS_SCANNING)) {
 		sc->wi_channel = ic->ic_curchan;
+		wi_write_val(sc, WI_RID_OWN_CHNL,
+		    ieee80211_chan2ieee(ic, ic->ic_curchan));
+
+		if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
+		    sc->sc_firmware_type == WI_INTERSIL) {
+			/* XXX: some cards need to be re-enabled */
+			wi_cmd(sc, WI_CMD_DISABLE | WI_PORT0, 0, 0, 0);
+			wi_cmd(sc, WI_CMD_ENABLE | WI_PORT0, 0, 0, 0);
+		}
 	}
 	WI_UNLOCK(sc);
 }


More information about the freebsd-current mailing list