summaryrefslogtreecommitdiffstats
path: root/sys/dev/wi
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/dev/wi
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/dev/wi')
-rw-r--r--sys/dev/wi/if_wi.c25
-rw-r--r--sys/dev/wi/if_wireg.h7
2 files changed, 28 insertions, 4 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 35f585e..5a4948d 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/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);
diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h
index 271092d..a2db415 100644
--- a/sys/dev/wi/if_wireg.h
+++ b/sys/dev/wi/if_wireg.h
@@ -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_wireg.h,v 1.29 1999/05/06 03:05:48 wpaul Exp $
+ * $Id: if_wireg.h,v 1.30 1999/05/06 16:12:06 wpaul Exp $
*/
struct wi_counters {
@@ -73,6 +73,7 @@ struct wi_softc {
u_int16_t wi_ap_density;
u_int16_t wi_tx_rate;
u_int16_t wi_create_ibss;
+ u_int16_t wi_channel;
char wi_node_name[32];
char wi_net_name[32];
char wi_ibss_name[32];
@@ -111,6 +112,8 @@ struct wi_softc {
#define WI_DEFAULT_IBSS "FreeBSD IBSS"
+#define WI_DEFAULT_CHAN 3
+
/*
* register space access macros
*/
@@ -456,7 +459,7 @@ struct wi_ltv_ssid {
/*
* Set communications channel (radio frequency).
*/
-#define WI_RID_CHNL 0xFC03
+#define WI_RID_OWN_CHNL 0xFC03
/*
* Frame data size.
OpenPOWER on IntegriCloud