-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 183272 b: refs/heads/master c: 3b377ea h: refs/heads/master v: v3
- Loading branch information
John W. Linville
committed
Dec 21, 2009
1 parent
5a43b66
commit 94bcbe6
Showing
9 changed files
with
286 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 59d9cb071d6209f2e8df2d16228cfdc7bab1f2d1 | ||
refs/heads/master: 3b377ea9d4efc94dc52fe41b4dfdb463635ab298 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
regdb.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# This file is a placeholder to prevent accidental build breakage if someone | ||
# enables CONFIG_CFG80211_INTERNAL_REGDB. Almost no one actually needs to | ||
# enable that build option. | ||
# | ||
# You should be using CRDA instead. It is even better if you use the CRDA | ||
# package provided by your distribution, since they will probably keep it | ||
# up-to-date on your behalf. | ||
# | ||
# If you _really_ intend to use CONFIG_CFG80211_INTERNAL_REGDB then you will | ||
# need to replace this file with one containing appropriately formatted | ||
# regulatory rules that cover the regulatory domains you will be using. Your | ||
# best option is to extract the db.txt file from the wireless-regdb git | ||
# repository: | ||
# | ||
# git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#!/usr/bin/awk -f | ||
# | ||
# genregdb.awk -- generate regdb.c from db.txt | ||
# | ||
# Actually, it reads from stdin (presumed to be db.txt) and writes | ||
# to stdout (presumed to be regdb.c), but close enough... | ||
# | ||
# Copyright 2009 John W. Linville <linville@tuxdriver.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 as | ||
# published by the Free Software Foundation. | ||
# | ||
|
||
BEGIN { | ||
active = 0 | ||
rules = 0; | ||
print "/*" | ||
print " * DO NOT EDIT -- file generated from data in db.txt" | ||
print " */" | ||
print "" | ||
print "#include <linux/nl80211.h>" | ||
print "#include <net/cfg80211.h>" | ||
print "" | ||
regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n" | ||
} | ||
|
||
/^[ \t]*#/ { | ||
/* Ignore */ | ||
} | ||
|
||
!active && /^[ \t]*$/ { | ||
/* Ignore */ | ||
} | ||
|
||
!active && /country/ { | ||
country=$2 | ||
sub(/:/, "", country) | ||
printf "static const struct ieee80211_regdomain regdom_%s = {\n", country | ||
printf "\t.alpha2 = \"%s\",\n", country | ||
printf "\t.reg_rules = {\n" | ||
active = 1 | ||
regdb = regdb "\t®dom_" country ",\n" | ||
} | ||
|
||
active && /^[ \t]*\(/ { | ||
start = $1 | ||
sub(/\(/, "", start) | ||
end = $3 | ||
bw = $5 | ||
sub(/\),/, "", bw) | ||
gain = $6 | ||
sub(/\(/, "", gain) | ||
sub(/,/, "", gain) | ||
power = $7 | ||
sub(/\)/, "", power) | ||
sub(/,/, "", power) | ||
# power might be in mW... | ||
units = $8 | ||
sub(/\)/, "", units) | ||
sub(/,/, "", units) | ||
if (units == "mW") { | ||
if (power == 100) { | ||
power = 20 | ||
} else if (power == 200) { | ||
power = 23 | ||
} else if (power == 500) { | ||
power = 27 | ||
} else if (power == 1000) { | ||
power = 30 | ||
} else { | ||
print "Unknown power value in database!" | ||
} | ||
} | ||
flagstr = "" | ||
for (i=8; i<=NF; i++) | ||
flagstr = flagstr $i | ||
split(flagstr, flagarray, ",") | ||
flags = "" | ||
for (arg in flagarray) { | ||
if (flagarray[arg] == "NO-OFDM") { | ||
flags = flags "\n\t\t\tNL80211_RRF_NO_OFDM | " | ||
} else if (flagarray[arg] == "NO-CCK") { | ||
flags = flags "\n\t\t\tNL80211_RRF_NO_CCK | " | ||
} else if (flagarray[arg] == "NO-INDOOR") { | ||
flags = flags "\n\t\t\tNL80211_RRF_NO_INDOOR | " | ||
} else if (flagarray[arg] == "NO-OUTDOOR") { | ||
flags = flags "\n\t\t\tNL80211_RRF_NO_OUTDOOR | " | ||
} else if (flagarray[arg] == "DFS") { | ||
flags = flags "\n\t\t\tNL80211_RRF_DFS | " | ||
} else if (flagarray[arg] == "PTP-ONLY") { | ||
flags = flags "\n\t\t\tNL80211_RRF_PTP_ONLY | " | ||
} else if (flagarray[arg] == "PTMP-ONLY") { | ||
flags = flags "\n\t\t\tNL80211_RRF_PTMP_ONLY | " | ||
} else if (flagarray[arg] == "PASSIVE-SCAN") { | ||
flags = flags "\n\t\t\tNL80211_RRF_PASSIVE_SCAN | " | ||
} else if (flagarray[arg] == "NO-IBSS") { | ||
flags = flags "\n\t\t\tNL80211_RRF_NO_IBSS | " | ||
} | ||
} | ||
flags = flags "0" | ||
printf "\t\tREG_RULE(%d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, flags | ||
rules++ | ||
} | ||
|
||
active && /^[ \t]*$/ { | ||
active = 0 | ||
printf "\t},\n" | ||
printf "\t.n_reg_rules = %d\n", rules | ||
printf "};\n\n" | ||
rules = 0; | ||
} | ||
|
||
END { | ||
print regdb "};" | ||
print "" | ||
print "int reg_regdb_size = ARRAY_SIZE(reg_regdb);" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef __REGDB_H__ | ||
#define __REGDB_H__ | ||
|
||
extern const struct ieee80211_regdomain *reg_regdb[]; | ||
extern int reg_regdb_size; | ||
|
||
#endif /* __REGDB_H__ */ |