* [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times @ 2015-04-08 13:18 Seth Forshee 2015-04-13 8:29 ` Jean-Pierre Tosoni 0 siblings, 1 reply; 4+ messages in thread From: Seth Forshee @ 2015-04-08 13:18 UTC (permalink / raw) To: wireless-regdb; +Cc: Jean-Pierre TOSONI CRDA now supports db.txt files with DFS CAC times in country rules, but dbparse.py chokes on such files. We can't do anything useful with CAC times right now since the CRDA binary format doesn't support them, so add code to parse CAC times and emit a warning that they are being ignored. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> --- I'm throwing this out there in case anyone wants to build regulatory.bin files from their own db.txt files which contain CAC times. If so, let me know and I can apply this. Jean-Pierre: This is working fine in my testing. Could you give it a try with your file(s) and let me know how it works? dbparse.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/dbparse.py b/dbparse.py index b735b6a..c740eac 100755 --- a/dbparse.py +++ b/dbparse.py @@ -273,23 +273,42 @@ class DBParser(object): if line[0] == '(': items = line.split('),', 1) + pname = items[0] if len(items) == 1: - pname = items[0] line = '' if not pname[-1] == ')': self._syntax_error("Badly parenthesised power definition") pname = pname[:-1] - flags = [] else: - pname = items[0] - flags = items[1].split(',') + line = items[1] power = pname[1:] pname = 'UNNAMED %d' % self._lineno self._parse_power_def(pname, power, dupwarn=False) else: - line = line.split(',') - pname = line[0] - flags = line[1:] + items = line.split(',', 1) + pname = items[0] + if len(items) == 1: + line = '' + else: + line = items[1] + + if len(line) != 0 and line[0] == '(': + self._warn("Ignoring DFS CAC time definition") + items = line.split(')', 1) + cactime = items[0] + if len(items) == 1: + line = '' + if not cactime[-1] == ')': + self._syntax_error("Badly parenthesised CAC time") + cactime = cactime[:-1] + else: + line = items[1] + cactime = cactime[1:] + + if len(line) == 0: + flags = [] + else: + flags = line.split(',') if not bname in self._bands: self._syntax_error("band does not exist") -- 1.9.1 _______________________________________________ wireless-regdb mailing list wireless-regdb@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wireless-regdb ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times 2015-04-08 13:18 [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times Seth Forshee @ 2015-04-13 8:29 ` Jean-Pierre Tosoni 2015-04-13 13:18 ` Seth Forshee 0 siblings, 1 reply; 4+ messages in thread From: Jean-Pierre Tosoni @ 2015-04-13 8:29 UTC (permalink / raw) To: 'Seth Forshee', wireless-regdb Hi Seth, From my testing the syntax accepted by reglib.c needs a comma after the CAC, so you should skip that comma. Below is your patch with two lines added. De : wireless-regdb [mailto:wireless-regdb-bounces@lists.infradead.org] De la part de Seth Forshee Envoyé : mercredi 8 avril 2015 15:18 À : wireless-regdb@lists.infradead.org Cc : Jean-Pierre TOSONI Objet : [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times CRDA now supports db.txt files with DFS CAC times in country rules, but dbparse.py chokes on such files. We can't do anything useful with CAC times right now since the CRDA binary format doesn't support them, so add code to parse CAC times and emit a warning that they are being ignored. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> --- I'm throwing this out there in case anyone wants to build regulatory.bin files from their own db.txt files which contain CAC times. If so, let me know and I can apply this. --- dbparse.py 2015-03-13 18:17:34.000000000 +0100 +++ dbparsejp.py 2015-04-13 10:22:52.000000000 +0200 @@ -273,23 +273,44 @@ class DBParser(object): if line[0] == '(': items = line.split('),', 1) + pname = items[0] if len(items) == 1: - pname = items[0] line = '' if not pname[-1] == ')': self._syntax_error("Badly parenthesised power definition") pname = pname[:-1] - flags = [] else: - pname = items[0] - flags = items[1].split(',') + line = items[1] power = pname[1:] pname = 'UNNAMED %d' % self._lineno self._parse_power_def(pname, power, dupwarn=False) else: - line = line.split(',') - pname = line[0] - flags = line[1:] + items = line.split(',', 1) + pname = items[0] + if len(items) == 1: + line = '' + else: + line = items[1] + + if len(line) != 0 and line[0] == '(': + self._warn("Ignoring DFS CAC time definition") + items = line.split(')', 1) + cactime = items[0] + if len(items) == 1: + line = '' + if not cactime[-1] == ')': + self._syntax_error("Badly parenthesised CAC time") + cactime = cactime[:-1] + else: + line = items[1] + cactime = cactime[1:] + + if len(line) == 0: + flags = [] + else: + if line[0] == ',': + line = line[1:] + flags = line.split(',') if not bname in self._bands: self._syntax_error("band does not exist") -- _______________________________________________ wireless-regdb mailing list wireless-regdb@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wireless-regdb ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times 2015-04-13 8:29 ` Jean-Pierre Tosoni @ 2015-04-13 13:18 ` Seth Forshee 2015-04-13 20:02 ` Seth Forshee 0 siblings, 1 reply; 4+ messages in thread From: Seth Forshee @ 2015-04-13 13:18 UTC (permalink / raw) To: Jean-Pierre Tosoni; +Cc: wireless-regdb On Mon, Apr 13, 2015 at 10:29:23AM +0200, Jean-Pierre Tosoni wrote: > Hi Seth, > > From my testing the syntax accepted by reglib.c needs a comma after the CAC, > so you should skip that comma. Below is your patch with two lines added. Ah, okay, I based it off of what you said in your email, which shows no comma: (freq - freq @ bw), (eirp [mW]), [(CACtime)] [flags...] I thought it was weird that there was no comma, should have double checked against CRDA. Thanks for testing and the update, I can't try it out right this moment but will do so soon. Seth _______________________________________________ wireless-regdb mailing list wireless-regdb@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wireless-regdb ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times 2015-04-13 13:18 ` Seth Forshee @ 2015-04-13 20:02 ` Seth Forshee 0 siblings, 0 replies; 4+ messages in thread From: Seth Forshee @ 2015-04-13 20:02 UTC (permalink / raw) To: Jean-Pierre Tosoni; +Cc: wireless-regdb On Mon, Apr 13, 2015 at 08:18:46AM -0500, Seth Forshee wrote: > On Mon, Apr 13, 2015 at 10:29:23AM +0200, Jean-Pierre Tosoni wrote: > > Hi Seth, > > > > From my testing the syntax accepted by reglib.c needs a comma after the CAC, > > so you should skip that comma. Below is your patch with two lines added. > > Ah, okay, I based it off of what you said in your email, which shows no > comma: > > (freq - freq @ bw), (eirp [mW]), [(CACtime)] [flags...] > > I thought it was weird that there was no comma, should have double > checked against CRDA. Thanks for testing and the update, I can't try it > out right this moment but will do so soon. I don't think we need to consider the syntax without a comma following CACtime as being valid, so we can make it simpler than in your changes. Try the patch below, and if it works for you then I'll apply it. I'm also thinking about removing the warning ... --- diff --git a/dbparse.py b/dbparse.py index b735b6a..baca3dd 100755 --- a/dbparse.py +++ b/dbparse.py @@ -273,23 +273,42 @@ class DBParser(object): if line[0] == '(': items = line.split('),', 1) + pname = items[0] if len(items) == 1: - pname = items[0] line = '' if not pname[-1] == ')': self._syntax_error("Badly parenthesised power definition") pname = pname[:-1] - flags = [] else: - pname = items[0] - flags = items[1].split(',') + line = items[1] power = pname[1:] pname = 'UNNAMED %d' % self._lineno self._parse_power_def(pname, power, dupwarn=False) else: - line = line.split(',') - pname = line[0] - flags = line[1:] + items = line.split(',', 1) + pname = items[0] + if len(items) == 1: + line = '' + else: + line = items[1] + + if len(line) != 0 and line[0] == '(': + self._warn("Ignoring DFS CAC time definition") + items = line.split('),', 1) + cactime = items[0] + if len(items) == 1: + line = '' + if not cactime[-1] == ')': + self._syntax_error("Badly parenthesised CAC time") + cactime = cactime[:-1] + else: + line = items[1] + cactime = cactime[1:] + + if len(line) == 0: + flags = [] + else: + flags = line.split(',') if not bname in self._bands: self._syntax_error("band does not exist") _______________________________________________ wireless-regdb mailing list wireless-regdb@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wireless-regdb ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-13 20:02 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-08 13:18 [wireless-regdb] [PATCH] wireless-regdb: Support db.txt files with DFS CAC times Seth Forshee 2015-04-13 8:29 ` Jean-Pierre Tosoni 2015-04-13 13:18 ` Seth Forshee 2015-04-13 20:02 ` Seth Forshee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox