-
Notifications
You must be signed in to change notification settings - Fork 52
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
Inner value of CWPHYMode
appears to change between integer and bitflags index between macOS versions
#662
Comments
Huh. This is interesting. I ran the example code. I'm on macOS 15 with an 802.11ac network. I get a The mapping looks like:
Looks like the pattern is a bitmask rather than an integer? |
I'm still on macOS 14.7, and can't test this in a virtual machine (since the virtual machines don't have WiFi), so could I get one of you to test the following:
|
Sorry for the delay in my response, after running all the variants you asked for above, I only realized that the output had been fixed. I'm not sure if it was in this repo or the underlying framework, but it seems right now right? I'd appreciate understanding if it was the underlying macOS version so I know to expect incorrect values from a specific version of the OS or of this crate, if you know? I'm now on macOS 15.1.1. fn main() {
use objc2_core_wlan::CWWiFiClient;
unsafe {
let client = CWWiFiClient::sharedWiFiClient();
let interface = client.interface().unwrap();
let phy_mode = interface.activePHYMode();
println!("{:?}", phy_mode);
}
} Without flag: ❯ cargo run --example madsmtm_objc2_issues_662
Compiling ...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 56s
Running `target/debug/examples/madsmtm_objc2_issues_662`
CWPHYMode(6) With flag: ❯ RUSTFLAGS="-Clinker-flavor=ld" cargo run --example madsmtm_objc2_issues_662
Compiling ...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3m 27s
Running `target/debug/examples/madsmtm_objc2_issues_662`
CWPHYMode(6) Swift: import CoreWLAN
let client = CWWiFiClient.shared()
let interface = client.interface()!
let phy_mode = interface.activePHYMode()
print(phy_mode.rawValue) 6
Program ended with exit code: 0 |
Running above Rust code snippet again on |
Damn! Could you check
Hmm, not really, especially not something like this. But I think you'd be able to handle it with something like:
If it affects |
In the code below, the inner value of
CWPHYMode
which is returned byinterface.activePHYMode()
differs based on the macOS version.From observation I've noticed that
const ... Self(n)
constants on the enum802.11n
is returned asCWPHYMode(16)
but should beCWPHYMode(4)
802.11ax
is returned asCWPHYMode(64)
but should beCWPHYMode(6)
Cargo.toml
for contextThe text was updated successfully, but these errors were encountered: