crda: use strerror() to report error code verbosely
PATCH 1/1 crda: use strerror() to report error code verbosely
--- crda.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
crda.c +4 -2
@@ -6,6 +6,7 @@#include <errno.h> #include <stdio.h> +#include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h>
@@ -297,7 +298,8 @@ int main(int argc, char **argv) r =nl_send_auto_complete (nlstate.nl_handle, msg);if (r <0 ) { -fprintf (stderr,"Failed to send regulatory request: %d\n" , r); +fprintf (stderr,"Failed to send regulatory request: %s\n" , +strerror (-r)); goto cb_out; }
@@ -309,7 +311,7 @@ int main(int argc, char **argv) r =nl_wait_for_ack (nlstate.nl_handle);if (r <0 ) {fprintf (stderr,"Failed to set regulatory domain: " -"%d\n" , r); +"%s\n" ,strerror (-r)); goto cb_out; } }
ath5k: whether "txpower off" is supported ?
Hi
I found that iwconfig txpower off can not work on ath5k driver.
Ath5k driver(drivers/net/wireless/ath5k/base.c: ath5k_config() ) does not implement the txpower features. Some one can confirm me whether txpower off feature has been implemented? If not, why? It is because of the HW limitation? Thanks! BTW:
Where can I found the ath5k HW spec? Thanks!
Re: ath5k: whether "txpower off" is supported ?
Quoted 4 lines · Martin
Hi
I found that iwconfig txpower off can not work on ath5k driver.
Ath5kdriver(drivers/net/wireless/ath5k/base.c: ath5k_config() )does not implement the txpower features. Some one can confirm me whether txpower off feature has been implemented? If not, why? It is because of the HW limitation? Thanks!
If its not in yet its because no one yet has bothered with it.
Quoted 2 lines
BTW:
Where can I found the ath5k HW spec? Thanks!
Your source of documentation is the legacy-hal and Sam Leffler's HAL. Have you looked at those?
wget http://www.kernel.org/pub/linux/kernel/people/mcgrof/legacy-hal.tar.bz2
svn co http://svn.freebsd.org/base/projects/ath_hal
Luis
Quoted 28 lines · Pavel Roskin
Signed-off-by Pavel Roskin <[email protected]>--- crda.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)crda.c +3
-1@@ -6,6 +6,7 @@#include <errno.h> #include <stdio.h> +#include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> @@ -297,7 +298,8 @@ int main(int argc, char **argv) r =nl_send_auto_complete (nlstate.nl_handle, msg);if (r <0 ) { -fprintf (stderr,"Failed to send regulatory request: %d\n" , r); +fprintf (stderr,"Failed to send regulatory request: %s\n" , +strerror (-r)); goto cb_out; }
crda.c int main(int argc, char **argv) · line 317
Quoted 8 lines
crda.c +1
-1@@ -309,7 +311,7 @@ int main(int argc, char **argv) r =nl_wait_for_ack (nlstate.nl_handle);if (r <0 ) {fprintf (stderr,"Failed to set regulatory domain: " -"%d\n" , r); +"%s\n" ,strerror (-r)); goto cb_out; } }
I've been trying to avoid string.h on crda.c, granted it only increases the final crda binary by about 30 bytes, but do we really need it? In fact it'd be nice to further trim crda further to save even more space. Thoughts?
Luis
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 4 lines
I've been trying to avoid
string.honcrda.c, granted it only increases the final crda binary by about 30 bytes, but do we really need it? In fact it'd be nice to further trim crda further to save even more space. Thoughts?
OK, maybe we don't need this patch if CDRA works correctly. I'm having bad luck with it.
First of all, I cannot generate regulatory.bin that crda would accept.
[proski@dv wireless-regdb]$ make
./db2bin.py regulatory.bin db.txt key.priv.pem
openssl rsa -in key.priv.pem -out key.pub.pem -pubout -outform PEM writing RSA key
[proski@dv crda]$ make
GEN keys-gcrypt.c CC reglib.o CC crda.o LD crda CC intersect.o CC print-regdom.o LD intersect CC regdbdump.o LD regdbdump CHK /home/proski/src/wireless-regdb/regulatory.bin
Database signature verification failed.
make: *** [verify] Error 234
wireless-regdb and crda are current from git. The system is Fedora 10, x86_64 with a custom kernel.
Only regulatory.bin from wireless-regdb-master is OK. It is indeed different.
[proski@dv wireless-regdb]$ cmp -b regulatory.bin /usr/lib/crda/regulatory.bin regulatory.bin /usr/lib/crda/regulatory.bin differ: byte 2685, line 3 is 36 ^^ 130 X
Once I install the working regulatory.bin, I can compile crda. It appears that crda needs COUNTRY in the environment, but it's not documented anywhere and there is no sample file whre to set it. I tried adding "export COUNTRY=US" to /etc/sysconfig/i18n, and it appears in the environment when logged in on the console. However, crda doesn't apprear to see it:
[ 0.720023] cfg80211: Calling CRDA to update world regulatory domain [ 0.720065] cfg80211: calling CRDA failed - unable to update world regulatory domain, using static definition
Not only did it try to set the world domain, it failed at that. However, running crda on the command line is successful:
COUNTRY=00 crda
From the kernel log:
[ 3579.145902] cfg80211: World regulatory domain updated: [ 3579.145905] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) [ 3579.145907] (2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
But setting any specific country fails:
[root@ct crda]# COUNTRY=US crda
Failed to set regulatory domain: -22
[root@ct crda]# COUNTRY=DE crda
Failed to set regulatory domain: -22
[root@ct crda]# COUNTRY=RU crda
Failed to set regulatory domain: -22
[root@ct crda]# COUNTRY=QW crda
No country match in regulatory database.
[root@ct crda]#
-22 is -EINVAL, "invalid argument".
At this point I want that crda at least gives me errors in a readable form. But maybe I want too little :-)
The kernel is current from wireless-testing.git. CONFIG_WIRELESS_OLD_REGULATORY is disabled. CONFIG_CFG80211_REG_DEBUG is disabled (I guess I'll try enabling it now). CONFIG_CFG80211 is enabled. mac80211 is compiled into the kernel. The only modules are wireless drivers (b43, hostap, rt61).
Signature · 2 lines
Regards, Pavel Roskin
Quoted 10 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 4 lines
I've been trying to avoid
string.honcrda.c, granted it only increases the final crda binary by about 30 bytes, but do we really need it? In fact it'd be nice to further trim crda further to save even more space. Thoughts?OK, maybe we don't need this patch if CDRA works correctly. I'm having bad luck with it.
Quoted 6 lines
First of all, I cannot generate regulatory.bin that crda would accept.
[proski@dv wireless-regdb]$ make
./db2bin.py regulatory.bin db.txt key.priv.pem
openssl rsa -in key.priv.pem -out key.pub.pem -pubout -outform PEM writing RSA key
You don't need to build this unless you want to define your own rules.
Quoted 11 lines
[proski@dv crda]$ make
GEN keys-gcrypt.c CC reglib.o CC crda.o LD crda CC intersect.o CC print-regdom.o LD intersect CC regdbdump.o LD regdbdump CHK /home/proski/src/wireless-regdb/regulatory.bin
Quoted 2 lines
Database signature verification failed.
make: *** [verify] Error 234
And if you do and want to use the signature stuff you need to copy the RSA public key into pubkeys/ directory of CRDA. Did you try that?
Luis
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 1 line
You don't need to build this unless you want to define your own rules.
I see.
Quoted 2 lines
And if you do and want to use the signature stuff you need to copy the RSA public key into pubkeys/ directory of CRDA. Did you try that?
No, I just wanted to install the most current regulatory database. Perhaps the error message should be more clear.
With both CONFIG_CFG80211_REG_DEBUG, CONFIG_WIRELESS_OLD_REGULATORY enabled and modular mac80211 and cfg80211, regdomain is set correctly from udev:
[ 7.642548] cfg80211: Using static regulatory domain info [ 7.642551] cfg80211: Regulatory domain: US [ 8.697261] cfg80211: Regulatory domain changed to country: US
However, changing it to anything doesn't work:
[root@ct proski]# COUNTRY=00 crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=US crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=DE crda Failed to set regulatory domain: -22 [root@ct proski]#
Maybe it can only be set once? But then -EBUSY would be more reasonable.
Signature · 2 lines
Regards, Pavel Roskin
Quoted 30 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 1 line
You don't need to build this unless you want to define your own rules.
I see.
Quoted 2 lines
And if you do and want to use the signature stuff you need to copy the RSA public key into pubkeys/ directory of CRDA. Did you try that?
No, I just wanted to install the most current regulatory database. Perhaps the error message should be more clear.
With both
CONFIG_CFG80211_REG_DEBUG,CONFIG_WIRELESS_OLD_REGULATORYenabled and modular mac80211 and cfg80211, regdomain is set correctly from udev:[ 7.642548] cfg80211: Using static regulatory domain info [ 7.642551] cfg80211: Regulatory domain: US [ 8.697261] cfg80211: Regulatory domain changed to country: USHowever, changing it to anything doesn't work:
[root@ct proski]# COUNTRY=00 crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=US crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=DE crda
Failed to set regulatory domain: -22
[root@ct proski]#
Quoted 1 line
Maybe it can only be set once? But then
-EBUSYwould be more reasonable.
rm -rf on your wireless-regdb git tree and then git checkout -f. Then cp that regulatory.bin to the REG_BIN location and try to build that CRDA. Then try that CRDA.
Luis
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 2 lines
rm -rf on your wireless-regdb git tree and then git checkout -f. Then cp that regulatory.bin to the
REG_BINlocation and try to build that CRDA. Then try that CRDA.
I remember I tried "make" in wireless-regdb without having M2Crypto installed. Then I installed M2Crypto and ran "make clean" followed by "make". "make clean" removed the original regulatory.bin.
The "clean" target doesn't normally remove files under version control. It only removes files that everybody can generate. For files that are harder to create, there is "make distclean" and "make maintainer-clean".
Signature · 2 lines
Regards, Pavel Roskin
Quoted 6 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 3 lines
rm -rf on your wireless-regdb git tree and then git checkout -f. Then cp that regulatory.bin
to theREG_BINlocation and try to build that CRDA. Then try that CRDA.
Quoted 7 lines
I remember I tried "make" in wireless-regdb without having M2Crypto installed. Then I installed M2Crypto and ran "make clean" followed by "make". "make clean" removed the original regulatory.bin.
The "clean" target doesn't normally remove files under version control. It only removes files that everybody can generate. For files that are harder to create, there is "make distclean" and "make maintainer-clean".
Good catch. I think it would be a lot simpler if we just referred people to the latest dated regulatory.bin:
http://wireless.kernel.org/download/wireless-regdb/
Maybe have a symlink and have CRDA wget it or something? Thoughts?
Luis
Quoted 15 lines · Luis R. Rodriguez
Quoted 6 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 3 lines
rm -rf on your wireless-regdb git tree and then git checkout -f. Then cp that regulatory.bin
to theREG_BINlocation and try to build that CRDA. Then try that CRDA.Quoted 7 lines
I remember I tried "make" in wireless-regdb without having M2Crypto installed. Then I installed M2Crypto and ran "make clean" followed by "make". "make clean" removed the original regulatory.bin.
The "clean" target doesn't normally remove files under version control. It only removes files that everybody can generate. For files that are harder to create, there is "make distclean" and "make maintainer-clean".
Quoted 6 lines
Good catch. I think it would be a lot simpler if we just referred people to the latest dated regulatory.bin:
http://wireless.kernel.org/download/wireless-regdb/
Maybe have a symlink and have CRDA wget it or something? Thoughts?
Oh and while at we can remove the "master" from the filename, its just there because its part of the tag as its from the master branch. Thoughts?
Luis
Quoted 29 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 1 line
You don't need to build this unless you want to define your own rules.
I see.
Quoted 2 lines
And if you do and want to use the signature stuff you need to copy the RSA public key into pubkeys/ directory of CRDA. Did you try that?
No, I just wanted to install the most current regulatory database. Perhaps the error message should be more clear.
With both
CONFIG_CFG80211_REG_DEBUG,CONFIG_WIRELESS_OLD_REGULATORYenabled and modular mac80211 and cfg80211, regdomain is set correctly from udev:[ 7.642548] cfg80211: Using static regulatory domain info [ 7.642551] cfg80211: Regulatory domain: US [ 8.697261] cfg80211: Regulatory domain changed to country: USHowever, changing it to anything doesn't work:
[root@ct proski]# COUNTRY=00 crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=US crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=DE crda
Failed to set regulatory domain: -22
[root@ct proski]#
Quoted 2 lines
Maybe it can only be set once? But then
-EBUSYwould be more reasonable.
AFAIK, you have to use iw reg set <country> to manually change it.
Regards,
Davide Pesavento
Quoted 8 lines
--
Regards,
Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Davide Pesavento
Quoted 29 lines · Pavel Roskin
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 1 line
You don't need to build this unless you want to define your own rules.
I see.
Quoted 2 lines
And if you do and want to use the signature stuff you need to copy the RSA public key into pubkeys/ directory of CRDA. Did you try that?
No, I just wanted to install the most current regulatory database. Perhaps the error message should be more clear.
With both
CONFIG_CFG80211_REG_DEBUG,CONFIG_WIRELESS_OLD_REGULATORYenabled and modular mac80211 and cfg80211, regdomain is set correctly from udev:[ 7.642548] cfg80211: Using static regulatory domain info [ 7.642551] cfg80211: Regulatory domain: US [ 8.697261] cfg80211: Regulatory domain changed to country: USHowever, changing it to anything doesn't work:
[root@ct proski]# COUNTRY=00 crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=US crda
Failed to set regulatory domain: -22
[root@ct proski]# COUNTRY=DE crda
Failed to set regulatory domain: -22
[root@ct proski]#
Quoted 4 lines
Quoted 2 lines
Maybe it can only be set once? But then
-EBUSYwould be more reasonable.AFAIK, you have to use
iw reg set <country>to manually change it.
Affirmative, or you can use wpa_supplicant from the git tree and add to your conf:
COUNTRY=US
Luis
Quoting Davide Pesavento <[email protected]>:
Quoted 8 lines
Quoted 8 lines
[root@ct proski]# COUNTRY=00 crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=US crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=DE crda Failed to set regulatory domain: -22 [root@ct proski]#
Quoted 4 lines
Quoted 2 lines
Maybe it can only be set once? But then
-EBUSYwould be more reasonable.AFAIK, you have to use
iw reg set <country>to manually change it.
That works. As I understand now, crda should never be run manually. It should only run by the kernel through udev. If that is correct, it should be written clearly in the crda README.
Signature · 2 lines
Regards, Pavel Roskin
Quoted 10 lines · Pavel Roskin
Quoting Davide Pesavento <[email protected]>:
Quoted 8 lines
Quoted 8 lines
[root@ct proski]# COUNTRY=00 crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=US crda Failed to set regulatory domain: -22 [root@ct proski]# COUNTRY=DE crda Failed to set regulatory domain: -22 [root@ct proski]#
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Maybe it can only be set once? But then
-EBUSYwould be more reasonable.AFAIK, you have to use
iw reg set <country>to manually change it.That works. As I understand now, crda should never be run manually.
That is correct.
Quoted 3 lines
It
should only run by the kernel through udev. If that is correct, it should be written clearly in the crda README.
Apologies if it is not clear. How's this:
---
CALLING CRDA -- UDEV
======================
Distributions can set up a udev rule to allow the kernel's regulatory domain change request to be reviewed by CRDA so CRDA can pass an appropriate regulatory domain. An example regulatory rule is provided with this package as regulatory.rules
---
Or the giant diagram here:
http://wireless.kernel.org/en/developers/Regulatory
This also mentions:
---
CRDA
CRDA is our userspace agent which uploads regulatory domains into the kernel, it acts as a udev helper.
---
Then the CRDA section on the CRDA page has a section:
http://wireless.kernel.org/en/developers/Regulatory/CRDA#LettingthekernelcallCRDA
We also have iw's documentation:
http://wireless.kernel.org/en/users/Documentation/iw#Updatingyourregulatorydomain
The wiki is editable by everyone so feel free to update that, and also feel free to send patches to the README as you see fit.
Luis
Quoting "Luis R. Rodriguez" <[email protected]>:
Quoted 11 lines
Quoted 3 lines
It
should only run by the kernel through udev. If that is correct, it should be written clearly in the crda README.Apologies if it is not clear. How's this:
---
CALLING CRDA -- UDEV
======================Distributions
... I'm not a distribution. Skipping to the next paragraph. :-)
Quoted 3 lines
Or the giant diagram here:
Thanks.
Quoted 2 lines
The wiki is editable by everyone so feel free to update that, and also feel free to send patches to the README as you see fit.
Will do. Sorry for the noise.
Signature · 2 lines
Regards, Pavel Roskin