diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-21 22:47:16 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-21 22:47:16 +0000 |
commit | f1edfddc3c03c1ed513c9350894fdcae38afa334 (patch) | |
tree | 34c3e65ef2079190c1a3170a551ff44f87bdd287 /sys/net80211/ieee80211.c | |
parent | faf3172e6428641146437ae2d456ef27aa16fabe (diff) |
scan the next mode if nothing has been found. this is necessary if the
device supports different incompatible modes in the same channel
range, like like 11b and "pure" 11G mode.
ok dlg@ pvalchev@
Diffstat (limited to 'sys/net80211/ieee80211.c')
-rw-r--r-- | sys/net80211/ieee80211.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index ab2c5a3b9bd..dd2a6531467 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.5 2005/04/20 19:52:43 reyk Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.6 2005/04/21 22:47:15 reyk Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -802,6 +802,33 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) #undef N } +void +ieee80211_next_mode(struct ifnet *ifp) +{ + struct ieee80211com *ic = (void *)ifp; + + if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) != IFM_AUTO) + return; + + /* + * Get the next supported mode + */ + for (++ic->ic_curmode; + ic->ic_curmode <= IEEE80211_MODE_TURBO; + ic->ic_curmode++) { + /* Wrap around and ignore turbo mode */ + if (ic->ic_curmode >= IEEE80211_MODE_TURBO) { + ic->ic_curmode = IEEE80211_MODE_AUTO; + break; + } + + if (ic->ic_modecaps & (1 << ic->ic_curmode)) + break; + } + + ieee80211_setmode(ic, ic->ic_curmode); +} + /* * Return the phy mode for with the specified channel so the * caller can select a rate set. This is problematic and the |