homebridge-lib 5.1.22-0 → 5.1.22

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.
Files changed (2) hide show
  1. package/lib/SystemInfo.js +14 -5
  2. package/package.json +1 -1
package/lib/SystemInfo.js CHANGED
@@ -112,10 +112,16 @@ class SystemInfo extends events.EventEmitter {
112
112
  * @return {object} - The extracted info.
113
113
  */
114
114
  static parseRpiCpuInfo (cpuInfo) {
115
- const id = /Serial\s*: ([0-9a-f]{16})/.exec(cpuInfo)[1].toUpperCase()
116
- const revision = parseInt(
117
- /Revision\s*: ([0-9a-f]{4,})/.exec(cpuInfo)[1], 16
118
- ) & 0x00FFFFFF
115
+ let a = /Serial\s*: ([0-9a-f]{16})/.exec(cpuInfo)
116
+ if (a == null || a.length < 2) {
117
+ return null
118
+ }
119
+ const id = a[1].toUpperCase()
120
+ a = /Revision\s*: ([0-9a-f]{4,})/.exec(cpuInfo)
121
+ if (a == null || a.length < 2) {
122
+ return null
123
+ }
124
+ const revision = parseInt(a[1], 16) & 0x00FFFFFF
119
125
  let gpioMask, manufacturer, memory, model, modelRevision, processor
120
126
  if ((revision & 0x00800000) !== 0) { // New revision scheme.
121
127
  manufacturer = rpiInfo.manufacturers[(revision & 0x000F0000) >> 16]
@@ -338,8 +344,11 @@ class SystemInfo extends events.EventEmitter {
338
344
  case 'ProductName': // e.g. 'macOS' or 'Mac OS X'
339
345
  name = fields[1]
340
346
  break
341
- case 'ProductVersion': // e.g. '12.0.1'
347
+ case 'ProductVersion': // e.g. '12.0.1' or '12.1'
342
348
  version = fields[1]
349
+ if (version.split('.').length === 2) {
350
+ version += '.0'
351
+ }
343
352
  break
344
353
  case 'BuildVersion': // e.g. '21A559'
345
354
  build = fields[1]
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Library for homebridge plugins",
4
4
  "author": "Erik Baauw",
5
5
  "license": "Apache-2.0",
6
- "version": "5.1.22-0",
6
+ "version": "5.1.22",
7
7
  "keywords": [
8
8
  "homekit",
9
9
  "homebridge"