Commit 2624a7e
committed
For Apple silicon, use machdep.cpu.brand_string in preference to decoding hw.machine
This functionality was implemented in #65 ("Updated package.name to also
query machdep.cpu.brand_string if decode of hw.machine fails"), but then it was
omitted from the subsequent #100, probably inadvertently.
Adding that functionality back here, so that the package/device name can be
shown correctly on recent devices and macOS/iOS versions. I have reversed
the order so that `machdep.cpu.brand_string` is checked before attempting to
decode `hw.machine`, since the former appears to be more future-proof.
Before this change, on a recent MacBook Pro:
$ cpu-info
...
Debug (cpuinfo): hw.machine: arm64
Warning in cpuinfo: parsing "hw.machine" failed: Undefined error: 0
...
Packages:
0:
After this change:
$ cpu-info
...
Debug (cpuinfo): machdep.cpu.brand_string: Apple M2 Pro
...
Packages:
0: Apple M2 Pro1 parent ca156f7 commit 2624a7e
1 file changed
+25
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
105 | 122 | | |
106 | 123 | | |
107 | 124 | | |
108 | | - | |
| 125 | + | |
109 | 126 | | |
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
114 | | - | |
| 131 | + | |
115 | 132 | | |
116 | 133 | | |
117 | 134 | | |
118 | 135 | | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
122 | | - | |
| 139 | + | |
123 | 140 | | |
124 | 141 | | |
125 | 142 | | |
| |||
224 | 241 | | |
225 | 242 | | |
226 | 243 | | |
| 244 | + | |
227 | 245 | | |
| 246 | + | |
228 | 247 | | |
229 | 248 | | |
230 | 249 | | |
| |||
275 | 294 | | |
276 | 295 | | |
277 | 296 | | |
278 | | - | |
| 297 | + | |
| 298 | + | |
279 | 299 | | |
280 | 300 | | |
281 | 301 | | |
| |||
0 commit comments