-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Motherboard support #1069
Comments
Hum. Not sure if many people would be interested by this feature. If at least one other dev is interested, I'm ok with adding it. You'll need to get the code for FreeBSD and macOS too but you already have a good start. ;)
You're welcome! |
Thank you for the feedback, I think that the biggest crowd that would wish for this would come from the community that develops fetch utilities. |
Great to hear that! Don't hesitate to ask around and tell people to just leave a comment on the issue if they are interested in the feature. No need to close the issue even if no one comes around, who knows if someone will in a future after all. |
On FreeBSD, it is (in C) I doubt if it's possible on macOS |
I would be interested in this feature. I know a bit about the macOS related stuff. It depends on what you would want to return for the "board". There are a number of ways to go about getting the info, none of them as simple as the other OSes. The information is there though. The "Model Identifier" is typically indicative of the type of computer and the release order. That or "Model Number" is going to be the closest you can get to a motherboard on a Mac. I would argue that the Model Identifier is more useful because there have been times when Apple reuses the same Model Number for multiple computers year over year.
I think there's also a way to read a |
myself and @Notarin got this bad boy working just a few minutes ago live on the natestream #[cfg(target_os = "macos")]
pub(crate) async fn get_motherboard() -> String {
let output_raw: Result<Output, std::io::Error> = Command::new("system_profiler")
.arg("SPHardwareDataType")
.output();
let output: String = match output_raw {
Err(_) => {
return "Unknown".to_string();
}
Ok(x) => String::from_utf8(x.stdout)
.expect("non-utf8 response found from call to system_proflier"),
};
output
.split("\n")
.into_iter()
.filter(|x| x.contains("Model Number:"))
.map(|y| y.replace("Model Number:", ""))
.map(|z| z.trim().clone().to_string())
.collect()
} |
.map(|z| z.trim().clone().to_string()) could be: .map(|z| z.trim().to_string()) But otherwise, PR is very welcome. :) |
It's
Why? Do you mean that every mac uses unique mother board type? EDIT:
I don't think Apple designs unique mother board types for different regions / countries. EDIT2: The I generally expect motherboard info prints something about the product name (e.g. GIGABYTE XXX, MSI XXX), and / or the chipset name (e.g. Intel Z690, AMD B650). As Apple never sells motherboard independently, it's understandable that they don't have a unique motherboard product name or chipset name, and it's reasonable to leave the motherboard information empty or unsupported Hackintosh is an exception though. EDIT3: According to https://www.theiphonewiki.com/wiki/Models#MacBook_Pro, different models of MBP have different storage sizes. Storage sizes must have no business with motherboards. |
Being able to lookup the motherboard from the library would be great.
Here is my implementation in this features absence.
P.S. dev, your crate is awesome, thanks for the awesome library.
The text was updated successfully, but these errors were encountered: