diff mbox

wireless-regdb: allow max bandwidth to be AUTO calculated

Message ID 1392059741-2366-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Janusz.Dziedzic@tieto.com Feb. 10, 2014, 7:15 p.m. UTC
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 <janusz.dziedzic@tieto.com>
---
 dbparse.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

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