systeminformation 6.0.0-beta.2 → 6.0.0-beta.21

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 (139) hide show
  1. package/README.md +67 -18
  2. package/dist/bsd/mem.js +8 -3
  3. package/dist/bsd/network-stats.d.ts +1 -1
  4. package/dist/bsd/network-stats.js +14 -7
  5. package/dist/bsd/os-info.d.ts +1 -0
  6. package/dist/common/darwin.d.ts +2 -0
  7. package/dist/common/darwin.js +17 -1
  8. package/dist/common/defaults.d.ts +2 -1
  9. package/dist/common/defaults.js +36 -6
  10. package/dist/common/exec.js +29 -13
  11. package/dist/common/files.d.ts +9 -0
  12. package/dist/common/files.js +67 -3
  13. package/dist/common/filesys.d.ts +30 -0
  14. package/dist/common/filesys.js +228 -11
  15. package/dist/common/host.js +55 -3
  16. package/dist/common/internet.js +31 -20
  17. package/dist/common/mappings.d.ts +0 -3
  18. package/dist/common/mappings.js +35 -14
  19. package/dist/common/network.d.ts +15 -2
  20. package/dist/common/network.js +18 -22
  21. package/dist/common/nvidia.d.ts +1 -1
  22. package/dist/common/nvidia.js +4 -5
  23. package/dist/common/parse.d.ts +4 -6
  24. package/dist/common/parse.js +24 -69
  25. package/dist/common/security.d.ts +2 -0
  26. package/dist/common/security.js +18 -3
  27. package/dist/common/types.d.ts +53 -5
  28. package/dist/common/windows.d.ts +4 -0
  29. package/dist/common/windows.js +57 -1
  30. package/dist/cpu-current-load.d.ts +1 -0
  31. package/dist/cpu-current-load.js +54 -8
  32. package/dist/cpu-current-speed.js +5 -3
  33. package/dist/darwin/battery.d.ts +1 -1
  34. package/dist/darwin/battery.js +15 -5
  35. package/dist/darwin/camera.js +3 -3
  36. package/dist/darwin/disk-layout.js +16 -12
  37. package/dist/darwin/disks-io.js +3 -3
  38. package/dist/darwin/displays.d.ts +1 -0
  39. package/dist/darwin/displays.js +64 -2
  40. package/dist/darwin/fans.d.ts +2 -0
  41. package/dist/darwin/fans.js +28 -0
  42. package/dist/darwin/gpu.js +1 -1
  43. package/dist/darwin/index.d.ts +3 -0
  44. package/dist/darwin/index.js +8 -2
  45. package/dist/darwin/keyboard.js +4 -4
  46. package/dist/darwin/mouse.js +4 -4
  47. package/dist/darwin/network-interfaces.d.ts +3 -0
  48. package/dist/darwin/network-interfaces.js +81 -14
  49. package/dist/darwin/network-stats.d.ts +1 -1
  50. package/dist/darwin/network-stats.js +14 -7
  51. package/dist/darwin/os-info.d.ts +2 -0
  52. package/dist/darwin/os-info.js +24 -2
  53. package/dist/darwin/process-focused.d.ts +3 -0
  54. package/dist/darwin/process-focused.js +26 -0
  55. package/dist/darwin/serial-ports.d.ts +2 -0
  56. package/dist/darwin/serial-ports.js +94 -0
  57. package/dist/darwin/users.js +1 -1
  58. package/dist/docker.js +4 -5
  59. package/dist/fans.d.ts +1 -0
  60. package/dist/fans.js +17 -0
  61. package/dist/get-data.d.ts +4 -0
  62. package/dist/get-data.js +6 -2
  63. package/dist/get.js +6 -1
  64. package/dist/index.d.ts +3 -0
  65. package/dist/index.js +8 -2
  66. package/dist/inet-public-ip.js +2 -1
  67. package/dist/linux/audio.js +59 -0
  68. package/dist/linux/baseboard.js +9 -20
  69. package/dist/linux/bios.js +6 -15
  70. package/dist/linux/block-devices.js +3 -1
  71. package/dist/linux/camera.js +2 -1
  72. package/dist/linux/chassis.js +4 -10
  73. package/dist/linux/cpu-temperature.js +34 -19
  74. package/dist/linux/cpu.js +3 -1
  75. package/dist/linux/disk-layout.js +9 -12
  76. package/dist/linux/disks-io.js +9 -9
  77. package/dist/linux/displays.d.ts +8 -0
  78. package/dist/linux/displays.js +151 -4
  79. package/dist/linux/fans.d.ts +2 -0
  80. package/dist/linux/fans.js +92 -0
  81. package/dist/linux/fs-size.d.ts +1 -1
  82. package/dist/linux/fs-size.js +164 -37
  83. package/dist/linux/fs-stats.js +6 -9
  84. package/dist/linux/gpu.d.ts +2 -0
  85. package/dist/linux/gpu.js +97 -22
  86. package/dist/linux/index.d.ts +3 -0
  87. package/dist/linux/index.js +8 -2
  88. package/dist/linux/mem-layout.js +3 -7
  89. package/dist/linux/mem.d.ts +1 -0
  90. package/dist/linux/mem.js +21 -1
  91. package/dist/linux/network-interfaces.d.ts +1 -0
  92. package/dist/linux/network-interfaces.js +154 -113
  93. package/dist/linux/network-stats.d.ts +1 -1
  94. package/dist/linux/network-stats.js +14 -40
  95. package/dist/linux/npu.js +2 -1
  96. package/dist/linux/os-info.js +56 -5
  97. package/dist/linux/printer.js +4 -4
  98. package/dist/linux/process-focused.d.ts +4 -0
  99. package/dist/linux/process-focused.js +32 -0
  100. package/dist/linux/process-load.js +11 -13
  101. package/dist/linux/processes.js +89 -80
  102. package/dist/linux/serial-ports.d.ts +2 -0
  103. package/dist/linux/serial-ports.js +102 -0
  104. package/dist/linux/services.js +182 -49
  105. package/dist/linux/system.js +1 -7
  106. package/dist/linux/users.js +1 -1
  107. package/dist/linux/uuid.js +4 -10
  108. package/dist/linux/wifi-networks.js +2 -2
  109. package/dist/network-interfaces.js +1 -1
  110. package/dist/observe.d.ts +1 -1
  111. package/dist/observe.js +5 -1
  112. package/dist/process-focused.d.ts +1 -0
  113. package/dist/process-focused.js +17 -0
  114. package/dist/serial-ports.d.ts +1 -0
  115. package/dist/serial-ports.js +17 -0
  116. package/dist/versions.js +34 -80
  117. package/dist/windows/audio.d.ts +29 -0
  118. package/dist/windows/audio.js +151 -11
  119. package/dist/windows/disk-layout.js +3 -0
  120. package/dist/windows/disks-io.js +3 -3
  121. package/dist/windows/displays.d.ts +5 -0
  122. package/dist/windows/displays.js +101 -16
  123. package/dist/windows/fans.d.ts +2 -0
  124. package/dist/windows/fans.js +71 -0
  125. package/dist/windows/fs-size.js +1 -4
  126. package/dist/windows/gpu.js +3 -2
  127. package/dist/windows/index.d.ts +3 -0
  128. package/dist/windows/index.js +8 -2
  129. package/dist/windows/network-interfaces.js +36 -41
  130. package/dist/windows/network-stats.js +20 -6
  131. package/dist/windows/process-focused.d.ts +3 -0
  132. package/dist/windows/process-focused.js +36 -0
  133. package/dist/windows/process-load.js +7 -5
  134. package/dist/windows/processes.d.ts +1 -0
  135. package/dist/windows/processes.js +54 -26
  136. package/dist/windows/serial-ports.d.ts +3 -0
  137. package/dist/windows/serial-ports.js +73 -0
  138. package/dist/windows/services.js +4 -1
  139. package/package.json +1 -1
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentLoad = void 0;
3
+ exports.currentLoad = exports.avgLoadEwma = void 0;
4
4
  const node_os_1 = require("node:os");
5
5
  const common_1 = require("./common");
6
6
  const const_1 = require("./common/const");
7
- const exec_1 = require("./common/exec");
7
+ const files_1 = require("./common/files");
8
+ const JIFFY_MS = 10;
8
9
  let _current_cpu = {
9
10
  user: 0,
10
11
  nice: 0,
11
12
  system: 0,
12
13
  idle: 0,
14
+ iowait: 0,
13
15
  irq: 0,
14
16
  steal: 0,
15
17
  guest: 0,
@@ -21,6 +23,7 @@ let _current_cpu = {
21
23
  currentLoadSystem: 0,
22
24
  currentLoadNice: 0,
23
25
  currentLoadIdle: 0,
26
+ currentLoadIowait: 0,
24
27
  currentLoadIrq: 0,
25
28
  currentLoadSteal: 0,
26
29
  currentLoadGuest: 0,
@@ -29,16 +32,31 @@ let _current_cpu = {
29
32
  rawCurrentLoadSystem: 0,
30
33
  rawCurrentLoadNice: 0,
31
34
  rawCurrentLoadIdle: 0,
35
+ rawCurrentLoadIowait: 0,
32
36
  rawCurrentLoadIrq: 0,
33
37
  rawCurrentLoadSteal: 0,
34
38
  rawCurrentLoadGuest: 0
35
39
  };
36
40
  const _cpus = [];
37
41
  let _corecount = 0;
42
+ const AVG_LOAD_PERIODS = [60, 300, 900];
43
+ let _avgLoadEwma = [0, 0, 0];
44
+ let _avgLoadEwmaMs = null;
45
+ const avgLoadEwma = (previous, busyCores, seconds) => {
46
+ if (!previous || seconds <= 0) {
47
+ return [busyCores, busyCores, busyCores];
48
+ }
49
+ return AVG_LOAD_PERIODS.map((period, i) => {
50
+ const decay = Math.exp(-seconds / period);
51
+ return (previous[i] || 0) * decay + busyCores * (1 - decay);
52
+ });
53
+ };
54
+ exports.avgLoadEwma = avgLoadEwma;
55
+ const avgLoadFromEwma = (cores) => (cores ? parseFloat((Math.max(..._avgLoadEwma) / cores).toFixed(2)) : 0);
38
56
  const currentLoad = async () => {
39
57
  await (0, common_1.nextTick)();
40
58
  const loads = (0, node_os_1.loadavg)().map((x) => x / (0, node_os_1.cpus)().length);
41
- const avgLoad = parseFloat(Math.max(...loads).toFixed(2));
59
+ let avgLoad = parseFloat(Math.max(...loads).toFixed(2));
42
60
  let result = {
43
61
  avgLoad: 0,
44
62
  currentLoad: 0,
@@ -46,6 +64,7 @@ const currentLoad = async () => {
46
64
  currentLoadSystem: 0,
47
65
  currentLoadNice: 0,
48
66
  currentLoadIdle: 0,
67
+ currentLoadIowait: 0,
49
68
  currentLoadIrq: 0,
50
69
  currentLoadSteal: 0,
51
70
  currentLoadGuest: 0,
@@ -54,6 +73,7 @@ const currentLoad = async () => {
54
73
  rawCurrentLoadSystem: 0,
55
74
  rawCurrentLoadNice: 0,
56
75
  rawCurrentLoadIdle: 0,
76
+ rawCurrentLoadIowait: 0,
57
77
  rawCurrentLoadIrq: 0,
58
78
  rawCurrentLoadSteal: 0,
59
79
  rawCurrentLoadGuest: 0,
@@ -75,24 +95,26 @@ const currentLoad = async () => {
75
95
  let totalNice = 0;
76
96
  let totalIrq = 0;
77
97
  let totalIdle = 0;
98
+ let totalIowait = 0;
78
99
  let totalSteal = 0;
79
100
  let totalGuest = 0;
80
101
  const cores = [];
81
102
  _corecount = cpus && cpus.length ? cpus.length : 0;
82
103
  if (const_1.LINUX) {
83
104
  try {
84
- const { stdout } = await (0, exec_1.exec)('cat /proc/stat 2>/dev/null | grep cpu');
85
- const lines = stdout.split('\n');
105
+ const lines = (await (0, files_1.readFileLines)('/proc/stat')).filter((line) => line.startsWith('cpu'));
86
106
  if (lines.length > 1) {
87
107
  lines.shift();
88
108
  if (lines.length === cpus.length) {
89
109
  for (let i = 0; i < lines.length; i++) {
90
110
  const parts = lines[i].split(' ');
91
111
  if (parts.length >= 10) {
112
+ const iowait = parseFloat(parts[5]) || 0;
92
113
  const steal = parseFloat(parts[8]) || 0;
93
114
  const guest = parseFloat(parts[9]) || 0;
94
- cpus[i].times.steal = steal;
95
- cpus[i].times.guest = guest;
115
+ cpus[i].times.iowait = iowait * JIFFY_MS;
116
+ cpus[i].times.steal = steal * JIFFY_MS;
117
+ cpus[i].times.guest = guest * JIFFY_MS;
96
118
  }
97
119
  }
98
120
  }
@@ -106,6 +128,7 @@ const currentLoad = async () => {
106
128
  totalSystem += cpu.sys;
107
129
  totalNice += cpu.nice;
108
130
  totalIdle += cpu.idle;
131
+ totalIowait += cpu.iowait || 0;
109
132
  totalIrq += cpu.irq;
110
133
  totalSteal += cpu.steal || 0;
111
134
  totalGuest += cpu.guest || 0;
@@ -115,6 +138,7 @@ const currentLoad = async () => {
115
138
  const tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0;
116
139
  const tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0;
117
140
  const tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0;
141
+ const tmpIowait = _cpus && _cpus[i] && _cpus[i].iowait ? _cpus[i].iowait : 0;
118
142
  const tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0;
119
143
  const tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0;
120
144
  const tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0;
@@ -127,6 +151,7 @@ const currentLoad = async () => {
127
151
  _cpus[i].loadSystem = _cpus[i].sys - tmpSystem;
128
152
  _cpus[i].loadNice = _cpus[i].nice - tmpNice;
129
153
  _cpus[i].loadIdle = _cpus[i].idle - tmpIdle;
154
+ _cpus[i].loadIowait = (_cpus[i].iowait || 0) - tmpIowait;
130
155
  _cpus[i].loadIrq = _cpus[i].irq - tmpIrq;
131
156
  _cpus[i].loadSteal = _cpus[i].steal - tmpSteal;
132
157
  _cpus[i].loadGuest = _cpus[i].guest - tmpGuest;
@@ -137,6 +162,7 @@ const currentLoad = async () => {
137
162
  cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
138
163
  cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
139
164
  cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
165
+ cores[i].loadIowait = (_cpus[i].loadIowait / coreTick) * 100;
140
166
  cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
141
167
  cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
142
168
  cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
@@ -145,13 +171,21 @@ const currentLoad = async () => {
145
171
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
146
172
  cores[i].rawLoadNice = _cpus[i].loadNice;
147
173
  cores[i].rawLoadIdle = _cpus[i].loadIdle;
174
+ cores[i].rawLoadIowait = _cpus[i].loadIowait;
148
175
  cores[i].rawLoadIrq = _cpus[i].loadIrq;
149
176
  cores[i].rawLoadSteal = _cpus[i].loadSteal;
150
177
  cores[i].rawLoadGuest = _cpus[i].loadGuest;
151
178
  }
152
- const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle;
179
+ const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle + totalIowait;
153
180
  const totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest;
154
181
  const currentTick = totalTick - _current_cpu.tick || 1;
182
+ if (const_1.WINDOWS) {
183
+ const busyCores = ((totalLoad - _current_cpu.load) / currentTick) * _corecount;
184
+ const seconds = _avgLoadEwmaMs === null ? 0 : (_current_cpu.ms - _avgLoadEwmaMs) / 1000;
185
+ _avgLoadEwma = (0, exports.avgLoadEwma)(_avgLoadEwmaMs === null ? null : _avgLoadEwma, busyCores, seconds);
186
+ _avgLoadEwmaMs = _current_cpu.ms;
187
+ avgLoad = avgLoadFromEwma(_corecount);
188
+ }
155
189
  result = {
156
190
  avgLoad: avgLoad,
157
191
  currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
@@ -159,6 +193,7 @@ const currentLoad = async () => {
159
193
  currentLoadSystem: ((totalSystem - _current_cpu.system) / currentTick) * 100,
160
194
  currentLoadNice: ((totalNice - _current_cpu.nice) / currentTick) * 100,
161
195
  currentLoadIdle: ((totalIdle - _current_cpu.idle) / currentTick) * 100,
196
+ currentLoadIowait: ((totalIowait - _current_cpu.iowait) / currentTick) * 100,
162
197
  currentLoadIrq: ((totalIrq - _current_cpu.irq) / currentTick) * 100,
163
198
  currentLoadSteal: ((totalSteal - _current_cpu.steal) / currentTick) * 100,
164
199
  currentLoadGuest: ((totalGuest - _current_cpu.guest) / currentTick) * 100,
@@ -167,6 +202,7 @@ const currentLoad = async () => {
167
202
  rawCurrentLoadSystem: totalSystem - _current_cpu.system,
168
203
  rawCurrentLoadNice: totalNice - _current_cpu.nice,
169
204
  rawCurrentLoadIdle: totalIdle - _current_cpu.idle,
205
+ rawCurrentLoadIowait: totalIowait - _current_cpu.iowait,
170
206
  rawCurrentLoadIrq: totalIrq - _current_cpu.irq,
171
207
  rawCurrentLoadSteal: totalSteal - _current_cpu.steal,
172
208
  rawCurrentLoadGuest: totalGuest - _current_cpu.guest,
@@ -177,6 +213,7 @@ const currentLoad = async () => {
177
213
  nice: totalNice,
178
214
  system: totalSystem,
179
215
  idle: totalIdle,
216
+ iowait: totalIowait,
180
217
  irq: totalIrq,
181
218
  steal: totalSteal,
182
219
  guest: totalGuest,
@@ -188,6 +225,7 @@ const currentLoad = async () => {
188
225
  currentLoadSystem: result.currentLoadSystem,
189
226
  currentLoadNice: result.currentLoadNice,
190
227
  currentLoadIdle: result.currentLoadIdle,
228
+ currentLoadIowait: result.currentLoadIowait,
191
229
  currentLoadIrq: result.currentLoadIrq,
192
230
  currentLoadSteal: result.currentLoadSteal,
193
231
  currentLoadGuest: result.currentLoadGuest,
@@ -196,12 +234,16 @@ const currentLoad = async () => {
196
234
  rawCurrentLoadSystem: result.rawCurrentLoadSystem,
197
235
  rawCurrentLoadNice: result.rawCurrentLoadNice,
198
236
  rawCurrentLoadIdle: result.rawCurrentLoadIdle,
237
+ rawCurrentLoadIowait: result.rawCurrentLoadIowait,
199
238
  rawCurrentLoadIrq: result.rawCurrentLoadIrq,
200
239
  rawCurrentLoadSteal: result.rawCurrentLoadSteal,
201
240
  rawCurrentLoadGuest: result.rawCurrentLoadGuest
202
241
  };
203
242
  }
204
243
  else {
244
+ if (const_1.WINDOWS) {
245
+ avgLoad = avgLoadFromEwma(_corecount);
246
+ }
205
247
  const cores = [];
206
248
  for (let i = 0; i < _corecount; i++) {
207
249
  cores[i] = {};
@@ -211,6 +253,7 @@ const currentLoad = async () => {
211
253
  cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
212
254
  cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
213
255
  cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
256
+ cores[i].loadIowait = (_cpus[i].loadIowait / coreTick) * 100;
214
257
  cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
215
258
  cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
216
259
  cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
@@ -219,6 +262,7 @@ const currentLoad = async () => {
219
262
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
220
263
  cores[i].rawLoadNice = _cpus[i].loadNice;
221
264
  cores[i].rawLoadIdle = _cpus[i].loadIdle;
265
+ cores[i].rawLoadIowait = _cpus[i].loadIowait;
222
266
  cores[i].rawLoadIrq = _cpus[i].loadIrq;
223
267
  cores[i].rawLoadSteal = _cpus[i].loadSteal;
224
268
  cores[i].rawLoadGuest = _cpus[i].loadGuest;
@@ -230,6 +274,7 @@ const currentLoad = async () => {
230
274
  currentLoadSystem: _current_cpu.currentLoadSystem,
231
275
  currentLoadNice: _current_cpu.currentLoadNice,
232
276
  currentLoadIdle: _current_cpu.currentLoadIdle,
277
+ currentLoadIowait: _current_cpu.currentLoadIowait,
233
278
  currentLoadIrq: _current_cpu.currentLoadIrq,
234
279
  currentLoadSteal: _current_cpu.currentLoadSteal,
235
280
  currentLoadGuest: _current_cpu.currentLoadGuest,
@@ -238,6 +283,7 @@ const currentLoad = async () => {
238
283
  rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem,
239
284
  rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice,
240
285
  rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle,
286
+ rawCurrentLoadIowait: _current_cpu.rawCurrentLoadIowait,
241
287
  rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq,
242
288
  rawCurrentLoadSteal: _current_cpu.rawCurrentLoadSteal,
243
289
  rawCurrentLoadGuest: _current_cpu.rawCurrentLoadGuest,
@@ -5,7 +5,7 @@ const node_os_1 = require("node:os");
5
5
  const common_1 = require("./common");
6
6
  const const_1 = require("./common/const");
7
7
  const cpu_1 = require("./common/cpu");
8
- const exec_1 = require("./common/exec");
8
+ const files_1 = require("./common/files");
9
9
  const getCpuCurrentSpeed = async () => {
10
10
  const oscpus = (0, node_os_1.cpus)();
11
11
  let minFreq = 999999999;
@@ -20,8 +20,10 @@ const getCpuCurrentSpeed = async () => {
20
20
  }
21
21
  else if (const_1.LINUX) {
22
22
  try {
23
- const { stdout } = await (0, exec_1.exec)('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', const_1.execOptsLinux);
24
- const speedStrings = stdout.split('\n').filter((line) => line.length > 0);
23
+ const speedStrings = (await (0, files_1.readFileLines)('/proc/cpuinfo'))
24
+ .filter((line) => line.toLowerCase().startsWith('cpu mhz'))
25
+ .map((line) => (line.split(':')[1] || '').trim())
26
+ .filter((line) => line.length > 0);
25
27
  for (const i in speedStrings) {
26
28
  speeds.push(Math.floor(parseInt(speedStrings[i], 10) / 10) / 100);
27
29
  }
@@ -1,2 +1,2 @@
1
- import { BatteryObject } from '../common/types';
1
+ import type { BatteryObject } from '../common/types';
2
2
  export declare const battery: () => Promise<BatteryObject[]>;
@@ -7,7 +7,12 @@ const exec_1 = require("../common/exec");
7
7
  const parseBatteryObject = (data) => {
8
8
  const defaults = (0, common_1.cloneObj)(defaults_1.initBatteryResult);
9
9
  data = data || '';
10
- const lines = data.replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
10
+ const lines = data
11
+ .replace(/^[ |]+/gm, '')
12
+ .replace(/ +/g, '')
13
+ .replace(/"+/g, '')
14
+ .replace(/-/g, '')
15
+ .split('\n');
11
16
  let percent = null;
12
17
  const line = (0, common_1.getValue)(lines, 'internal', 'Battery');
13
18
  const parts = line.split(';');
@@ -21,9 +26,14 @@ const parseBatteryObject = (data) => {
21
26
  const acConnected = parts && parts[1] ? parts[1].trim() !== 'discharging' : false;
22
27
  const voltage = parseInt('0' + (0, common_1.getValue)(lines, 'voltage', '='), 10) / 1000.0;
23
28
  const capacityUnit = voltage ? 'mWh' : 'mAh';
24
- const maxCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'applerawmaxcapacity', '='), 10) * (voltage || 1));
25
- const currentCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'applerawcurrentcapacity', '='), 10) * (voltage || 1));
26
- const designedCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'DesignCapacity', '='), 10) * (voltage || 1));
29
+ const batteryData = (0, common_1.getValue)(lines, 'BatteryData', '=').replace(/^\{/, '').replace(/\}$/, '').split(',');
30
+ const maxCapacity = Math.round(parseInt('0' +
31
+ ((0, common_1.getValue)(lines, 'AppleRawMaxCapacity', '=') ||
32
+ (0, common_1.getValue)(lines, 'NominalChargeCapacity', '=') ||
33
+ (0, common_1.getValue)(batteryData, 'FullChargeCapacity', '=') ||
34
+ (0, common_1.getValue)(batteryData, 'NominalChargeCapacity', '=')), 10) * (voltage || 1));
35
+ const currentCapacity = Math.round(parseInt('0' + ((0, common_1.getValue)(lines, 'AppleRawCurrentCapacity', '=') || (0, common_1.getValue)(batteryData, 'RemainingCapacity', '=')), 10) * (voltage || 1));
36
+ const designedCapacity = Math.round(parseInt('0' + ((0, common_1.getValue)(lines, 'DesignCapacity', '=') || (0, common_1.getValue)(batteryData, 'DesignCapacity', '=')), 10) * (voltage || 1));
27
37
  let hasBattery = defaults.hasBattery;
28
38
  let type = defaults.type;
29
39
  let timeRemaining = defaults.timeRemaining;
@@ -59,7 +69,7 @@ const parseBatteryObject = (data) => {
59
69
  };
60
70
  const battery = async () => {
61
71
  await (0, common_1.nextTick)();
62
- const { stdout } = await (0, exec_1.execSave)('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage"; pmset -g batt | grep %');
72
+ const { stdout } = await (0, exec_1.execSave)('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage|BatteryData|NominalChargeCapacity"; pmset -g batt | grep %');
63
73
  return parseBatteryObject(stdout);
64
74
  };
65
75
  exports.battery = battery;
@@ -40,10 +40,10 @@ const parseUsb = (data) => {
40
40
  const camera = async () => {
41
41
  await (0, common_1.nextTick)();
42
42
  try {
43
- const { stdout } = await (0, exec_1.exec)('system_profiler SPCameraDataType SPUSBDataType -xml');
43
+ const { stdout } = await (0, exec_1.exec)('system_profiler SPCameraDataType SPUSBDataType SPUSBHostDataType -xml');
44
44
  const data = (0, darwin_1.plistParser)(stdout, false);
45
- const cameraData = data.length >= 2 && data[0]._items ? data[0]._items : [];
46
- const usbData = data.length >= 2 && data[1]._items ? data[1]._items : [];
45
+ const cameraData = (0, darwin_1.spItems)(data, 'SPCameraDataType');
46
+ const usbData = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
47
47
  let result = parseCamera(cameraData);
48
48
  result = result.concat(parseUsb(usbData));
49
49
  return result;
@@ -12,14 +12,21 @@ const diskLayout = async () => {
12
12
  let stdout = '';
13
13
  let cmd = '';
14
14
  let cmdFullSmart = '';
15
+ const addSmartCmds = (bsdName) => {
16
+ if (typeof bsdName !== 'string' || !/^disk\d+(s\d+)*$/.test(bsdName)) {
17
+ return;
18
+ }
19
+ cmd += `printf "\n${bsdName}|"; diskutil info /dev/${bsdName} | grep SMART;`;
20
+ cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${bsdName};`;
21
+ };
15
22
  try {
16
- ({ stdout } = await (0, exec_1.exec)(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPStorageDataType -xml`, { maxBuffer: const_1.MAX_BUFFER_SIZE }));
23
+ ({ stdout } = await (0, exec_1.exec)(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPUSBHostDataType SPStorageDataType -xml`, { maxBuffer: const_1.MAX_BUFFER_SIZE }));
17
24
  const data = (0, darwin_1.plistParser)(stdout, false);
18
- const diskSATA = data.length >= 4 && data[0]._items ? data[0]._items : [];
19
- const diskNVME = data.length >= 4 && data[1]._items ? data[1]._items : [];
20
- const diskUSB = data.length >= 4 && data[2]._items ? data[2]._items : [];
21
- const diskLine = data.length >= 4 && data[3]._items ? data[3]._items : [];
22
- if (diskSATA?.length && diskSATA._items) {
25
+ const diskSATA = (0, darwin_1.spItems)(data, 'SPSerialATADataType');
26
+ const diskNVME = (0, darwin_1.spItems)(data, 'SPNVMeDataType');
27
+ const diskUSB = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
28
+ const diskLine = (0, darwin_1.spItems)(data, 'SPStorageDataType');
29
+ if (diskSATA?.length) {
23
30
  diskSATA.forEach((controller) => {
24
31
  if (controller?._items && controller._items.length) {
25
32
  const deviceType = controller._names && controller._names.tolower().indexOf('ssd') >= 0 ? 'SSD' : 'HD';
@@ -44,8 +51,7 @@ const diskLayout = async () => {
44
51
  temperature: null,
45
52
  bsdName: disk.bsd_name
46
53
  });
47
- cmd += 'printf "\n' + disk.bsd_name + '|"; diskutil info /dev/' + disk.bsd_name + ' | grep SMART;';
48
- cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
54
+ addSmartCmds(disk.bsd_name);
49
55
  });
50
56
  }
51
57
  });
@@ -74,8 +80,7 @@ const diskLayout = async () => {
74
80
  temperature: null,
75
81
  bsdName: disk.bsd_name
76
82
  });
77
- cmd += 'printf "\n' + disk.bsd_name + '|"; diskutil info /dev/' + disk.bsd_name + ' | grep SMART;';
78
- cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
83
+ addSmartCmds(disk.bsd_name);
79
84
  });
80
85
  }
81
86
  });
@@ -106,8 +111,7 @@ const diskLayout = async () => {
106
111
  temperature: null,
107
112
  bsdName: media.bsd_name
108
113
  });
109
- cmd += 'printf "\n' + media.bsd_name + '|"; diskutil info /dev/' + media.bsd_name + ' | grep SMART;';
110
- cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${disk.bsd_name};`;
114
+ addSmartCmds(media.bsd_name);
111
115
  }
112
116
  else if (disk?._items.length) {
113
117
  disk._items.forEach((subdisk) => {
@@ -44,9 +44,9 @@ const disksIO = async () => {
44
44
  rIO_sec: filesys_1._disk_io.rIO_sec,
45
45
  wIO_sec: filesys_1._disk_io.wIO_sec,
46
46
  tIO_sec: filesys_1._disk_io.tIO_sec,
47
- rWaitTime: filesys_1._disk_io.rWaitTime,
48
- wWaitTime: filesys_1._disk_io.wWaitTime,
49
- tWaitTime: filesys_1._disk_io.tWaitTime,
47
+ rWaitTime: filesys_1._disk_io.rWaitTimeDelta,
48
+ wWaitTime: filesys_1._disk_io.wWaitTimeDelta,
49
+ tWaitTime: filesys_1._disk_io.tWaitTimeDelta,
50
50
  rWaitPercent: filesys_1._disk_io.rWaitPercent,
51
51
  wWaitPercent: filesys_1._disk_io.wWaitPercent,
52
52
  tWaitPercent: filesys_1._disk_io.tWaitPercent
@@ -1,2 +1,3 @@
1
1
  import { DisplayData } from '../common/types';
2
+ export declare const parseIoregPowerState: (stdout: string) => "" | "on" | "off" | "standby" | "suspend";
2
3
  export declare const displays: () => Promise<DisplayData[]>;
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.displays = void 0;
3
+ exports.displays = exports.parseIoregPowerState = void 0;
4
4
  const common_1 = require("../common");
5
5
  const darwin_1 = require("../common/darwin");
6
6
  const exec_1 = require("../common/exec");
7
+ const EXEC_OPTS = { timeout: 5000 };
7
8
  const mappings_1 = require("../common/mappings");
8
9
  const parseDisplaysDarwin = (graphicsArr) => {
9
10
  const displays = [];
10
11
  try {
11
12
  graphicsArr.forEach((item) => {
12
13
  if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) {
14
+ const gpu = item['sppci_model'] || item['_name'] || '';
13
15
  item.spdisplays_ndrvs.forEach((displayItem) => {
14
16
  const connectionType = displayItem['spdisplays_connection_type'] || '';
15
17
  const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@');
@@ -26,6 +28,7 @@ const parseDisplaysDarwin = (graphicsArr) => {
26
28
  displayId: displayItem['_spdisplays_displayID'] || null,
27
29
  deviceName: null,
28
30
  main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false,
31
+ mirror: (displayItem['spdisplays_mirror'] || 'spdisplays_off') !== 'spdisplays_off',
29
32
  builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1,
30
33
  connection: connectionType.indexOf('_internal') > -1 ? 'Internal' : connectionType.indexOf('_displayport') > -1 ? 'Display Port' : connectionType.indexOf('_hdmi') > -1 ? 'HDMI' : null,
31
34
  sizeX: null,
@@ -37,7 +40,15 @@ const parseDisplaysDarwin = (graphicsArr) => {
37
40
  currentResY: currentResolution.length > 1 ? parseInt(currentResolution[1], 10) : null,
38
41
  positionX: 0,
39
42
  positionY: 0,
40
- currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null
43
+ workAreaResolutionX: null,
44
+ workAreaResolutionY: null,
45
+ workAreaPositionX: null,
46
+ workAreaPositionY: null,
47
+ powerState: '',
48
+ gpu,
49
+ gpuBusAddress: '',
50
+ currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null,
51
+ scale: null
41
52
  });
42
53
  });
43
54
  }
@@ -84,6 +95,52 @@ const getDisplayPositionDarwin = async (displays) => {
84
95
  catch { }
85
96
  return displays;
86
97
  };
98
+ const jxaVisibleFrames = 'ObjC.import("AppKit"); var s = $.NSScreen.screens, out = []; for (var i = 0; i < s.count; i++) { var sc = s.objectAtIndex(i), f = sc.frame, v = sc.visibleFrame; out.push([sc.deviceDescription.objectForKey($("NSScreenNumber")).intValue, f.origin.x, f.origin.y, f.size.width, f.size.height, v.origin.x, v.origin.y, v.size.width, v.size.height].join("|")); } out.join("\\n")';
99
+ const getWorkAreaDarwin = async (displays) => {
100
+ try {
101
+ const { stdout } = await (0, exec_1.execSave)(`osascript -l JavaScript -e '${jxaVisibleFrames}'`);
102
+ const screens = stdout
103
+ .toString()
104
+ .split('\n')
105
+ .map((line) => line.split('|').map((part) => parseFloat(part)))
106
+ .filter((parts) => parts.length === 9 && !Number.isNaN(parts[0]));
107
+ const main = screens.find((parts) => parts[1] === 0 && parts[2] === 0);
108
+ if (!main) {
109
+ return displays;
110
+ }
111
+ screens.forEach((parts) => {
112
+ const display = displays.find((element) => (0, common_1.toInt)(element.displayId || '') === parts[0]);
113
+ if (display) {
114
+ display.workAreaResolutionX = Math.round(parts[7]);
115
+ display.workAreaResolutionY = Math.round(parts[8]);
116
+ display.workAreaPositionX = Math.round(parts[5]);
117
+ display.workAreaPositionY = Math.round(main[4] - (parts[6] + parts[8]));
118
+ }
119
+ });
120
+ }
121
+ catch { }
122
+ return displays;
123
+ };
124
+ const parseIoregPowerState = (stdout) => {
125
+ const match = stdout.match(/"MaxPowerState"=(\d+)[^}]*"CurrentPowerState"=(\d+)/);
126
+ if (!match) {
127
+ return '';
128
+ }
129
+ const max = (0, common_1.toInt)(match[1]);
130
+ const current = (0, common_1.toInt)(match[2]);
131
+ if (!max) {
132
+ return '';
133
+ }
134
+ if (current >= max) {
135
+ return 'on';
136
+ }
137
+ if (!current) {
138
+ return 'off';
139
+ }
140
+ return current === max - 1 ? 'standby' : 'suspend';
141
+ };
142
+ exports.parseIoregPowerState = parseIoregPowerState;
143
+ const getPowerStateDarwin = async () => (0, exports.parseIoregPowerState)(await (0, exec_1.execSecure)('ioreg', ['-n', 'IODisplayWrangler', '-r', '-d', '1'], EXEC_OPTS));
87
144
  const displays = async () => {
88
145
  await (0, common_1.nextTick)();
89
146
  let result = [];
@@ -91,6 +148,11 @@ const displays = async () => {
91
148
  const { stdout } = await (0, exec_1.shareInflight)('SPDisplaysDataType', () => (0, exec_1.exec)('system_profiler -xml -detailLevel full SPDisplaysDataType'));
92
149
  result = parseDisplaysDarwin((0, darwin_1.plistParser)(stdout));
93
150
  result = await getDisplayPositionDarwin(result);
151
+ result = await getWorkAreaDarwin(result);
152
+ const powerState = await getPowerStateDarwin();
153
+ for (const display of result) {
154
+ display.powerState = powerState;
155
+ }
94
156
  }
95
157
  catch { }
96
158
  return result;
@@ -0,0 +1,2 @@
1
+ import type { FanData } from '../common/types';
2
+ export declare const fans: () => Promise<FanData[]>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fans = void 0;
4
+ const common_1 = require("../common");
5
+ const fans = async () => {
6
+ await (0, common_1.nextTick)();
7
+ const result = [];
8
+ try {
9
+ const macosTemp = require('macos-temperature-sensor');
10
+ if (typeof macosTemp.fans === 'function') {
11
+ const res = macosTemp.fans();
12
+ if (Array.isArray(res)) {
13
+ res.forEach((fan, index) => {
14
+ result.push({
15
+ id: `fan${index}`,
16
+ label: fan?.label || null,
17
+ rpm: typeof fan?.rpm === 'number' ? Math.round(fan.rpm) : null,
18
+ pwm: typeof fan?.pwm === 'number' ? Math.round(fan.pwm) : null,
19
+ source: 'SMC'
20
+ });
21
+ });
22
+ }
23
+ }
24
+ }
25
+ catch { }
26
+ return result;
27
+ };
28
+ exports.fans = fans;
@@ -12,7 +12,7 @@ const parseControllersDarwin = (graphicsArr) => {
12
12
  const bus = (item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : (item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : '';
13
13
  const vram = (parseInt(item.spdisplays_vram || '', 10) || 0) * ((item.spdisplays_vram || '').indexOf('GB') > -1 ? 1024 : 1);
14
14
  const vramDyn = (parseInt(item.spdisplays_vram_shared || '', 10) || 0) * ((item.spdisplays_vram_shared || '').indexOf('GB') > -1 ? 1024 : 1);
15
- const metalVersion = (0, mappings_1.graphicsMetalVersion)(item.spdisplays_metal || item.spdisplays_metalfamily || '');
15
+ const metalVersion = (0, mappings_1.graphicsMetalVersion)(item.spdisplays_mtlgpufamilysupport || item.spdisplays_metal || item.spdisplays_metalfamily || '');
16
16
  controllers.push({
17
17
  vendor: (0, mappings_1.graphicsModelToVendor)(item.spdisplays_vendor || '') || item.spdisplays_vendor || '',
18
18
  model: item.sppci_model || '',
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
11
11
  export { cpuCurrentSpeed } from '../cpu-current-speed';
12
12
  export { cpuFlags } from './cpu-flags';
13
13
  export { cpuTemperature } from './cpu-temperature';
14
+ export { fans } from './fans';
14
15
  export { currentLoad } from '../cpu-current-load';
15
16
  export { diskLayout } from './disk-layout';
16
17
  export { disksIO } from './disks-io';
@@ -39,12 +40,14 @@ export { pci } from './pci';
39
40
  export { printer } from './printer';
40
41
  export { processes } from '../linux/processes';
41
42
  export { processLoad } from '../linux/process-load';
43
+ export { processFocused } from './process-focused';
42
44
  export { services } from '../linux/services';
43
45
  export { shell } from '../shell';
44
46
  export { software } from './software';
45
47
  export { system } from './system';
46
48
  export { thunderbolt } from './thunderbolt';
47
49
  export { time } from '../time';
50
+ export { serialPorts } from './serial-ports';
48
51
  export { usb } from './usb';
49
52
  export { users } from './users';
50
53
  export { uuid } from './uuid';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
4
- exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = void 0;
3
+ exports.services = exports.processFocused = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
4
+ exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = void 0;
5
5
  var audio_1 = require("./audio");
6
6
  Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
7
7
  var baseboard_1 = require("./baseboard");
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
28
28
  Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
29
29
  var cpu_temperature_1 = require("./cpu-temperature");
30
30
  Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
31
+ var fans_1 = require("./fans");
32
+ Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
31
33
  var cpu_current_load_1 = require("../cpu-current-load");
32
34
  Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
33
35
  var disk_layout_1 = require("./disk-layout");
@@ -90,6 +92,8 @@ var processes_1 = require("../linux/processes");
90
92
  Object.defineProperty(exports, "processes", { enumerable: true, get: function () { return processes_1.processes; } });
91
93
  var process_load_1 = require("../linux/process-load");
92
94
  Object.defineProperty(exports, "processLoad", { enumerable: true, get: function () { return process_load_1.processLoad; } });
95
+ var process_focused_1 = require("./process-focused");
96
+ Object.defineProperty(exports, "processFocused", { enumerable: true, get: function () { return process_focused_1.processFocused; } });
93
97
  var services_1 = require("../linux/services");
94
98
  Object.defineProperty(exports, "services", { enumerable: true, get: function () { return services_1.services; } });
95
99
  var shell_1 = require("../shell");
@@ -102,6 +106,8 @@ var thunderbolt_1 = require("./thunderbolt");
102
106
  Object.defineProperty(exports, "thunderbolt", { enumerable: true, get: function () { return thunderbolt_1.thunderbolt; } });
103
107
  var time_1 = require("../time");
104
108
  Object.defineProperty(exports, "time", { enumerable: true, get: function () { return time_1.time; } });
109
+ var serial_ports_1 = require("./serial-ports");
110
+ Object.defineProperty(exports, "serialPorts", { enumerable: true, get: function () { return serial_ports_1.serialPorts; } });
105
111
  var usb_1 = require("./usb");
106
112
  Object.defineProperty(exports, "usb", { enumerable: true, get: function () { return usb_1.usb; } });
107
113
  var users_1 = require("./users");
@@ -56,11 +56,11 @@ const filterBluetooth = (data) => {
56
56
  const keyboard = async () => {
57
57
  await (0, common_1.nextTick)();
58
58
  try {
59
- const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPBluetoothDataType -xml');
59
+ const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPUSBHostDataType SPBluetoothDataType -xml');
60
60
  const data = (0, darwin_1.plistParser)(stdout, false);
61
- const spiData = data.length >= 2 && data[0]._items ? data[0]._items : [];
62
- const usbData = data.length >= 2 && data[1]._items ? data[1]._items : [];
63
- const bluetoothData = data.length >= 3 && data[2]._items ? data[2]._items : [];
61
+ const spiData = (0, darwin_1.spItems)(data, 'SPSPIDataType');
62
+ const usbData = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
63
+ const bluetoothData = (0, darwin_1.spItems)(data, 'SPBluetoothDataType');
64
64
  let result = parseKeyboard(spiData);
65
65
  result = result.concat(parseUsb(usbData));
66
66
  result = result.concat(filterBluetooth((0, bluetooth_1.parseBluetooth)(bluetoothData)));