Debian Codegraph @

patches/old/ath5k-frequency-chaos_2.6.26.2.patch

raw
1 This patch allows for highly extended frequency settings for Atheros wifi cards.
2 I have tested and confirmed the frequencies as best as I can. Monitoring should be
3 safe, but transmitting will most likely lead to the fcc paying you a vist. I have
4 done all I can to stop you from accidently getting in trouble, the rest is up to
5 you. -ZC
6
7 -----------------------------------------------------------------------------------
8
9 diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/ath5k.h linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/ath5k.h
10 --- linux-2.6.26.2/drivers/net/wireless/ath5k/ath5k.h 2008-08-13 03:16:40.000000000 -0400
11 +++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/ath5k.h 2008-08-13 03:16:47.000000000 -0400
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>
21 diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/base.c linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.c
22 --- linux-2.6.26.2/drivers/net/wireless/ath5k/base.c 2008-08-13 03:16:40.000000000 -0400
23 +++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.c 2008-08-13 03:16:47.000000000 -0400
24 @@ -226,7 +226,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 @@ -830,12 +830,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 @@ -865,7 +868,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 @@ -873,14 +877,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 @@ -888,9 +895,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))
96 diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/base.h linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.h
97 --- linux-2.6.26.2/drivers/net/wireless/ath5k/base.h 2008-08-13 03:16:40.000000000 -0400
98 +++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.h 2008-08-13 03:16:47.000000000 -0400
99 @@ -50,7 +50,7 @@
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_TXBUF 0 /* number of TX buffers */
105 #define ATH_BCBUF 1 /* number of beacon buffers */
106
107 struct ath5k_buf {
108 diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/hw.c linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/hw.c
109 --- linux-2.6.26.2/drivers/net/wireless/ath5k/hw.c 2008-08-13 03:16:40.000000000 -0400
110 +++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/hw.c 2008-08-13 03:16:47.000000000 -0400
111 @@ -2258,8 +2258,9 @@
112 */
113
114 if (AR5K_EEPROM_HDR_11A(ee_header)) {
115 - ah->ah_capabilities.cap_range.range_5ghz_min = 5005; /* 4920 */
116 - ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
117 + ah->ah_capabilities.cap_range.range_5ghz_min = 4800; /* 4920 */
118 + ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what atheros said but */
119 + /* it fried one of my cards */
120
121 /* Set supported modes */
122 __set_bit(AR5K_MODE_11A,
123 @@ -2275,8 +2276,8 @@
124 * connected */
125 if (AR5K_EEPROM_HDR_11B(ee_header) ||
126 AR5K_EEPROM_HDR_11G(ee_header)) {
127 - ah->ah_capabilities.cap_range.range_2ghz_min = 2412; /* 2312 */
128 - ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
129 + ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* 2312 */
130 + ah->ah_capabilities.cap_range.range_2ghz_max = 2737; /* 2732 */
131
132 if (AR5K_EEPROM_HDR_11B(ee_header))
133 __set_bit(AR5K_MODE_11B,
134 diff -Naur linux-2.6.26.2/net/wireless/reg.c linux-2.6.26.2-ath5k-freq-chaos/net/wireless/reg.c
135 --- linux-2.6.26.2/net/wireless/reg.c 2008-08-13 03:16:40.000000000 -0400
136 +++ linux-2.6.26.2-ath5k-freq-chaos/net/wireless/reg.c 2008-08-13 03:16:47.000000000 -0400
137 @@ -70,6 +70,22 @@
138 RANGE_PWR(5745, 5825, 30, 6, 0),
139 };
140
141 +static const struct ieee80211_channel_range ieee80211_DEBUG_channels[] = {
142 +/*
143 + * WARNING: These values are strictly based on my own limited testing.
144 + * This does not seem to damage MY cards in the limited time I was testing.
145 + * Monitor mode tuning of these channels *should* be 100% safe, however,
146 + * ANY transmissions may not only permanently damage your card, it may also
147 + * bring the feds down on you.
148 + *
149 + */
150 + /* IEEE 802.11b/g, channels -42..26 */
151 + RANGE_PWR(2192, 2732, 1, 6, 0),
152 + /* IEEE 802.11a, channels -40..240, outdoor */
153 + RANGE_PWR(4800, 6000, 1, 6, 0),
154 +};
155 +
156 +
157 static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
158 /* IEEE 802.11b/g, channels 1..14 */
159 RANGE_PWR(2412, 2484, 20, 6, 0),
160 @@ -108,6 +124,7 @@
161 REGDOM(US),
162 REGDOM(JP),
163 REGDOM(EU),
164 + REGDOM(DEBUG),
165 };
166
167