2014-02-10 19:16:00

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH] wireless-regdb: allow max bandwidth to be AUTO calculated

Allow max bandwidth to be AUTO calculated, base
on contiguous rules. This AUTO ( bw = 0) parameter will be
send to the kernel mode (cfg80211/nl80211) and next maximum
allowed bandwidth will be calculated base on contiguous rules.

Eg.

country PL: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ AUTO), (N/A, 20)
(5250 - 5330 @ AUTO), (N/A, 20), DFS
(5490 - 5710 @ 80), (N/A, 27), DFS

This mean we will calculate maximum bw for rules where
AUTO were set, 160MHz (5330 - 5170) in example above.
So we will get:
(5170 - 5250 @ 160), (N/A, 20)
(5250 - 5330 @ 160), (N/A, 20), DFS

In other case:
country FR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20)
(5170 - 5250 @ AUTO), (N/A, 20)
(5250 - 5330 @ 80), (N/A, 20), DFS
(5490 - 5710 @ 80), (N/A, 27), DFS

We will get 80MHz (5250 - 5170):
(5170 - 5250 @ 80), (N/A, 20)
(5250 - 5330 @ 80), (N/A, 20), DFS

Signed-off-by: Janusz Dziedzic <[email protected]>
---
dbparse.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dbparse.py b/dbparse.py
index ac7234b..7c7bc19 100755
--- a/dbparse.py
+++ b/dbparse.py
@@ -144,7 +144,10 @@ class DBParser(object):
def _parse_band_def(self, bname, banddef, dupwarn=True):
try:
freqs, bw = banddef.split('@')
- bw = float(bw)
+ if bw == "AUTO":
+ bw = 0.0
+ else:
+ bw = float(bw)
except ValueError:
bw = 20.0

--
1.7.9.5