Commit fa96aabb authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Johannes Berg

wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd

Since "wireless-regdb: remove antenna gain" was merged in the
wireless-regdb tree, the awk script parser has been incompatible
with the 'official' regulatory database.  This fixes that up.
Without this change the max EIRP is set to 0 making 802.11 devices
useless.

The fragile nature of the awk parser must be replaced, but ideas
over how to do that in the most scalable way are being reviewed.
In the meantime update the documentation for CFG80211_INTERNAL_REGDB
so folks are aware of expectations for now.
Reported-by: default avatarJohn Walker <john@x109.net>
Reported-by: default avatarKrishna Chaitanya <chaitanya.mgit@gmail.com>
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 3e2a0226
...@@ -162,6 +162,12 @@ config CFG80211_INTERNAL_REGDB ...@@ -162,6 +162,12 @@ config CFG80211_INTERNAL_REGDB
and includes code to query that database. This is an alternative and includes code to query that database. This is an alternative
to using CRDA for defining regulatory rules for the kernel. to using CRDA for defining regulatory rules for the kernel.
Using this option requires some parsing of the db.txt at build time,
the parser will be upkept with the latest wireless-regdb updates but
older wireless-regdb formats will be ignored. The parser may later
be replaced to avoid issues with conflicts on versions of
wireless-regdb.
For details see: For details see:
http://wireless.kernel.org/en/developers/Regulatory http://wireless.kernel.org/en/developers/Regulatory
......
...@@ -51,32 +51,41 @@ function parse_country_head() { ...@@ -51,32 +51,41 @@ function parse_country_head() {
function parse_reg_rule() function parse_reg_rule()
{ {
flag_starts_at = 7
start = $1 start = $1
sub(/\(/, "", start) sub(/\(/, "", start)
end = $3 end = $3
bw = $5 bw = $5
sub(/\),/, "", bw) sub(/\),/, "", bw)
gain = $6 gain = 0
sub(/\(/, "", gain) power = $6
sub(/,/, "", gain)
power = $7
sub(/\)/, "", power)
sub(/,/, "", power)
# power might be in mW... # power might be in mW...
units = $8 units = $7
dfs_cac = 0
sub(/\(/, "", power)
sub(/\),/, "", power)
sub(/\),/, "", units)
sub(/\)/, "", units) sub(/\)/, "", units)
sub(/,/, "", units)
dfs_cac = $9
if (units == "mW") { if (units == "mW") {
flag_starts_at = 8
power = 10 * log(power)/log(10) power = 10 * log(power)/log(10)
if ($8 ~ /[[:digit:]]/) {
flag_starts_at = 9
dfs_cac = $8
}
} else { } else {
dfs_cac = $8 if ($7 ~ /[[:digit:]]/) {
flag_starts_at = 8
dfs_cac = $7
}
} }
sub(/,/, "", dfs_cac)
sub(/\(/, "", dfs_cac) sub(/\(/, "", dfs_cac)
sub(/\)/, "", dfs_cac) sub(/\),/, "", dfs_cac)
flagstr = "" flagstr = ""
for (i=8; i<=NF; i++) for (i=flag_starts_at; i<=NF; i++)
flagstr = flagstr $i flagstr = flagstr $i
split(flagstr, flagarray, ",") split(flagstr, flagarray, ",")
flags = "" flags = ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment