backout changes between 1.10 and 1.12 to re-enable awictl stuff.

Actually, it is partially duplicated with SIOC[GS]IFMEDIA and
SIOC[GS]80211NWID ioctls currently supported.  But I'd like to leave it
until configuration interface for common 802.11 stuff will be cleaned up.
This commit is contained in:
onoe 2000-03-27 12:52:45 +00:00
parent fc72e72d7d
commit ab9d324f37
1 changed files with 74 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: awi.c,v 1.13 2000/03/26 10:09:33 itojun Exp $ */
/* $NetBSD: awi.c,v 1.14 2000/03/27 12:52:45 onoe Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -137,10 +137,8 @@
#include <dev/ic/am79c930var.h>
#include <dev/ic/awireg.h>
#include <dev/ic/awivar.h>
#if 0
#include <dev/ic/awictl.h>
#endif
#endif
#ifdef __FreeBSD__
#include <dev/awi/am79c930reg.h>
#include <dev/awi/am79c930var.h>
@ -680,16 +678,23 @@ awi_media_status(ifp, imr)
}
#endif /* IFM_IEEE80211 */
/*
* XXX
* The following stuff is partially duplicated with SIOC[GS]IFMEDIA and
* SIOC[GS]80211NWID, which should be integrated as well as other common
* stuff among 802.11 wireless LAN drivers.
*/
static int
awi_drvget(ifp, cmd, data)
struct ifnet *ifp;
u_long cmd;
caddr_t data;
{
#if 0
struct awi_softc *sc = ifp->if_softc;
struct ifdrv *ifd = (struct ifdrv *)data;
u_int8_t buf[AWICTL_BUFSIZE];
u_int8_t *essid;
int error = 0;
switch (ifd->ifd_cmd) {
@ -713,6 +718,30 @@ awi_drvget(ifp, cmd, data)
ifd->ifd_len = 1;
buf[0] = sc->sc_rawbpf;
break;
case AWICTL_DESSID:
case AWICTL_CESSID:
if (ifd->ifd_cmd == AWICTL_DESSID)
essid = sc->sc_mib_mac.aDesired_ESS_ID;
else
essid = sc->sc_bss.essid;
if (ifd->ifd_len < essid[1])
return ENOSPC;
ifd->ifd_len = essid[1];
if (ifd->ifd_len > 0)
memcpy(buf, essid, ifd->ifd_len);
break;
case AWICTL_MODE:
if (ifd->ifd_len < 1)
return ENOSPC;
ifd->ifd_len = 1;
if (sc->sc_mib_local.Network_Mode == 0) {
if (sc->sc_no_bssid)
buf[0] = AWICTL_MODE_NOBSSID;
else
buf[0] = AWICTL_MODE_ADHOC;
} else
buf[0] = AWICTL_MODE_INFRA;
break;
default:
error = EINVAL;
break;
@ -720,9 +749,6 @@ awi_drvget(ifp, cmd, data)
if (error == 0 && ifd->ifd_len > 0)
error = copyout(ifd->ifd_data, buf, ifd->ifd_len);
return error;
#else
return EINVAL;
#endif
}
static int
@ -731,7 +757,6 @@ awi_drvset(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
#if 0
struct awi_softc *sc = ifp->if_softc;
struct ifdrv *ifd = (struct ifdrv *)data;
u_int8_t buf[AWICTL_BUFSIZE];
@ -786,14 +811,52 @@ awi_drvset(ifp, cmd, data)
return EINVAL;
sc->sc_rawbpf = buf[0];
break;
case AWICTL_DESSID:
if (ifd->ifd_len > IEEE80211_NWID_LEN)
return EINVAL;
if (sc->sc_mib_mac.aDesired_ESS_ID[1] == ifd->ifd_len &&
memcmp(&sc->sc_mib_mac.aDesired_ESS_ID[2], buf,
ifd->ifd_len) == 0)
break;
memset(sc->sc_mib_mac.aDesired_ESS_ID, 0, AWI_ESS_ID_SIZE);
sc->sc_mib_mac.aDesired_ESS_ID[0] = IEEE80211_ELEMID_SSID;
sc->sc_mib_mac.aDesired_ESS_ID[1] = ifd->ifd_len;
memcpy(&sc->sc_mib_mac.aDesired_ESS_ID[2], buf, ifd->ifd_len);
if (sc->sc_enabled) {
awi_stop(sc);
error = awi_init(sc);
}
break;
case AWICTL_CESSID:
error = EINVAL;
break;
case AWICTL_MODE:
switch (buf[0]) {
case AWICTL_MODE_INFRA:
sc->sc_mib_local.Network_Mode = 1;
sc->sc_no_bssid = 0;
break;
case AWICTL_MODE_ADHOC:
sc->sc_mib_local.Network_Mode = 0;
sc->sc_no_bssid = 0;
break;
case AWICTL_MODE_NOBSSID:
sc->sc_mib_local.Network_Mode = 0;
sc->sc_no_bssid = 1;
break;
default:
return EINVAL;
}
if (sc->sc_enabled) {
awi_stop(sc);
error = awi_init(sc);
}
break;
default:
error = EINVAL;
break;
}
return error;
#else
return EINVAL;
#endif
}
int