iw: display noise level from survey data
PATCH 1/1 iw: display noise level from survey data
Sample output:
# iw dev wlan0 survey dump
Survey data from wlan0
frequency: 2412 MHz
noise: -92 dBmSigned-off-by Holger Schurig <[email protected]>
Makefile +1 -1
@@ -15,7 +15,7 @@ CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration OBJS = iw.o genl.o event.o info.o phy.o \ - interface.o ibss.o station.o util.o \ + interface.o ibss.o station.o survey.o util.o \ mesh.o mpath.o scan.o reg.o version.o \ reason.o status.o connect.o link.o OBJS += sections.o
survey.c new file +66 -0
66 lines not on this page · raw message
nl80211.h +34 -0
@@ -160,6 +160,11 @@* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * partial scan results may be available * +* @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation +* or noise level +* @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to +* NL80211_CMD_GET_SURVEY and on the "scan" multicast group) +* * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain * has been changed and provides details of the request information * that caused the change such as who initiated the regulatory request
@@ -341,6 +346,9 @@NL80211_CMD_SET_WIPHY_NETNS , +NL80211_CMD_GET_SURVEY , + NL80211_CMD_NEW_SURVEY_RESULTS, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -584,6 +592,10 @@* changed then the list changed and the dump should be repeated * completely from scratch. * +* @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of +* the survey response for %NL80211_CMD_GET_SURVEY, nested attribute +* containing info as possible, see &enum survey_info. +* * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */
@@ -714,6 +726,8 @@NL80211_ATTR_PID , +NL80211_ATTR_SURVEY_INFO , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -1117,6 +1131,26 @@ };/** +* enum nl80211_survey_info - survey information +* +* These attribute types are used with %NL80211_ATTR_SURVEY_INFO +* when getting information about a survey. +* +* @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved +* @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel +* @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) +*/ +enum nl80211_survey_info { + __NL80211_SURVEY_INFO_INVALID, +NL80211_SURVEY_INFO_FREQUENCY , +NL80211_SURVEY_INFO_NOISE , + +/* keep last */ + __NL80211_SURVEY_INFO_AFTER_LAST, +NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST -1 +}; + +/** * enum nl80211_mntr_flags - monitor configuration flags * * Monitor configuration flags.
Signature · 1 line
http://www.holgerschurig.de
This no longer works against wireless-testing, because some NL80211_ATTR_SURVEY_INFO has changed the number from 53 to 54 (in wireless-testing). So before/after appyling, nl80211.h should be harmonized between iw and wireless-testing.
Signature · 1 line
http://www.holgerschurig.de
Quoted 4 lines · Holger Schurig
This no longer works against wireless-testing, because some
NL80211_ATTR_SURVEY_INFOhas changed the number from 53 to 54 (in wireless-testing). So before/after appyling,nl80211.hshould be harmonized between iw and wireless-testing.
I tend to copy it over before applying new patches, so feel free to send patches w/o nl80211.h changes included (but I can deal with this too).
johannes