summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/if_wi.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-05-06 16:32:45 +0000
committerwpaul <wpaul@FreeBSD.org>1999-05-06 16:32:45 +0000
commit07346f9ac9fe802fcc05cd359908c49f1f272028 (patch)
tree15f4d90c511ecb7a88130a0dee59552c001f028c /sys/i386/isa/if_wi.c
parent8b3db0e8228985fa682b3e2e72ab560619831fbc (diff)
downloadFreeBSD-src-07346f9ac9fe802fcc05cd359908c49f1f272028.zip
FreeBSD-src-07346f9ac9fe802fcc05cd359908c49f1f272028.tar.gz
Modify wicontrol(8) and wi(4) to allow setting the frequency of the
WaveLAN's radio modem. The default is whatever the NIC uses since NICs sold in different countries may default to different frequencies. (The Lose95/LoseNT software doesn't let you select the channel so it's probably not really meant to be changed.)
Diffstat (limited to 'sys/i386/isa/if_wi.c')
-rw-r--r--sys/i386/isa/if_wi.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c
index 35f585e..5a4948d 100644
--- a/sys/i386/isa/if_wi.c
+++ b/sys/i386/isa/if_wi.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $
+ * $Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $
*/
/*
@@ -116,7 +116,7 @@
#if !defined(lint)
static const char rcsid[] =
- "$Id: if_wi.c,v 1.48 1999/05/05 00:32:13 wpaul Exp wpaul $";
+ "$Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $";
#endif
static struct wi_softc wi_softc[NWI];
@@ -275,6 +275,7 @@ static int wi_attach(isa_dev)
{
struct wi_softc *sc;
struct wi_ltv_macaddr mac;
+ struct wi_ltv_gen gen;
struct ifnet *ifp;
char ifname[IFNAMSIZ];
@@ -330,6 +331,17 @@ static int wi_attach(isa_dev)
sc->wi_max_data_len = WI_DEFAULT_DATALEN;
sc->wi_create_ibss = WI_DEFAULT_CREATE_IBSS;
+ /*
+ * Read the default channel from the NIC. This may vary
+ * depending on the country where the NIC was purchased, so
+ * we can't hard-code a default and expect it to work for
+ * everyone.
+ */
+ gen.wi_type = WI_RID_OWN_CHNL;
+ gen.wi_len = 2;
+ wi_read_record(sc, &gen);
+ sc->wi_channel = gen.wi_val;
+
bzero((char *)&sc->wi_stats, sizeof(sc->wi_stats));
wi_init(sc);
@@ -941,6 +953,9 @@ static void wi_setdef(sc, wreq)
case WI_RID_CREATE_IBSS:
sc->wi_create_ibss = wreq->wi_val[0];
break;
+ case WI_RID_OWN_CHNL:
+ sc->wi_channel = wreq->wi_val[0];
+ break;
case WI_RID_NODENAME:
bzero(sc->wi_node_name, sizeof(sc->wi_node_name));
bcopy((char *)&wreq->wi_val[1], sc->wi_node_name, 30);
@@ -957,6 +972,9 @@ static void wi_setdef(sc, wreq)
break;
}
+ /* Reinitialize WaveLAN. */
+ wi_init(sc);
+
return;
}
@@ -1094,6 +1112,9 @@ static void wi_init(xsc)
/* Specify the network name */
WI_SETSTR(WI_RID_DESIRED_SSID, sc->wi_net_name);
+ /* Specify the frequency to use */
+ WI_SETVAL(WI_RID_OWN_CHNL, sc->wi_channel);
+
/* Program the nodename. */
WI_SETSTR(WI_RID_NODENAME, sc->wi_node_name);
OpenPOWER on IntegriCloud