1This patch allows for highly extended frequency settings for Atheros wifi cards. 2I have tested and confirmed the frequencies as best as I can. Monitoring should be 3safe, but transmitting will most likely lead to the fcc paying you a vist. I have 4done all I can to stop you from accidently getting in trouble, the rest is up to 5you. -ZC 6 7----------------------------------------------------------------------------------- 8 9diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/ath5k.h linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/ath5k.h 10--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/ath5k.h 2008-10-09 18:13:53.000000000 -0400 11+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/ath5k.h 2008-11-12 23:19:12.000000000 -0500 12@@ -23,7 +23,7 @@ 13 * long and results timeouts). It's also illegal to tune to some of the 14 * supported frequencies in some countries, so use this at your own risk, 15 * you've been warned. */ 16-#define CHAN_DEBUG 0 17+#define CHAN_DEBUG 1 18 19 #include <linux/io.h> 20 #include <linux/types.h> 21diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.c linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.c 22--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.c 2008-10-09 18:13:53.000000000 -0400 23+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.c 2008-11-12 23:19:12.000000000 -0500 24@@ -217,7 +217,7 @@ 25 static void ath5k_detach(struct pci_dev *pdev, 26 struct ieee80211_hw *hw); 27 /* Channel/mode setup */ 28-static inline short ath5k_ieee2mhz(short chan); 29+static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq); 30 static unsigned int ath5k_copy_rates(struct ieee80211_rate *rates, 31 const struct ath5k_rate_table *rt, 32 unsigned int max); 33@@ -804,12 +804,15 @@ 34 * Convert IEEE channel number to MHz frequency. 35 */ 36 static inline short 37-ath5k_ieee2mhz(short chan) 38+ath5k_ieee2mhz(int chan, unsigned int chfreq) 39 { 40- if (chan <= 14 || chan >= 27) 41- return ieee80211chan2mhz(chan); 42+ if (chfreq == CHANNEL_5GHZ) 43+ return (chan + 1000) * 5; 44 else 45- return 2212 + chan * 20; 46+ if (chan <= 14 || chan >= 27) 47+ return ieee80211chan2mhz(chan); 48+ else 49+ return 2212 + chan * 20; 50 } 51 52 static unsigned int 53@@ -839,7 +842,8 @@ 54 unsigned int mode, 55 unsigned int max) 56 { 57- unsigned int i, count, size, chfreq, freq, ch; 58+ unsigned int i, count, size, chfreq, freq; 59+ int ch; 60 61 if (!test_bit(mode, ah->ah_modes)) 62 return 0; 63@@ -847,14 +851,17 @@ 64 switch (mode) { 65 case AR5K_MODE_11A: 66 case AR5K_MODE_11A_TURBO: 67- /* 1..220, but 2GHz frequencies are filtered by check_channel */ 68- size = 220 ; 69+ /* -16..220 */ 70+ size = 241 ; 71+ ch = -40; 72 chfreq = CHANNEL_5GHZ; 73 break; 74 case AR5K_MODE_11B: 75 case AR5K_MODE_11G: 76 case AR5K_MODE_11G_TURBO: 77- size = 26; 78+ /* -19..26 */ 79+ size = 70; 80+ ch = -42; 81 chfreq = CHANNEL_2GHZ; 82 break; 83 default: 84@@ -862,9 +869,8 @@ 85 return 0; 86 } 87 88- for (i = 0, count = 0; i < size && max > 0; i++) { 89- ch = i + 1 ; 90- freq = ath5k_ieee2mhz(ch); 91+ for (i = 0, count = 0; i < size && max > 0; i++,ch++) { 92+ freq = ath5k_ieee2mhz(ch,chfreq); 93 94 /* Check if channel is supported by the chipset */ 95 if (!ath5k_channel_ok(ah, freq, chfreq)) 96diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.h linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.h 97--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.h 2008-10-09 18:13:53.000000000 -0400 98+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.h 2008-11-12 23:27:26.000000000 -0500 99@@ -51,8 +51,8 @@ 100 #include "debug.h" 101 102 #define ATH_RXBUF 40 /* number of RX buffers */ 103-#define ATH_TXBUF 200 /* number of TX buffers */ 104-#define ATH_BCBUF 1 /* number of beacon buffers */ 105+#define ATH_TXBUF 0 /* number of TX buffers */ 106+#define ATH_BCBUF 0 /* number of beacon buffers */ 107 108 struct ath5k_buf { 109 struct list_head list; 110diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/hw.c linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/hw.c 111--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/hw.c 2008-10-09 18:13:53.000000000 -0400 112+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/hw.c 2008-11-12 23:21:29.000000000 -0500 113@@ -2319,8 +2319,9 @@ 114 */ 115 116 if (AR5K_EEPROM_HDR_11A(ee_header)) { 117- ah->ah_capabilities.cap_range.range_5ghz_min = 5005; /* 4920 */ 118- ah->ah_capabilities.cap_range.range_5ghz_max = 6100; 119+ ah->ah_capabilities.cap_range.range_5ghz_min = 4800; /* 4920 */ 120+ ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what the code said but */ 121+ /* it fried one of my cards */ 122 123 /* Set supported modes */ 124 __set_bit(AR5K_MODE_11A, 125@@ -2336,8 +2337,8 @@ 126 * connected */ 127 if (AR5K_EEPROM_HDR_11B(ee_header) || 128 AR5K_EEPROM_HDR_11G(ee_header)) { 129- ah->ah_capabilities.cap_range.range_2ghz_min = 2412; /* 2312 */ 130- ah->ah_capabilities.cap_range.range_2ghz_max = 2732; 131+ ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* 2312 */ 132+ ah->ah_capabilities.cap_range.range_2ghz_max = 2737; /* 2732 */ 133 134 if (AR5K_EEPROM_HDR_11B(ee_header)) 135 __set_bit(AR5K_MODE_11B, 136@@ -2379,24 +2380,6 @@ 137 ATH5K_TRACE(ah->ah_sc); 138 139 switch (ah->ah_op_mode) { 140- case IEEE80211_IF_TYPE_IBSS: 141- pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_DESC_ANTENNA | 142- (ah->ah_version == AR5K_AR5210 ? 143- AR5K_STA_ID1_NO_PSPOLL : 0); 144- beacon_reg |= AR5K_BCR_ADHOC; 145- break; 146- 147- case IEEE80211_IF_TYPE_AP: 148- pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_RTS_DEF_ANTENNA | 149- (ah->ah_version == AR5K_AR5210 ? 150- AR5K_STA_ID1_NO_PSPOLL : 0); 151- beacon_reg |= AR5K_BCR_AP; 152- break; 153- 154- case IEEE80211_IF_TYPE_STA: 155- pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | 156- (ah->ah_version == AR5K_AR5210 ? 157- AR5K_STA_ID1_PWR_SV : 0); 158 case IEEE80211_IF_TYPE_MNTR: 159 pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA | 160 (ah->ah_version == AR5K_AR5210 ? 161diff -Naur linux-2.6.27-gentoo-r2/net/wireless/reg.c linux-2.6.27-gentoo-r2-afc/net/wireless/reg.c 162--- linux-2.6.27-gentoo-r2/net/wireless/reg.c 2008-10-09 18:13:53.000000000 -0400 163+++ linux-2.6.27-gentoo-r2-afc/net/wireless/reg.c 2008-11-12 23:23:53.000000000 -0500 164@@ -70,6 +70,22 @@ 165 RANGE_PWR(5745, 5825, 30, 6, 0), 166 }; 167 168+static const struct ieee80211_channel_range ieee80211_DEBUG_channels[] = { 169+/* 170+ * WARNING: These values are strictly based on my own limited testing. 171+ * This does not seem to damage MY cards in the limited time I was testing. 172+ * Monitor mode tuning of these channels *should* be 100% safe, however, 173+ * ANY transmissions may not only permanently damage your card, it may also 174+ * bring the feds down on you. 175+ * 176+ */ 177+ /* IEEE 802.11b/g, channels -42..26 */ 178+ RANGE_PWR(2192, 2732, 1, 6, 0), 179+ /* IEEE 802.11a, channels -40..240, outdoor */ 180+ RANGE_PWR(4800, 6000, 1, 6, 0), 181+}; 182+ 183+ 184 static const struct ieee80211_channel_range ieee80211_JP_channels[] = { 185 /* IEEE 802.11b/g, channels 1..14 */ 186 RANGE_PWR(2412, 2484, 20, 6, 0), 187@@ -108,6 +124,7 @@ 188 REGDOM(US), 189 REGDOM(JP), 190 REGDOM(EU), 191+ REGDOM(DEBUG), 192 }; 193 194 195