-
Notifications
You must be signed in to change notification settings - Fork 14
survey: implement Nl80211SurveyInfo #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/handle.rs
Outdated
@@ -41,6 +42,12 @@ impl Nl80211Handle { | |||
Nl80211ScanHandle::new(self.clone()) | |||
} | |||
|
|||
// equivalent to `iw DEVICE survey dump` command | |||
#[must_use] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems no fit for a crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
src/survey/handle.rs
Outdated
pub struct Nl80211SurveyHandle(Nl80211Handle); | ||
|
||
impl Nl80211SurveyHandle { | ||
#[must_use] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not ideal for crate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
fae8d2e
to
5700ad9
Compare
Could you provide a script for me to try it out? |
Of course. As I've said, I'm using the Intel AX210 wifi card to obtain noise levels, but I'm sure there are other cards, which provide some detail in the survey info. I've ran the script on a raspberry pi (kernel version 6.11 and iw version 6.9) setting it into AP mode with root privilages # as wpa_supplicant is running by default on the raspberry pi stop it
systemctl stop wpa_supplicant
pkill wpa_supplicant
# now configure the Wifi Card (the Intel AX210 is enumrated as wlan1 for me)
ip link set wlan1 down
iw wlan set type __ap
ip link set wlan0 up
# this should now show the WLAN card in AP mode
iw wlan0 info
# now to trigger a scan to botain the survey info, run the nl80211_trigger_scan example (
cargo run --example nl80211_trigger_scan 4
# after that the dump survey should provide some info
cargo run --example dump_nl80211_survey 4 The iw wlan1 scan passive
iw wlan1 survey dump |
I've also added optional support for For that I'd had to add the |
6eaf204
to
a64a093
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a document line indicate even kernel said NL80211_SURVEY_INFO_NOISE
is u8, the iw and real world still treat it as i8.
src/survey/survey_info.rs
Outdated
#[allow(clippy::cast_sign_loss)] | ||
match self { | ||
Self::Frequency(d) => write_u32(buffer, *d), | ||
Self::Noise(d) => buffer[0] = *d as u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i8::cast_unsigned()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a nightly feature https://doc.rust-lang.org/std/primitive.u8.html#method.cast_signed/, should I still use it? I'd prefer not to use nightly features, if no other nightly feature is used yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this was just stabilized, so I'll use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used cast_signed
and uncast_signed
instead of the as
cast in the latest revision.
Please also squash these commits into single one. Thanks. |
a64a093
to
3a3e82f
Compare
I've squashed the commits and added the comment as you suggested. |
3a3e82f
to
6b77fa8
Compare
d9da877
to
7d334b2
Compare
Signed-off-by: Fabian Viöl <[email protected]>
7d334b2
to
ba42308
Compare
This adds the ability to trigger and parse the
NL80211_ATTR_SURVEY_INFO
similar toiw DEVICE survey dump
.I've added and example, which does dump the survey info. The device was set to AP mode via
iw
beforeThe wifi chip I used is the Intel AX210NGW and the kernel loaded the firmware version 89. With this I was able to read out noise measurement values.
Depends on #23