homebridge-lib 5.3.1 → 5.3.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/SystemInfo.js +18 -21
- package/package.json +1 -1
package/lib/SystemInfo.js
CHANGED
|
@@ -293,29 +293,26 @@ class SystemInfo extends events.EventEmitter {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (
|
|
305
|
-
prettyName =
|
|
296
|
+
try {
|
|
297
|
+
if (process.arch === 'x64') { // Intel
|
|
298
|
+
text = await this.exec(
|
|
299
|
+
'plutil', '-p',
|
|
300
|
+
process.env.HOME + '/Library/Preferences/com.apple.SystemProfiler.plist'
|
|
301
|
+
)
|
|
302
|
+
const regexp = RegExp('"' + id.slice(-4) + '.*" => "(.*)"')
|
|
303
|
+
const a = regexp.exec(text)
|
|
304
|
+
if (a[1] != null) {
|
|
305
|
+
prettyName = a[1]
|
|
306
|
+
}
|
|
307
|
+
} else { // Apple silicon
|
|
308
|
+
text = await this.execShell('ioreg -l | grep product-description')
|
|
309
|
+
const a = /"product-description" = <"([^"]*)">/.exec(text)
|
|
310
|
+
if (a != null) {
|
|
311
|
+
prettyName = a[1]
|
|
306
312
|
}
|
|
307
313
|
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// 'ioreg', '-c', 'IOPlatformDevice', '-d', '4', '-n', 'product'
|
|
311
|
-
// )
|
|
312
|
-
text = await this.execShell('ioreg -l | grep product-description')
|
|
313
|
-
// This is empty on my Intel Macs - I think the key is registered for
|
|
314
|
-
// running iPad apps on Apple chips.
|
|
315
|
-
const a = /"product-description" = <"([^"]*)">/.exec(text)
|
|
316
|
-
if (a != null) {
|
|
317
|
-
prettyName = a[1]
|
|
318
|
-
}
|
|
314
|
+
} catch (error) {
|
|
315
|
+
this.emit('error', error)
|
|
319
316
|
}
|
|
320
317
|
return {
|
|
321
318
|
id: id,
|