linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] wireless-regdb: allow NO-INDOOR flag in db.txt
@ 2025-02-20  0:31 Ping-Ke Shih
  2025-02-20  0:31 ` [PATCH v4 2/3] wireless-regdb: Update regulatory rules for Iran (IR) on both 2.4 and 5Ghz for 2021 Ping-Ke Shih
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2025-02-20  0:31 UTC (permalink / raw)
  To: wens; +Cc: linux-wireless, wireless-regdb, johannes, mobin

From: Ping-Ke Shih <pkshih@realtek.com>

For certain regulations, frequency range is outdoor only, which flag should
be NO-INDOOR, but db2fw.py doesn't allow this flag.

As suggestion, only fill NO-INDOOR flag in db.txt, but ignore this rule
in parsing to binary.

Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Link: https://lore.kernel.org/linux-wireless/5e433cd8d070682cb6ed31de3a2dd337e6f48b50.camel@sipsolutions.net/T/#t
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
v4:
 - check NO-INDOOR after checking validity of all flags
v3:
 - new introduction by v3
---
 dbparse.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dbparse.py b/dbparse.py
index cc5012bc05bd..29f422445563 100755
--- a/dbparse.py
+++ b/dbparse.py
@@ -121,6 +121,9 @@ class FlagError(Exception):
     def __init__(self, flag):
         self.flag = flag
 
+class IgnoreRule(Exception):
+    pass
+
 @total_ordering
 class Permission(object):
     def __init__(self, freqband, power, flags, wmmrule):
@@ -135,6 +138,9 @@ class Permission(object):
             if not flag in flag_definitions:
                 raise FlagError(flag)
             self.flags |= flag_definitions[flag]
+        # ignore rule with NO-INDOOR so that kernel doesn't need special deal.
+        if 'NO-INDOOR' in flags:
+            raise IgnoreRule()
         self.textflags = flags
 
     def _as_tuple(self):
@@ -429,6 +435,8 @@ class DBParser(object):
             perm = Permission(b, p, flags, w)
         except FlagError as e:
             self._syntax_error("Invalid flag '%s'" % e.flag)
+        except IgnoreRule:
+            return
         for cname, c in self._current_countries.items():
             if perm in c:
                 self._warn('Rule "%s, %s" added to "%s" twice' % (
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-20  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20  0:31 [PATCH v4 1/3] wireless-regdb: allow NO-INDOOR flag in db.txt Ping-Ke Shih
2025-02-20  0:31 ` [PATCH v4 2/3] wireless-regdb: Update regulatory rules for Iran (IR) on both 2.4 and 5Ghz for 2021 Ping-Ke Shih
2025-02-20  0:31 ` [PATCH v4 3/3] wireless-regdb: Update frequency range with NO-INDOOR for Oman (OM) Ping-Ke Shih
2025-02-20  8:37 ` [PATCH v4 1/3] wireless-regdb: allow NO-INDOOR flag in db.txt Chen-Yu Tsai
2025-02-20  8:49 ` Chen-Yu Tsai

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).