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.)
This commit is contained in:
parent
8b3db0e822
commit
07346f9ac9
@ -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);
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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.
|
||||
|
@ -59,6 +59,8 @@
|
||||
.Fl i Ar iface Fl d Ar max data length
|
||||
.Nm wicontrol
|
||||
.Fl i Ar iface Fl r Ar RTS threshold
|
||||
.Nm wicontrol
|
||||
.Fl i Ar iface Fl f Ar frequency
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
@ -79,14 +81,7 @@ The
|
||||
argument given to
|
||||
.Nm
|
||||
should be the logical interface name associated with the WaveLAN/IEEE
|
||||
device (wi0, wi1, etc...). Interface parameters should only be changed
|
||||
when the interface is down. If the interface is already up, you should
|
||||
use the
|
||||
.Xr ifconfig 8
|
||||
command to bring the interface down, then set the interface parameters
|
||||
with
|
||||
.Nm ,
|
||||
and then bring the interface up again.
|
||||
device (wi0, wi1, etc...).
|
||||
.Sh OPTIONS
|
||||
The options are as follows:
|
||||
.Bl -tag -width Fl
|
||||
@ -171,6 +166,15 @@ Set the RTS/CTS threshold for a given interface. This controls the
|
||||
number of bytes used for the RTS/CTS handhake boundary. The
|
||||
.Ar RTS threshold
|
||||
can be any value between 0 and 2047. The default is 2347.
|
||||
.It Fl i Ar iface Fl f frequency
|
||||
Specify the radio frequency to use for a given interface. There are
|
||||
a small number of different channels available use in different geographical
|
||||
areas. Known values are 3 (2422Mhz) for the United States, 11 (2422Mhz)
|
||||
for France and 14 (2484Mhz) for Japan, however the NIC may accept any
|
||||
channel number between 0 and 14. If an illegal channel is specified, the
|
||||
NIC will revert to its default channel. For NIC sold in the United States,
|
||||
the default channel is 3. Note that two stations must be
|
||||
set to the same channel in order to communicate.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr wi 4 ,
|
||||
|
@ -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: wicontrol.c,v 1.15 1999/05/06 03:05:48 wpaul Exp $
|
||||
* $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -56,7 +56,7 @@
|
||||
static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
|
||||
Bill Paul. All rights reserved.";
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: wicontrol.c,v 1.15 1999/05/06 03:05:48 wpaul Exp $";
|
||||
"@(#) $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $";
|
||||
#endif
|
||||
|
||||
static void wi_getval __P((char *, struct wi_req *));
|
||||
@ -438,7 +438,7 @@ int main(argc, argv)
|
||||
char *iface = NULL;
|
||||
char *p = argv[0];
|
||||
|
||||
while((ch = getopt(argc, argv, "hoc:d:i:p:r:q:t:n:s:m:")) != -1) {
|
||||
while((ch = getopt(argc, argv, "hoc:d:f:i:p:r:q:t:n:s:m:")) != -1) {
|
||||
switch(ch) {
|
||||
case 'o':
|
||||
wi_dumpstats(iface);
|
||||
@ -455,6 +455,10 @@ int main(argc, argv)
|
||||
wi_setword(iface, WI_RID_MAX_DATALEN, atoi(optarg));
|
||||
exit(0);
|
||||
break;
|
||||
case 'f':
|
||||
wi_setword(iface, WI_RID_OWN_CHNL, atoi(optarg));
|
||||
exit(0);
|
||||
break;
|
||||
case 'p':
|
||||
wi_setword(iface, WI_RID_PORTTYPE, atoi(optarg));
|
||||
exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user