Skip to content
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

Add iPhone 15 #1429

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 42 additions & 18 deletions src/unix/apple/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,24 +413,48 @@ pub(crate) fn get_vendor_id_and_brand() -> (String, String) {
}
let full_brand = get_sysctl_str(b"hw.machine\0");
// This is a fallback when the `sysctl` to get the CPU brand returns an empty string.
// FIXME: This list is incomplete!
let brand = match full_brand.split(',').next().unwrap() {
"iPhone16" => "A18 Bionic",
"iPhone14" => "A16 Bionic",
"iPhone13" => "A15 Bionic",
"iPhone12" | "iPad10" => "A14 Bionic",
"iPhone11" | "iPad9" => "A13 Bionic",
"iPad8" => "A12 Bionic",
"iPhone8" => "A11 Bionic",
"iPhone7" => "A10 Fusion",
"iPad13" => "M1",
"iPad5" => "A9",
"iPhone6" => "A8",
"iPad4" => "A6X",
"iPhone5" => "A6",
"iPad3" => "A5X",
"iPad2" => "A5",
"iPad1" | "iPhone4" => "A4",
let mut iter = full_brand.split(',');
let brand = match (iter.next().unwrap_or(""), iter.next()) {
("iPhone1", Some("1" | "2")) => "S5L8900",
("iPhone2", Some("1")) => "S5L8920",
("iPhone3", Some("1" | "2" | "3")) => "A4",
("iPhone4", Some("1" | "2")) => "A5",
("iPhone5", Some("1" | "2")) => "A6",
("iPhone5", Some("3" | "4")) => "A6",
("iPhone6", Some("1" | "2")) => "A7",
("iPhone7", Some("1" | "2")) => "A8",
("iPhone8", Some("1" | "2" | "4")) => "A9",
("iPhone9", Some("1" | "2" | "3" | "4")) => "A10 Fusion",
("iPhone10", Some("1" | "2" | "3" | "4" | "5" | "6")) => "A11 Bionic",
("iPhone11", Some("1" | "2" | "4" | "6" | "8")) => "A12 Bionic",
("iPhone12", Some("1" | "3" | "5" | "8")) => "A13 Bionic",
("iPhone13", Some("1" | "2" | "3" | "4")) => "A14 Bionic",
("iPhone14", Some("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8")) => "A15 Bionic",
("iPhone15", Some("2" | "3" | "4" | "5")) => "A16 Bionic",
("iPhone16", Some("1" | "2")) => "A17 Pro",
("iPhone17", Some("1" | "2")) => "A18 Pro",
("iPhone17", Some("3" | "4")) => "A18",
("iPad1", Some("1" | "2")) => "A4",
("iPad2", Some("1" | "2" | "3" | "4" | "5" | "6" | "7")) => "A5",
("iPad3", Some("1" | "2" | "3")) => "A5X",
("iPad3", Some("4" | "5" | "6")) => "A6X",
("iPad4", Some("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9")) => "A7",
("iPad5", Some("1" | "2")) => "A8",
("iPad5", Some("3" | "4")) => "A8X",
("iPad6", Some("3" | "4" | "7" | "8")) => "A9X",
("iPad6", Some("11" | "12")) => "A9",
("iPad7", Some("1" | "2" | "3" | "4")) => "A10X Fusion",
("iPad7", Some("5" | "6" | "11" | "12")) => "A10 Fusion",
("iPad8", Some("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8")) => "A12X Bionic",
("iPad8", Some("9" | "10" | "11" | "12")) => "A12Z Bionic",
("iPad11", Some("1" | "2" | "3" | "4" | "6" | "7")) => "A12 Bionic",
("iPad12", Some("1" | "2")) => "A13 Bionic",
("iPad13", Some("1" | "2" | "18" | "19")) => "A14 Bionic",
("iPad13", Some("4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "16" | "17")) => "M1",
("iPad14", Some("1" | "2")) => "A15 Bionic",
("iPad14", Some("3" | "4" | "5" | "6" | "10" | "11")) => "M2",
("iPad14", Some("8" | "9")) => "M1",
("iPad16", Some("3" | "4" | "5" | "6")) => "M3",
_ => "unknown",
};
(vendor, brand.to_string())
Expand Down
Loading