linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, mcgrof@do-not-panic.com,
	linville@tuxdriver.com,
	Janusz Dziedzic <janusz.dziedzic@tieto.com>
Subject: [PATCH] wireless-regdb: add DFS CAC time parameter
Date: Wed, 12 Feb 2014 19:54:24 +0100	[thread overview]
Message-ID: <1392231266-28479-5-git-send-email-janusz.dziedzic@tieto.com> (raw)
In-Reply-To: <1392231266-28479-1-git-send-email-janusz.dziedzic@tieto.com>

Introduce support for setting DFS CAC time
in milliseconds.

Eg.
(5250 - 5330 @ AUTO), (20), (60000), DFS

will setup CAC 60 seconds CAC time.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 db2bin.py  |    6 +++---
 dbparse.py |   17 +++++++++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/db2bin.py b/db2bin.py
index 41d3741..f6c3bc1 100755
--- a/db2bin.py
+++ b/db2bin.py
@@ -7,7 +7,7 @@ from dbparse import DBParser
 import sys
 
 MAGIC = 0x52474442
-VERSION = 19
+VERSION = 20
 
 if len(sys.argv) < 3:
     print 'Usage: %s output-file input-file [key-file]' % sys.argv[0]
@@ -93,8 +93,8 @@ for reg_rule in rules:
     freq_range, power_rule = reg_rule.freqband, reg_rule.power
     reg_rules[reg_rule] = output.tell()
     # struct regdb_file_reg_rule
-    output.write(struct.pack('>III', freq_ranges[freq_range], power_rules[power_rule],
-                             reg_rule.flags))
+    output.write(struct.pack('>IIII', freq_ranges[freq_range], power_rules[power_rule],
+                             reg_rule.flags, reg_rule.cac_time))
 
 
 reg_rules_collections = {}
diff --git a/dbparse.py b/dbparse.py
index 7c7bc19..f79de2a 100755
--- a/dbparse.py
+++ b/dbparse.py
@@ -76,12 +76,13 @@ class FlagError(Exception):
         self.flag = flag
 
 class Permission(object):
-    def __init__(self, freqband, power, flags):
+    def __init__(self, freqband, power, flags, cac_time):
         assert isinstance(freqband, FreqBand)
         assert isinstance(power, PowerRestriction)
         self.freqband = freqband
         self.power = power
         self.flags = 0
+        self.cac_time = cac_time
         for flag in flags:
             if not flag in flag_definitions:
                 raise FlagError(flag)
@@ -89,7 +90,7 @@ class Permission(object):
         self.textflags = flags
 
     def _as_tuple(self):
-        return (self.freqband, self.power, self.flags)
+        return (self.freqband, self.power, self.flags, self.cac_time)
 
     def __cmp__(self, other):
         if not isinstance(other, Permission):
@@ -256,6 +257,7 @@ class DBParser(object):
         self._comments = []
 
     def _parse_country_item(self, line):
+        cac_time = 0
         if line[0] == '(':
             try:
                 band, line = line[1:].split('),', 1)
@@ -284,7 +286,14 @@ class DBParser(object):
                 flags = []
             else:
                 pname = items[0]
-                flags = items[1].split(',')
+                pcac = items[1]
+                if pcac[0] == '(':
+                    cac, flags = pcac.split('),', 1)
+                    flags = flags.split(',')
+                    cac_time = int(cac[1:])
+                else:
+                    flags = items[1].split(',')
+
             power = pname[1:]
             pname = 'UNNAMED %d' % self._lineno
             self._parse_power_def(pname, power, dupwarn=False)
@@ -305,7 +314,7 @@ class DBParser(object):
         b = self._bands[bname]
         p = self._power[pname]
         try:
-            perm = Permission(b, p, flags)
+            perm = Permission(b, p, flags, cac_time)
         except FlagError, e:
             self._syntax_error("Invalid flag '%s'" % e.flag)
         for cname, c in self._current_countries.iteritems():
-- 
1.7.9.5


  parent reply	other threads:[~2014-02-12 18:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 18:54 [PATCH 1/4] cfg80211: regulatory, introduce DFS CAC time Janusz Dziedzic
2014-02-12 18:54 ` [PATCH 2/4] cfg80211: parse DFS CAC time for internal regdb option Janusz Dziedzic
2014-02-12 18:54 ` [PATCH 3/4] cfg80211/mac80211: DFS pass CAC time as a parameter Janusz Dziedzic
2014-02-21  8:53   ` Johannes Berg
2014-02-12 18:54 ` [PATCH 4/4] cfg80211: DFS get CAC time from regulatory Janusz Dziedzic
2014-02-21  8:54   ` Johannes Berg
2014-02-12 18:54 ` Janusz Dziedzic [this message]
2014-02-12 18:54 ` [PATCH] crda: add DFS CAC time support Janusz Dziedzic
2014-02-12 18:54 ` [PATCH] iw: handle DFS CAC time param Janusz Dziedzic
2014-02-19  0:31 ` [PATCH 1/4] cfg80211: regulatory, introduce DFS CAC time Luis R. Rodriguez
2014-02-19 11:03 ` Johannes Berg
2014-02-19 11:27   ` Janusz Dziedzic
2014-02-19 11:28     ` Johannes Berg
2014-02-19 22:11       ` Luis R. Rodriguez
2014-02-20  7:12         ` Janusz Dziedzic
2014-02-22  0:31           ` Luis R. Rodriguez
2014-02-21  8:52 ` Johannes Berg
2014-02-21  9:47   ` Janusz Dziedzic
2014-02-21  9:55     ` Johannes Berg
2014-02-21 10:09       ` Janusz Dziedzic
2014-02-21 10:11         ` Johannes Berg
2014-05-09  8:40 [PATCH] wireless-regdb: add DFS CAC time parameter Janusz Dziedzic
2014-05-20  7:33 ` Luis R. Rodriguez
2014-05-20 13:26   ` Janusz Dziedzic
2014-05-20 14:24   ` John W. Linville
2014-05-20 18:01     ` Janusz Dziedzic
2014-05-20 18:08       ` John W. Linville
2014-05-20 18:24         ` Johannes Berg
2014-05-20 18:48           ` Luis R. Rodriguez
2014-05-21 16:03             ` Johannes Berg
2014-05-21 18:00               ` John W. Linville
2014-05-21 19:09                 ` Johannes Berg
2014-06-09  7:33                   ` Janusz Dziedzic
2014-06-10 16:45                     ` Johannes Berg
2014-06-09  8:00               ` Felix Fietkau
2014-06-09 10:22                 ` Janusz Dziedzic
2014-06-09 12:27                   ` Janusz Dziedzic
2014-06-10 16:46                 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392231266-28479-5-git-send-email-janusz.dziedzic@tieto.com \
    --to=janusz.dziedzic@tieto.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mcgrof@do-not-panic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).