diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-08-12 10:30:16 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-08-12 10:30:16 +0000 |
commit | 490bac76b8b8f6f9a2ad57f148ddfda9538aa04f (patch) | |
tree | a865a619561fb85692731d1a431c91822dd5a451 /sys | |
parent | 8b2aa71727816346e142b645790f164e29c98fe6 (diff) |
Fill ic_max_rssi with values depending on the radio type. Makes signal
strength in percentage work.
ok jsg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/acx.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/acxvar.h | 8 |
2 files changed, 25 insertions, 3 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index 00a24b70bf2..fbdf5ffd470 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.36 2006/08/08 10:49:16 jsg Exp $ */ +/* $OpenBSD: acx.c,v 1.37 2006/08/12 10:30:15 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -198,6 +198,7 @@ int acx_set_beacon_tmplt(struct acx_softc *, const char *, int, int); int acx_read_eeprom(struct acx_softc *, uint32_t, uint8_t *); int acx_read_phyreg(struct acx_softc *, uint32_t, uint8_t *); const char * acx_get_rf(int rev); +int acx_get_maxrssi(int); int acx_load_firmware(struct acx_softc *, uint32_t, const uint8_t *, int); @@ -345,6 +346,9 @@ acx_attach(struct acx_softc *sc) sc->sc_newstate = ic->ic_newstate; ic->ic_newstate = acx_newstate; + /* Set maximal rssi */ + ic->ic_max_rssi = acx_get_maxrssi(sc->sc_radio_type); + ieee80211_media_init(ifp, ieee80211_media_change, ieee80211_media_status); @@ -1327,7 +1331,7 @@ acx_rxeof(struct acx_softc *sc) tap->wr_chan_flags = htole16(ic->ic_bss->ni_chan->ic_flags); tap->wr_rssi = head->rbh_level; - tap->wr_max_rssi = 0; /* XXX */ + tap->wr_max_rssi = ic->ic_max_rssi; M_DUP_PKTHDR(&mb, m); mb.m_data = (caddr_t)tap; @@ -2735,3 +2739,15 @@ acx_get_rf(int rev) default: return "unknown"; } } + +int +acx_get_maxrssi(int radio) +{ + switch (radio) { + case ACX_RADIO_TYPE_MAXIM: return ACX_RADIO_RSSI_MAXIM; + case ACX_RADIO_TYPE_RFMD: return ACX_RADIO_RSSI_RFMD; + case ACX_RADIO_TYPE_RALINK: return ACX_RADIO_RSSI_RALINK; + case ACX_RADIO_TYPE_RADIA: return ACX_RADIO_RSSI_RADIA; + default: return ACX_RADIO_RSSI_UNKN; + } +} diff --git a/sys/dev/ic/acxvar.h b/sys/dev/ic/acxvar.h index fa76785ebcd..0a6720e2dfc 100644 --- a/sys/dev/ic/acxvar.h +++ b/sys/dev/ic/acxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acxvar.h,v 1.10 2006/08/07 10:46:12 mglocker Exp $ */ +/* $OpenBSD: acxvar.h,v 1.11 2006/08/12 10:30:15 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -491,6 +491,12 @@ struct acx_softc { #define ACX_RADIO_TYPE_UNKN17 0x17 #define ACX_RADIO_TYPE_UNKN19 0x19 +#define ACX_RADIO_RSSI_MAXIM 120 /* 100dB */ +#define ACX_RADIO_RSSI_RFMD 215 /* 215dB */ +#define ACX_RADIO_RSSI_RALINK 0 /* XXX unknown yet */ +#define ACX_RADIO_RSSI_RADIA 78 /* 78db */ +#define ACX_RADIO_RSSI_UNKN 0 /* unknown radio */ + extern const struct ieee80211_rateset acx_rates_11b; extern const struct ieee80211_rateset acx_rates_11g; extern int acx_beacon_intvl; |