From aa513e63382d52c75d81cbe12ed8774c013670d6 Mon Sep 17 00:00:00 2001 From: onoe Date: Tue, 12 Dec 2000 05:34:02 +0000 Subject: [PATCH] add support(?) for PC4500 which is a 2Mbps product. Though ifconfig -m no longer show 5Mbps/11Mbps for PC4500 by this fix, I cannot find how to set fixed transmit speed to the firmware. FreeBSD version of driver apparently ignore the value set by ancontrol(8). --- sys/dev/ic/an.c | 46 +++++++++++++++++++++++++---------- sys/dev/pcmcia/if_an_pcmcia.c | 4 ++- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 29f26e5ba034..d3584289b127 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $NetBSD: an.c,v 1.4 2000/12/12 05:11:15 onoe Exp $ */ +/* $NetBSD: an.c,v 1.5 2000/12/12 05:34:02 onoe Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -212,6 +212,7 @@ int an_attach(sc) { struct ifnet *ifp = &sc->arpcom.ec_if; #ifdef IFM_IEEE80211 + int i, mtype; struct ifmediareq imr; #endif @@ -294,18 +295,32 @@ int an_attach(sc) #ifdef IFM_IEEE80211 ifmedia_init(&sc->sc_media, 0, an_media_change, an_media_status); -#define ADD(m, o) ifmedia_add(&sc->sc_media, IFM_MAKEWORD(IFM_IEEE80211, (m), (o), 0), 0, NULL) - ADD(IFM_AUTO, 0); - ADD(IFM_AUTO, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS1, 0); - ADD(IFM_IEEE80211_DS1, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS2, 0); - ADD(IFM_IEEE80211_DS2, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS5, 0); - ADD(IFM_IEEE80211_DS5, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS11, 0); - ADD(IFM_IEEE80211_DS11, IFM_IEEE80211_ADHOC); -#undef ADD + ifmedia_add(&sc->sc_media, IFM_MAKEWORD(IFM_IEEE80211, IFM_AUTO, + 0, 0), 0, NULL); + ifmedia_add(&sc->sc_media, IFM_MAKEWORD(IFM_IEEE80211, IFM_AUTO, + IFM_IEEE80211_ADHOC, 0), 0, NULL); + for (i = 0; i < sizeof(sc->an_caps.an_rates); i++) { + switch (sc->an_caps.an_rates[i]) { + case AN_RATE_1MBPS: + mtype = IFM_IEEE80211_DS1; + break; + case AN_RATE_2MBPS: + mtype = IFM_IEEE80211_DS2; + break; + case AN_RATE_5_5MBPS: + mtype = IFM_IEEE80211_DS5; + break; + case AN_RATE_11MBPS: + mtype = IFM_IEEE80211_DS11; + break; + default: + continue; + } + ifmedia_add(&sc->sc_media, IFM_MAKEWORD(IFM_IEEE80211, mtype, + 0, 0), 0, NULL); + ifmedia_add(&sc->sc_media, IFM_MAKEWORD(IFM_IEEE80211, mtype, + IFM_IEEE80211_ADHOC, 0), 0, NULL); + } an_media_status(ifp, &imr); ifmedia_set(&sc->sc_media, imr.ifm_active); #endif @@ -1103,6 +1118,11 @@ an_media_change(ifp) sc->an_config.an_opmode = AN_OPMODE_IBSS_ADHOC; else sc->an_config.an_opmode = AN_OPMODE_INFRASTRUCTURE_STATION; + /* + * XXX: how to set txrate for the firmware? + * There is a struct defined as an_txframe, which is used nowhere. + * Perhaps we need to change the transmit mode from 802.3 to native. + */ if (sc->sc_enabled) an_init(ifp); return error; diff --git a/sys/dev/pcmcia/if_an_pcmcia.c b/sys/dev/pcmcia/if_an_pcmcia.c index 36073dcaabf6..6ed1d1706011 100644 --- a/sys/dev/pcmcia/if_an_pcmcia.c +++ b/sys/dev/pcmcia/if_an_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_an_pcmcia.c,v 1.3 2000/12/12 05:11:16 onoe Exp $ */ +/* $NetBSD: if_an_pcmcia.c,v 1.4 2000/12/12 05:34:02 onoe Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -123,6 +123,8 @@ static struct an_pcmcia_product { } an_pcmcia_products[] = { { PCMCIA_VENDOR_AIRONET, PCMCIA_PRODUCT_AIRONET_PC4800, PCMCIA_CIS_AIRONET_PC4800, PCMCIA_STR_AIRONET_PC4800 }, + { PCMCIA_VENDOR_AIRONET, PCMCIA_PRODUCT_AIRONET_PC4500, + PCMCIA_CIS_AIRONET_PC4500, PCMCIA_STR_AIRONET_PC4500 }, { 0, 0, { NULL, NULL, NULL, NULL }, NULL } };