kanrisuru 0.3.2 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -0
  3. data/lib/kanrisuru/command.rb +8 -3
  4. data/lib/kanrisuru/core.rb +6 -0
  5. data/lib/kanrisuru/core/apt.rb +6 -6
  6. data/lib/kanrisuru/core/dmi.rb +533 -0
  7. data/lib/kanrisuru/core/path.rb +0 -1
  8. data/lib/kanrisuru/core/socket.rb +16 -16
  9. data/lib/kanrisuru/core/system.rb +80 -0
  10. data/lib/kanrisuru/core/yum.rb +8 -8
  11. data/lib/kanrisuru/core/zypper.rb +1094 -0
  12. data/lib/kanrisuru/remote/cpu.rb +4 -0
  13. data/lib/kanrisuru/remote/fstab.rb +3 -3
  14. data/lib/kanrisuru/remote/host.rb +2 -2
  15. data/lib/kanrisuru/util.rb +1 -0
  16. data/lib/kanrisuru/util/bits.rb +3 -3
  17. data/lib/kanrisuru/util/dmi_type.rb +1366 -0
  18. data/lib/kanrisuru/util/os_family.rb +1 -1
  19. data/lib/kanrisuru/version.rb +1 -1
  20. data/spec/functional/core/apt_spec.rb +97 -158
  21. data/spec/functional/core/dmi_spec.rb +37 -0
  22. data/spec/functional/core/file_spec.rb +5 -12
  23. data/spec/functional/core/system_spec.rb +21 -0
  24. data/spec/functional/core/yum_spec.rb +38 -80
  25. data/spec/functional/core/zypper_spec.rb +193 -0
  26. data/spec/functional/remote/fstab_spec.rb +1 -1
  27. data/spec/functional/remote/os_spec.rb +1 -1
  28. data/spec/helper/test_hosts.rb +7 -1
  29. data/spec/unit/core/apt_spec.rb +42 -0
  30. data/spec/unit/core/archive_spec.rb +11 -0
  31. data/spec/unit/core/disk_spec.rb +21 -0
  32. data/spec/unit/core/dmi_spec.rb +271 -0
  33. data/spec/unit/core/file_spec.rb +9 -0
  34. data/spec/unit/core/find_spec.rb +9 -0
  35. data/spec/unit/core/group_spec.rb +10 -0
  36. data/spec/unit/core/ip_spec.rb +59 -0
  37. data/spec/unit/core/path_spec.rb +16 -0
  38. data/spec/unit/core/socket_spec.rb +38 -0
  39. data/spec/unit/core/stat_spec.rb +14 -0
  40. data/spec/unit/core/system_spec.rb +79 -0
  41. data/spec/unit/core/transfer_spec.rb +15 -0
  42. data/spec/unit/core/user_spec.rb +11 -0
  43. data/spec/unit/core/yum_spec.rb +47 -0
  44. data/spec/unit/core/zypper_spec.rb +121 -0
  45. data/spec/unit/util_spec.rb +224 -0
  46. metadata +23 -2
@@ -99,6 +99,10 @@ module Kanrisuru
99
99
  @cpu_architecture.virtualization_type
100
100
  end
101
101
 
102
+ def flags
103
+ @cpu_architecture.flags
104
+ end
105
+
102
106
  def hyperthreading?
103
107
  threads_per_core > 1
104
108
  end
@@ -168,9 +168,9 @@ module Kanrisuru
168
168
 
169
169
  def inspect
170
170
  str = '#<Kanrisuru::Remote::Fstab::Entry:0x%<object_id>s ' \
171
- '@line=%<line>s @device=%<device>s @label=%<label>s' \
172
- '@uuid=%<uuid>s @freq=%<freq>s @pasno=%<passno>s' \
173
- '@opts=%<opts>s}>'
171
+ '@line=%<line>s @device=%<device>s @label=%<label>s' \
172
+ '@uuid=%<uuid>s @freq=%<freq>s @pasno=%<passno>s' \
173
+ '@opts=%<opts>s}>'
174
174
 
175
175
  format(
176
176
  str,
@@ -16,7 +16,7 @@ module Kanrisuru
16
16
  @username = opts[:username]
17
17
  @login_user = @username
18
18
 
19
- @port = opts[:port]
19
+ @port = opts[:port] || 22
20
20
  @password = opts[:password] if opts[:password]
21
21
  @keys = opts[:keys] if opts[:keys]
22
22
  @shell = opts[:shell] || '/bin/bash'
@@ -84,7 +84,7 @@ module Kanrisuru
84
84
  end
85
85
 
86
86
  def ssh
87
- @ssh ||= Net::SSH.start(@host, @username, keys: @keys, password: @password)
87
+ @ssh ||= Net::SSH.start(@host, @username, keys: @keys, password: @password, port: @port)
88
88
  end
89
89
 
90
90
  def ping?
@@ -4,6 +4,7 @@ require_relative 'util/bits'
4
4
  require_relative 'util/os_family'
5
5
  require_relative 'util/fs_mount_opts'
6
6
  require_relative 'util/signal'
7
+ require_relative 'util/dmi_type'
7
8
 
8
9
  module Kanrisuru
9
10
  class Util
@@ -13,11 +13,11 @@ module Kanrisuru
13
13
  case unit.downcase
14
14
  when 'b'
15
15
  Kanrisuru::Util::Bits.convert_bytes(size, :byte, :kilobyte)
16
- when 'kb', 'k'
16
+ when 'kb', 'k', 'kib'
17
17
  size
18
- when 'mb', 'm'
18
+ when 'mb', 'm', 'mib'
19
19
  Kanrisuru::Util::Bits.convert_from_mb(size, :kilobyte).to_i
20
- when 'gb', 'g'
20
+ when 'gb', 'g', 'gib'
21
21
  Kanrisuru::Util::Bits.convert_from_gb(size, :kilobyte).to_i
22
22
  end
23
23
  end
@@ -0,0 +1,1366 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kanrisuru
4
+ class Util
5
+ class DmiType
6
+ ## https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0.pdf
7
+ @dmi_type_fields = {
8
+ 'BIOS' => {
9
+ characteristics: [
10
+ 'BIOS characteristics not supported',
11
+ 'ISA is supported',
12
+ 'MCA is supported',
13
+ 'EISA is supported',
14
+ 'PCI is supported',
15
+ 'PC Card (PCMCIA) is supported',
16
+ 'PNP is supported',
17
+ 'APM is supported',
18
+ 'BIOS is upgradeable',
19
+ 'BIOS shadowing is allowed',
20
+ 'VLB is supported',
21
+ 'ESCD support is available',
22
+ 'Boot from CD is supported',
23
+ 'Selectable boot is supported',
24
+ 'BIOS ROM is socketed',
25
+ 'Boot from PC Card (PCMCIA) is supported',
26
+ 'EDD is supported',
27
+ 'Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)',
28
+ 'Japanese floppy for Toshiba 1.2 MB is supported (int 13h)',
29
+ '5.25"/360 kB floppy services are supported (int 13h)',
30
+ '5.25"/1.2 MB floppy services are supported (int 13h)',
31
+ '3.5"/720 kB floppy services are supported (int 13h)',
32
+ '3.5"/2.88 MB floppy services are supported (int 13h)',
33
+ 'Print screen service is supported (int 5h)',
34
+ '8042 keyboard services are supported (int 9h)',
35
+ 'Serial services are supported (int 14h)',
36
+ 'Printer services are supported (int 17h)',
37
+ 'CGA/mono video services are supported (int 10h)',
38
+ 'NEC PC-98'
39
+ ],
40
+ characteristics_x1: [
41
+ 'ACPI is supported',
42
+ 'USB legacy is supported',
43
+ 'AGP is supported',
44
+ 'I2O boot is supported',
45
+ 'LS-120 boot is supported',
46
+ 'ATAPI Zip drive boot is supported',
47
+ 'IEEE 1394 boot is supported',
48
+ 'Smart battery is supported'
49
+ ],
50
+ characteristics_x2: [
51
+ 'BIOS boot specification is supported',
52
+ 'Function key-initiated network boot is supported',
53
+ 'Targeted content distribution is supported',
54
+ 'UEFI is supported',
55
+ 'System is a virtual machine'
56
+ ]
57
+ },
58
+ 'System' => {
59
+ wake_up_type: [
60
+ 'Reserved',
61
+ 'Other',
62
+ 'Unknown',
63
+ 'APM Timer',
64
+ 'Modem Ring',
65
+ 'LAN Remote',
66
+ 'Power Switch',
67
+ 'PCI PME#',
68
+ 'AC Power Restored'
69
+ ]
70
+ },
71
+ 'Baseboard' => {
72
+ features: [
73
+ 'Board is a hosting board',
74
+ 'Board requires at least one daughter board',
75
+ 'Board is removable',
76
+ 'Board is replaceable',
77
+ 'Board is hot swappable'
78
+ ],
79
+ type: [
80
+ 'Unknown',
81
+ 'Other',
82
+ 'Server Blade',
83
+ 'Connectivity Switch',
84
+ 'System Management Module',
85
+ 'Processor Module',
86
+ 'I/O Module',
87
+ 'Memory Module',
88
+ 'Daughter Board',
89
+ 'Motherboard',
90
+ 'Processor+Memory Module',
91
+ 'Processor+I/O Module',
92
+ 'Interconnect Board'
93
+ ]
94
+ },
95
+ 'Chassis' => {
96
+ types: [
97
+ 'Other',
98
+ 'Unknown',
99
+ 'Desktop',
100
+ 'Low Profile Desktop',
101
+ 'Pizza Box',
102
+ 'Mini Tower',
103
+ 'Tower',
104
+ 'Portable',
105
+ 'Laptop',
106
+ 'Notebook',
107
+ 'Hand Held',
108
+ 'Docking Station',
109
+ 'All In One',
110
+ 'Sub Notebook',
111
+ 'Space-saving',
112
+ 'Lunch Box',
113
+ 'Main Server Chassis',
114
+ 'Expansion Chassis',
115
+ 'Sub Chassis',
116
+ 'Bus Expansion Chassis',
117
+ 'Peripheral Chassis',
118
+ 'RAID Chassis',
119
+ 'Rack Mount Chassis',
120
+ 'Sealed-case PC',
121
+ 'Multi-system',
122
+ 'CompactPCI',
123
+ 'AdvancedTCA',
124
+ 'Blade',
125
+ 'Blade Enclosing',
126
+ 'Tablet',
127
+ 'Convertible',
128
+ 'Detachable',
129
+ 'IoT Gateway',
130
+ 'Embedded PC',
131
+ 'Mini PC',
132
+ 'Stick PC'
133
+ ],
134
+ security_status: [
135
+ 'Other',
136
+ 'Unknown',
137
+ 'None',
138
+ 'External Interface Locked Out',
139
+ 'External Interface Enabled'
140
+ ],
141
+ states: [
142
+ 'Other',
143
+ 'Unknown',
144
+ 'Safe',
145
+ 'Warning',
146
+ 'Critical',
147
+ 'Non-recoverable'
148
+ ]
149
+ },
150
+ 'Processor' => {
151
+ type: [
152
+ 'Other',
153
+ 'Unknown',
154
+ 'Central Processor',
155
+ 'Math Processor',
156
+ 'DSP Processor',
157
+ 'Video Processor'
158
+ ],
159
+ family: [
160
+ 'Other',
161
+ 'Unknown',
162
+ '8086',
163
+ '80286',
164
+ '80386',
165
+ '80486',
166
+ '8087',
167
+ '80287',
168
+ '80387',
169
+ '80487',
170
+ 'Pentium',
171
+ 'Pentium Pro',
172
+ 'Pentium II',
173
+ 'Pentium MMX',
174
+ 'Celeron',
175
+ 'Pentium II Xeon',
176
+ 'Pentium III',
177
+ 'M1',
178
+ 'M2',
179
+ 'Celeron M',
180
+ 'Pentium 4 HT',
181
+ 'Duron',
182
+ 'K5',
183
+ 'K6',
184
+ 'K6-2',
185
+ 'K6-3',
186
+ 'Athlon',
187
+ 'AMD29000',
188
+ 'K6-2+',
189
+ 'Power PC',
190
+ 'Power PC 601',
191
+ 'Power PC 603',
192
+ 'Power PC 603+',
193
+ 'Power PC 604',
194
+ 'Power PC 620',
195
+ 'Power PC x704',
196
+ 'Power PC 750',
197
+ 'Core Duo',
198
+ 'Core Duo Mobile',
199
+ 'Core Solo Mobile',
200
+ 'Atom',
201
+ 'Core M',
202
+ 'Core m3',
203
+ 'Core m5',
204
+ 'Core m7',
205
+ 'Alpha',
206
+ 'Alpha 21064',
207
+ 'Alpha 21066',
208
+ 'Alpha 21164',
209
+ 'Alpha 21164PC',
210
+ 'Alpha 21164a',
211
+ 'Alpha 21264',
212
+ 'Alpha 21364',
213
+ 'Turion II Ultra Dual-Core Mobile M',
214
+ 'Turion II Dual-Core Mobile M',
215
+ 'Athlon II Dual-Core M',
216
+ 'Opteron 6100',
217
+ 'Opteron 4100',
218
+ 'Opteron 6200',
219
+ 'Opteron 4200',
220
+ 'FX',
221
+ 'MIPS',
222
+ 'MIPS R4000',
223
+ 'MIPS R4200',
224
+ 'MIPS R4400',
225
+ 'MIPS R4600',
226
+ 'MIPS R10000',
227
+ 'C-Series',
228
+ 'E-Series',
229
+ 'A-Series',
230
+ 'G-Series',
231
+ 'Z-Series',
232
+ 'R-Series',
233
+ 'Opteron 4300',
234
+ 'Opteron 6300',
235
+ 'Opteron 3300',
236
+ 'FirePro',
237
+ 'SPARC',
238
+ 'SuperSPARC',
239
+ 'MicroSPARC II',
240
+ 'MicroSPARC IIep',
241
+ 'UltraSPARC',
242
+ 'UltraSPARC II',
243
+ 'UltraSPARC IIi',
244
+ 'UltraSPARC III',
245
+ 'UltraSPARC IIIi',
246
+ '68040',
247
+ '68xxx',
248
+ '68000',
249
+ '68010',
250
+ '68020',
251
+ '68030',
252
+ 'Athlon X4',
253
+ 'Opteron X1000',
254
+ 'Opteron X2000',
255
+ 'Opteron A-Series',
256
+ 'Opteron X3000',
257
+ 'Zen',
258
+ 'Hobbit',
259
+ 'Crusoe TM5000',
260
+ 'Crusoe TM3000',
261
+ 'Efficeon TM8000',
262
+ 'Weitek',
263
+ 'Itanium',
264
+ 'Athlon 64',
265
+ 'Opteron',
266
+ 'Sempron',
267
+ 'Turion 64',
268
+ 'Dual-Core Opteron',
269
+ 'Athlon 64 X2',
270
+ 'Turion 64 X2',
271
+ 'Quad-Core Opteron',
272
+ 'Third-Generation Opteron',
273
+ 'Phenom FX',
274
+ 'Phenom X4',
275
+ 'Phenom X2',
276
+ 'Athlon X2',
277
+ 'PA-RISC',
278
+ 'PA-RISC 8500',
279
+ 'PA-RISC 8000',
280
+ 'PA-RISC 7300LC',
281
+ 'PA-RISC 7200',
282
+ 'PA-RISC 7100LC',
283
+ 'PA-RISC 7100',
284
+ 'V30',
285
+ 'Quad-Core Xeon 3200',
286
+ 'Dual-Core Xeon 3000',
287
+ 'Quad-Core Xeon 5300',
288
+ 'Dual-Core Xeon 5100',
289
+ 'Dual-Core Xeon 5000',
290
+ 'Dual-Core Xeon LV',
291
+ 'Dual-Core Xeon ULV',
292
+ 'Dual-Core Xeon 7100',
293
+ 'Quad-Core Xeon 5400',
294
+ 'Quad-Core Xeon',
295
+ 'Dual-Core Xeon 5200',
296
+ 'Dual-Core Xeon 7200',
297
+ 'Quad-Core Xeon 7300',
298
+ 'Quad-Core Xeon 7400',
299
+ 'Multi-Core Xeon 7400',
300
+ 'Pentium III Xeon',
301
+ 'Pentium III Speedstep',
302
+ 'Pentium 4',
303
+ 'Xeon',
304
+ 'AS400',
305
+ 'Xeon MP',
306
+ 'Athlon XP',
307
+ 'Athlon MP',
308
+ 'Itanium 2',
309
+ 'Pentium M',
310
+ 'Celeron D',
311
+ 'Pentium D',
312
+ 'Pentium EE',
313
+ 'Core Solo',
314
+ 'Core 2 Duo',
315
+ 'Core 2 Solo',
316
+ 'Core 2 Extreme',
317
+ 'Core 2 Quad',
318
+ 'Core 2 Extreme Mobile',
319
+ 'Core 2 Duo Mobile',
320
+ 'Core 2 Solo Mobile',
321
+ 'Core i7',
322
+ 'Dual-Core Celeron',
323
+ 'IBM390',
324
+ 'G4',
325
+ 'G5',
326
+ 'ESA/390 G6',
327
+ 'z/Architecture',
328
+ 'Core i5',
329
+ 'Core i3',
330
+ 'Core i9',
331
+ 'C7-M',
332
+ 'C7-D',
333
+ 'C7',
334
+ 'Eden',
335
+ 'Multi-Core Xeon',
336
+ 'Dual-Core Xeon 3xxx',
337
+ 'Quad-Core Xeon 3xxx',
338
+ 'Nano',
339
+ 'Dual-Core Xeon 5xxx',
340
+ 'Quad-Core Xeon 5xxx',
341
+ 'Dual-Core Xeon 7xxx',
342
+ 'Quad-Core Xeon 7xxx',
343
+ 'Multi-Core Xeon 7xxx',
344
+ 'Multi-Core Xeon 3400',
345
+ 'Opteron 3000',
346
+ 'Sempron II',
347
+ 'Embedded Opteron Quad-Core',
348
+ 'Phenom Triple-Core',
349
+ 'Turion Ultra Dual-Core Mobile',
350
+ 'Turion Dual-Core Mobile',
351
+ 'Athlon Dual-Core',
352
+ 'Sempron SI',
353
+ 'Phenom II',
354
+ 'Athlon II',
355
+ 'Six-Core Opteron',
356
+ 'Sempron M',
357
+ 'i860',
358
+ 'i960',
359
+ 'ARMv7',
360
+ 'ARMv8',
361
+ 'SH-3',
362
+ 'SH-4',
363
+ 'ARM',
364
+ 'StrongARM',
365
+ '6x86',
366
+ 'MediaGX',
367
+ 'MII',
368
+ 'WinChip',
369
+ 'DSP',
370
+ 'Video Processor',
371
+ 'RV32',
372
+ 'RV64',
373
+ 'RV128'
374
+ ],
375
+ voltage: [
376
+ '5.0 V',
377
+ '3.3 V',
378
+ '2.9 V'
379
+ ],
380
+ upgrade: [
381
+ 'Other',
382
+ 'Unknown',
383
+ 'Daughter Board',
384
+ 'ZIF Socket',
385
+ 'Replaceable Piggy Back',
386
+ 'None',
387
+ 'LIF Socket',
388
+ 'Slot 1',
389
+ 'Slot 2',
390
+ '370-pin Socket',
391
+ 'Slot A',
392
+ 'Slot M',
393
+ 'Socket 423',
394
+ 'Socket A (Socket 462)',
395
+ 'Socket 478',
396
+ 'Socket 754',
397
+ 'Socket 940',
398
+ 'Socket 939',
399
+ 'Socket mPGA604',
400
+ 'Socket LGA771',
401
+ 'Socket LGA775',
402
+ 'Socket S1',
403
+ 'Socket AM2',
404
+ 'Socket F (1207)',
405
+ 'Socket LGA1366',
406
+ 'Socket G34',
407
+ 'Socket AM3',
408
+ 'Socket C32',
409
+ 'Socket LGA1156',
410
+ 'Socket LGA1567',
411
+ 'Socket PGA988A',
412
+ 'Socket BGA1288',
413
+ 'Socket rPGA988B',
414
+ 'Socket BGA1023',
415
+ 'Socket BGA1224',
416
+ 'Socket BGA1155',
417
+ 'Socket LGA1356',
418
+ 'Socket LGA2011',
419
+ 'Socket FS1',
420
+ 'Socket FS2',
421
+ 'Socket FM1',
422
+ 'Socket FM2',
423
+ 'Socket LGA2011-3',
424
+ 'Socket LGA1356-3',
425
+ 'Socket LGA1150',
426
+ 'Socket BGA1168',
427
+ 'Socket BGA1234',
428
+ 'Socket BGA1364',
429
+ 'Socket AM4',
430
+ 'Socket LGA1151',
431
+ 'Socket BGA1356',
432
+ 'Socket BGA1440',
433
+ 'Socket BGA1515',
434
+ 'Socket LGA3647-1',
435
+ 'Socket SP3',
436
+ 'Socket SP3r2',
437
+ 'Socket LGA2066',
438
+ 'Socket BGA1392',
439
+ 'Socket BGA1510',
440
+ 'Socket BGA1528',
441
+ 'Socket LGA4189',
442
+ 'Socket LGA1200'
443
+ ],
444
+ characteristics: [
445
+ '64-bit capable',
446
+ 'Multi-Core',
447
+ 'Hardware Thread',
448
+ 'Execute Protection',
449
+ 'Enhanced Virtualization',
450
+ 'Power/Performance Control',
451
+ '128-bit Capable',
452
+ 'Arm64 SoC ID'
453
+ ],
454
+ flags: [
455
+ 'FPU (Floating-point unit on-chip)',
456
+ 'VME (Virtual mode extension)',
457
+ 'DE (Debugging extension)',
458
+ 'PSE (Page size extension)',
459
+ 'TSC (Time stamp counter)',
460
+ 'MSR (Model specific registers)',
461
+ 'PAE (Physical address extension)',
462
+ 'MCE (Machine check exception)',
463
+ 'CX8 (CMPXCHG8 instruction supported)',
464
+ 'APIC (On-chip APIC hardware supported)',
465
+ 'SEP (Fast system call)',
466
+ 'MTRR (Memory type range registers)',
467
+ 'PGE (Page global enable)',
468
+ 'MCA (Machine check architecture)',
469
+ 'CMOV (Conditional move instruction supported)',
470
+ 'PAT (Page attribute table)',
471
+ 'PSE-36 (36-bit page size extension)',
472
+ 'PSN (Processor serial number present and enabled)',
473
+ 'CLFSH (CLFLUSH instruction supported)',
474
+ 'DS (Debug store)',
475
+ 'ACPI (ACPI supported)',
476
+ 'MMX (MMX technology supported)',
477
+ 'FXSR (FXSAVE and FXSTOR instructions supported)',
478
+ 'SSE (Streaming SIMD extensions)',
479
+ 'SSE2 (Streaming SIMD extensions 2)',
480
+ 'SS (Self-snoop)',
481
+ 'HTT (Multi-threading)',
482
+ 'TM (Thermal monitor supported)',
483
+ 'PBE (Pending break enabled)'
484
+ ]
485
+ },
486
+ 'Memory Contorller' => {
487
+ error_detecting_method: [
488
+ 'Other',
489
+ 'Unknown',
490
+ 'None',
491
+ '8-bit Parity',
492
+ '32-bit ECC',
493
+ '64-bit ECC',
494
+ '128-bit ECC',
495
+ 'CRC'
496
+ ],
497
+ error_correcting_capability: [
498
+ 'Other',
499
+ 'Unknown',
500
+ 'None',
501
+ 'Single-bit Error Correcting',
502
+ 'Double-bit Error Correcting',
503
+ 'Error Scrubbing'
504
+ ],
505
+ interleave_support: [
506
+ 'Other',
507
+ 'Unknown',
508
+ 'One-way Interleave',
509
+ 'Two-way Interleave',
510
+ 'Four-way Interleave',
511
+ 'Eight-way Interleave',
512
+ 'Sixteen-way Interleave'
513
+ ],
514
+ speeds: [
515
+ 'Other',
516
+ 'Unknown',
517
+ '70 ns',
518
+ '60 ns',
519
+ '50 ns'
520
+ ]
521
+ },
522
+ 'Memory Module' => {
523
+ types: [
524
+ 'Other',
525
+ 'Unknown',
526
+ 'Standard',
527
+ 'FPM',
528
+ 'EDO',
529
+ 'Parity',
530
+ 'ECC',
531
+ 'SIMM',
532
+ 'DIMM',
533
+ 'Burst EDO',
534
+ 'SDRAM'
535
+ ]
536
+ },
537
+ 'Cache' => {
538
+ sram_type: [
539
+ 'Other',
540
+ 'Unknown',
541
+ 'Non-burst',
542
+ 'Burst',
543
+ 'Pipeline Burst',
544
+ 'Synchronous',
545
+ 'Asynchronous'
546
+ ],
547
+ error_correction_type: [
548
+ 'Other',
549
+ 'Unknown',
550
+ 'None',
551
+ 'Parity',
552
+ 'Single-bit ECC',
553
+ 'Multi-bit ECC'
554
+ ],
555
+ system_cache_types: [
556
+ 'Other',
557
+ 'Unknown',
558
+ 'Instruction',
559
+ 'Data',
560
+ 'Unified'
561
+ ],
562
+ associativity: [
563
+ 'Other',
564
+ 'Unknown',
565
+ 'Direct Mapped',
566
+ '2-way Set-associative',
567
+ '4-way Set-associative',
568
+ 'Fully Associative',
569
+ '8-way Set-associative',
570
+ '16-way Set-associative',
571
+ '12-way Set-associative',
572
+ '24-way Set-associative',
573
+ '32-way Set-associative',
574
+ '48-way Set-associative',
575
+ '64-way Set-associative',
576
+ '20-way Set-associative'
577
+ ]
578
+ },
579
+ 'Port Connector' => {
580
+ connector_types: [
581
+ 'None',
582
+ 'Centronics',
583
+ 'Mini Centronics',
584
+ 'Proprietary',
585
+ 'DB-25 male',
586
+ 'DB-25 female',
587
+ 'DB-15 male',
588
+ 'DB-15 female',
589
+ 'DB-9 male',
590
+ 'DB-9 female',
591
+ 'RJ-11',
592
+ 'RJ-45',
593
+ '50 Pin MiniSCSI',
594
+ 'Mini DIN',
595
+ 'Micro DIN',
596
+ 'PS/2',
597
+ 'Infrared',
598
+ 'HP-HIL',
599
+ 'Access Bus (USB)',
600
+ 'SSA SCSI',
601
+ 'Circular DIN-8 male',
602
+ 'Circular DIN-8 female',
603
+ 'On Board IDE',
604
+ 'On Board Floppy',
605
+ '9 Pin Dual Inline (pin 10 cut)',
606
+ '25 Pin Dual Inline (pin 26 cut)',
607
+ '50 Pin Dual Inline',
608
+ '68 Pin Dual Inline',
609
+ 'On Board Sound Input From CD-ROM',
610
+ 'Mini Centronics Type-14',
611
+ 'Mini Centronics Type-26',
612
+ 'Mini Jack (headphones)',
613
+ 'BNC',
614
+ 'IEEE 1394',
615
+ 'SAS/SATA Plug Receptacle',
616
+ 'USB Type-C Receptacle',
617
+ 'PC-98',
618
+ 'PC-98 Hireso',
619
+ 'PC-H98',
620
+ 'PC-98 Note',
621
+ 'PC-98 Full',
622
+ 'Other'
623
+ ],
624
+ port_types: [
625
+ 'None',
626
+ 'Parallel Port XT/AT Compatible',
627
+ 'Parallel Port PS/2',
628
+ 'Parallel Port ECP',
629
+ 'Parallel Port EPP',
630
+ 'Parallel Port ECP/EPP',
631
+ 'Serial Port XT/AT Compatible',
632
+ 'Serial Port 16450 Compatible',
633
+ 'Serial Port 16550 Compatible',
634
+ 'Serial Port 16550A Compatible',
635
+ 'SCSI Port',
636
+ 'MIDI Port',
637
+ 'Joystick Port',
638
+ 'Keyboard Port',
639
+ 'Mouse Port',
640
+ 'SSA SCSI',
641
+ 'USB',
642
+ 'Firewire (IEEE P1394)',
643
+ 'PCMCIA Type I',
644
+ 'PCMCIA Type II',
645
+ 'PCMCIA Type III',
646
+ 'Cardbus',
647
+ 'Access Bus Port',
648
+ 'SCSI II',
649
+ 'SCSI Wide',
650
+ 'PC-98',
651
+ 'PC-98 Hireso',
652
+ 'PC-H98',
653
+ 'Video Port',
654
+ 'Audio Port',
655
+ 'Modem Port',
656
+ 'Network Port',
657
+ 'SATA',
658
+ 'SAS'
659
+ ]
660
+ },
661
+ 'System Slots' => {
662
+ slot_type: [
663
+ 'Other',
664
+ 'Unknown',
665
+ 'ISA',
666
+ 'MCA',
667
+ 'EISA',
668
+ 'PCI',
669
+ 'PC Card (PCMCIA)',
670
+ 'VLB',
671
+ 'Proprietary',
672
+ 'Processor Card',
673
+ 'Proprietary Memory Card',
674
+ 'I/O Riser Card',
675
+ 'NuBus',
676
+ 'PCI-66',
677
+ 'AGP',
678
+ 'AGP 2x',
679
+ 'AGP 4x',
680
+ 'PCI-X',
681
+ 'AGP 8x',
682
+ 'M.2 Socket 1-DP',
683
+ 'M.2 Socket 1-SD',
684
+ 'M.2 Socket 2',
685
+ 'M.2 Socket 3',
686
+ 'MXM Type I',
687
+ 'MXM Type II',
688
+ 'MXM Type III',
689
+ 'MXM Type III-HE',
690
+ 'MXM Type IV',
691
+ 'MXM 3.0 Type A',
692
+ 'MXM 3.0 Type B',
693
+ 'PCI Express 2 SFF-8639 (U.2)',
694
+ 'PCI Express 3 SFF-8639 (U.2)',
695
+ 'PCI Express Mini 52-pin with bottom-side keep-outs',
696
+ 'PCI Express Mini 52-pin without bottom-side keep-outs',
697
+ 'PCI Express Mini 76-pin',
698
+ 'PCI Express 4 SFF-8639 (U.2)',
699
+ 'PCI Express 5 SFF-8639 (U.2)',
700
+ 'OCP NIC 3.0 Small Form Factor (SFF)',
701
+ 'OCP NIC 3.0 Large Form Factor (LFF)',
702
+ 'OCP NIC Prior to 3.0',
703
+ 'CXL FLexbus 1.0',
704
+ 'PC-98/C20',
705
+ 'PC-98/C24',
706
+ 'PC-98/E',
707
+ 'PC-98/Local Bus',
708
+ 'PC-98/Card',
709
+ 'PCI Express',
710
+ 'PCI Express x1',
711
+ 'PCI Express x2',
712
+ 'PCI Express x4',
713
+ 'PCI Express x8',
714
+ 'PCI Express x16',
715
+ 'PCI Express 2',
716
+ 'PCI Express 2 x1',
717
+ 'PCI Express 2 x2',
718
+ 'PCI Express 2 x4',
719
+ 'PCI Express 2 x8',
720
+ 'PCI Express 2 x16',
721
+ 'PCI Express 3',
722
+ 'PCI Express 3 x1',
723
+ 'PCI Express 3 x2',
724
+ 'PCI Express 3 x4',
725
+ 'PCI Express 3 x8',
726
+ 'PCI Express 3 x16',
727
+ 'PCI Express 4',
728
+ 'PCI Express 4 x1',
729
+ 'PCI Express 4 x2',
730
+ 'PCI Express 4 x4',
731
+ 'PCI Express 4 x8',
732
+ 'PCI Express 4 x16',
733
+ 'PCI Express 5',
734
+ 'PCI Express 5 x1',
735
+ 'PCI Express 5 x2',
736
+ 'PCI Express 5 x4',
737
+ 'PCI Express 5 x8',
738
+ 'PCI Express 5 x16',
739
+ 'PCI Express 6+',
740
+ 'EDSFF E1',
741
+ 'EDSFF E3'
742
+ ],
743
+ slot_width: [
744
+ '8-bit',
745
+ '16-bit',
746
+ '32-bit',
747
+ '64-bit',
748
+ '128-bit',
749
+ 'x1',
750
+ 'x2',
751
+ 'x4',
752
+ 'x8',
753
+ 'x12',
754
+ 'x16',
755
+ 'x32'
756
+ ],
757
+ current_usage: [
758
+ 'Other',
759
+ 'Unknown',
760
+ 'Available',
761
+ 'In Use',
762
+ 'Unavailable'
763
+ ],
764
+ slot_length: [
765
+ 'Other',
766
+ 'Unknown',
767
+ 'Short',
768
+ 'Long',
769
+ '2.5" drive form factor',
770
+ '3.5" drive form factor'
771
+ ],
772
+ slot_characteristics1: [
773
+ '5.0 V is provided',
774
+ '3.3 V is provided',
775
+ 'Opening is shared',
776
+ 'PC Card-16 is supported',
777
+ 'Cardbus is supported',
778
+ 'Zoom Video is supported',
779
+ 'Modem ring resume is supported'
780
+ ],
781
+ slot_characteristics2: [
782
+ 'PME signal is supported',
783
+ 'Hot-plug devices are supported',
784
+ 'SMBus signal is supported',
785
+ 'PCIe slot bifurcation is supported',
786
+ 'Async/surprise removal is supported',
787
+ 'Flexbus slot, CXL 1.0 capable',
788
+ 'Flexbus slot, CXL 2.0 capable',
789
+ 'Unknown',
790
+ 'None'
791
+ ]
792
+ },
793
+ 'On Board Devices' => {
794
+ device_types: [
795
+ 'Other',
796
+ 'Unknown',
797
+ 'Video',
798
+ 'SCSI Controller',
799
+ 'Ethernet',
800
+ 'Token Ring',
801
+ 'Sound',
802
+ 'PATA Controller',
803
+ 'SATA Controller',
804
+ 'SAS Controller'
805
+ ]
806
+ },
807
+ 'BIOS Language' => {
808
+ format: [
809
+ 'Abbreviated',
810
+ 'Long'
811
+ ]
812
+ },
813
+ 'Physical Memory Array' => {
814
+ location: [
815
+ 'Other',
816
+ 'Unknown',
817
+ 'System Board Or Motherboard',
818
+ 'ISA Add-on Card',
819
+ 'EISA Add-on Card',
820
+ 'PCI Add-on Card',
821
+ 'MCA Add-on Card',
822
+ 'PCMCIA Add-on Card',
823
+ 'Proprietary Add-on Card',
824
+ 'NuBus',
825
+ 'PC-98/C20 Add-on Card',
826
+ 'PC-98/C24 Add-on Card',
827
+ 'PC-98/E Add-on Card',
828
+ 'PC-98/Local Bus Add-on Card',
829
+ 'CXL Flexbus 1.0'
830
+ ],
831
+ use: [
832
+ 'Other',
833
+ 'Unknown',
834
+ 'System Memory',
835
+ 'Video Memory',
836
+ 'Flash Memory',
837
+ 'Non-volatile RAM',
838
+ 'Cache Memory'
839
+ ],
840
+ error_correction_types: [
841
+ 'Other',
842
+ 'Unknown',
843
+ 'None',
844
+ 'Parity',
845
+ 'Single-bit ECC',
846
+ 'Multi-bit ECC',
847
+ 'CRC'
848
+ ]
849
+ },
850
+ 'Memory Device' => {
851
+ form_factor: [
852
+ 'Other',
853
+ 'Unknown',
854
+ 'SIMM',
855
+ 'SIP',
856
+ 'Chip',
857
+ 'DIP',
858
+ 'ZIP',
859
+ 'Proprietary Card',
860
+ 'DIMM',
861
+ 'TSOP',
862
+ 'Row Of Chips',
863
+ 'RIMM',
864
+ 'SODIMM',
865
+ 'SRIMM',
866
+ 'FB-DIMM',
867
+ 'Die'
868
+ ],
869
+ type: [
870
+ 'Other',
871
+ 'Unknown',
872
+ 'DRAM',
873
+ 'EDRAM',
874
+ 'VRAM',
875
+ 'SRAM',
876
+ 'RAM',
877
+ 'ROM',
878
+ 'Flash',
879
+ 'EEPROM',
880
+ 'FEPROM',
881
+ 'EPROM',
882
+ 'CDRAM',
883
+ '3DRAM',
884
+ 'SDRAM',
885
+ 'SGRAM',
886
+ 'RDRAM',
887
+ 'DDR',
888
+ 'DDR2',
889
+ 'DDR2 FB-DIMM',
890
+ 'Reserved',
891
+ 'Reserved',
892
+ 'Reserved',
893
+ 'DDR3',
894
+ 'FBD2',
895
+ 'DDR4',
896
+ 'LPDDR',
897
+ 'LPDDR2',
898
+ 'LPDDR3',
899
+ 'LPDDR4',
900
+ 'Logical non-volatile device',
901
+ 'HBM',
902
+ 'HBM2',
903
+ 'DDR5',
904
+ 'LPDDR5'
905
+ ],
906
+ type_detail: [
907
+ 'Other',
908
+ 'Unknown',
909
+ 'Fast-paged',
910
+ 'Static Column',
911
+ 'Pseudo-static',
912
+ 'RAMBus',
913
+ 'Synchronous',
914
+ 'CMOS',
915
+ 'EDO',
916
+ 'Window DRAM',
917
+ 'Cache DRAM',
918
+ 'Non-Volatile',
919
+ 'Registered (Buffered)',
920
+ 'Unbuffered (Unregistered)',
921
+ 'LRDIMM'
922
+ ],
923
+ technology: [
924
+ 'Other',
925
+ 'Unknown',
926
+ 'DRAM',
927
+ 'NVDIMM-N',
928
+ 'NVDIMM-F',
929
+ 'NVDIMM-P',
930
+ 'Intel Optane DC persistent memory'
931
+ ],
932
+ opearting_mode_capability: [
933
+ 'Other',
934
+ 'Unknown',
935
+ 'Volatile memory',
936
+ 'Byte-accessible persistent memory',
937
+ 'Block-accessible persistent memory',
938
+ 'None'
939
+ ]
940
+ },
941
+ 'Memory Error' => {
942
+ type: [
943
+ 'Other',
944
+ 'Unknown',
945
+ 'OK',
946
+ 'Bad Read',
947
+ 'Parity Error',
948
+ 'Single-bit Error',
949
+ 'Double-bit Error',
950
+ 'Multi-bit Error',
951
+ 'Nibble Error',
952
+ 'Checksum Error',
953
+ 'CRC Error',
954
+ 'Corrected Single-bit Error',
955
+ 'Corrected Error',
956
+ 'Uncorrectable Error'
957
+ ],
958
+ error_granularity: [
959
+ 'Other',
960
+ 'Unknown',
961
+ 'Device Level',
962
+ 'Memory Partition Level'
963
+ ],
964
+ error_operation: [
965
+ 'Other',
966
+ 'Unknown',
967
+ 'Read',
968
+ 'Write',
969
+ 'Partial Write'
970
+ ]
971
+ },
972
+ 'Built-in Pointing Device' => {
973
+ type: [
974
+ 'Other',
975
+ 'Unknown',
976
+ 'Mouse',
977
+ 'Track Ball',
978
+ 'Track Point',
979
+ 'Glide Point',
980
+ 'Touch Pad',
981
+ 'Touch Screen',
982
+ 'Optical Sensor'
983
+ ],
984
+ interface: [
985
+ 'Other',
986
+ 'Unknown',
987
+ 'Serial',
988
+ 'PS/2',
989
+ 'Infrared',
990
+ 'HIP-HIL',
991
+ 'Bus Mouse',
992
+ 'ADB (Apple Desktop Bus)',
993
+ 'Bus mouse DB-9',
994
+ 'Bus mouse micro-DIN',
995
+ 'USB'
996
+ ]
997
+ },
998
+ 'Portable Battery' => {
999
+ chemistry: [
1000
+ 'Other',
1001
+ 'Unknown',
1002
+ 'Lead Acid',
1003
+ 'Nickel Cadmium',
1004
+ 'Nickel Metal Hydride',
1005
+ 'Lithium Ion',
1006
+ 'Zinc Air',
1007
+ 'Lithium Polymer'
1008
+ ]
1009
+ },
1010
+ 'System Reset' => {
1011
+ boot_option: [
1012
+ 'Operating System',
1013
+ 'System Utilities',
1014
+ 'Do Not Reboot'
1015
+ ]
1016
+ },
1017
+ 'Hardware Security' => {
1018
+ status: [
1019
+ 'Disabled',
1020
+ 'Enabled',
1021
+ 'Not Implemented',
1022
+ 'Unknown'
1023
+ ]
1024
+ },
1025
+ 'Voltage Probe' => {
1026
+ location: [
1027
+ 'Other',
1028
+ 'Unknown',
1029
+ 'Processor',
1030
+ 'Disk',
1031
+ 'Peripheral Bay',
1032
+ 'System Management Module',
1033
+ 'Motherboard',
1034
+ 'Memory Module',
1035
+ 'Processor Module',
1036
+ 'Power Unit',
1037
+ 'Add-in Card'
1038
+ ],
1039
+ status: [
1040
+ 'Other',
1041
+ 'Unknown',
1042
+ 'OK',
1043
+ 'Non-critical',
1044
+ 'Critical',
1045
+ 'Non-recoverable'
1046
+ ]
1047
+ },
1048
+ 'Cooling Device' => {
1049
+ type: [
1050
+ 'Other',
1051
+ 'Unknown',
1052
+ 'Fan',
1053
+ 'Centrifugal Blower',
1054
+ 'Chip Fan',
1055
+ 'Cabinet Fan',
1056
+ 'Power Supply Fan',
1057
+ 'Heat Pipe',
1058
+ 'Integrated Refrigeration',
1059
+ 'Active Cooling',
1060
+ 'Passive Cooling'
1061
+ ],
1062
+ status: [
1063
+ 'Other',
1064
+ 'Unknown',
1065
+ 'OK',
1066
+ 'Non-critical',
1067
+ 'Critical',
1068
+ 'Non-recoverable'
1069
+ ]
1070
+ },
1071
+ 'Temperature Probe' => {
1072
+ status: [
1073
+ 'Other',
1074
+ 'Unknown',
1075
+ 'OK',
1076
+ 'Non-critical',
1077
+ 'Critical',
1078
+ 'Non-recoverable'
1079
+ ],
1080
+ location: [
1081
+ 'Other',
1082
+ 'Unknown',
1083
+ 'Processor',
1084
+ 'Disk',
1085
+ 'Peripheral Bay',
1086
+ 'System Management Module',
1087
+ 'Motherboard',
1088
+ 'Memory Module',
1089
+ 'Processor Module',
1090
+ 'Power Unit',
1091
+ 'Add-in Card',
1092
+ 'Front Panel Board',
1093
+ 'Back Panel Board',
1094
+ 'Power System Board',
1095
+ 'Drive Back Plane'
1096
+ ]
1097
+ },
1098
+ 'Electrical Current Probe' => {
1099
+ status: [
1100
+ 'Other',
1101
+ 'Unknown',
1102
+ 'OK',
1103
+ 'Non-critical',
1104
+ 'Critical',
1105
+ 'Non-recoverable'
1106
+ ],
1107
+ location: [
1108
+ 'Other',
1109
+ 'Unknown',
1110
+ 'Processor',
1111
+ 'Disk',
1112
+ 'Peripheral Bay',
1113
+ 'System Management Module',
1114
+ 'Motherboard',
1115
+ 'Memory Module',
1116
+ 'Processor Module',
1117
+ 'Power Unit',
1118
+ 'Add-in Card'
1119
+ ]
1120
+ },
1121
+ 'System Boot' => {
1122
+ status: [
1123
+ 'No errors detected',
1124
+ 'No bootable media',
1125
+ 'Operating system failed to load',
1126
+ 'Firmware-detected hardware failure',
1127
+ 'Operating system-detected hardware failure',
1128
+ 'User-requested boot',
1129
+ 'System security violation',
1130
+ 'Previously-requested image',
1131
+ 'System watchdog timer expired'
1132
+ ]
1133
+ },
1134
+ 'Management Device' => {
1135
+ type: [
1136
+ 'Other',
1137
+ 'Unknown',
1138
+ 'LM75',
1139
+ 'LM78',
1140
+ 'LM79',
1141
+ 'LM80',
1142
+ 'LM81',
1143
+ 'ADM9240',
1144
+ 'DS1780',
1145
+ 'MAX1617',
1146
+ 'GL518SM',
1147
+ 'W83781D',
1148
+ 'HT82H791'
1149
+ ],
1150
+ address_type: [
1151
+ 'Other',
1152
+ 'Unknown',
1153
+ 'I/O Port',
1154
+ 'Memory',
1155
+ 'SMBus'
1156
+ ]
1157
+ },
1158
+ 'Memory Channel' => {
1159
+ type: [
1160
+ 'Other',
1161
+ 'Unknown',
1162
+ 'RamBus',
1163
+ 'SyncLink'
1164
+ ]
1165
+ },
1166
+ 'IPMI Device' => {
1167
+ type: [
1168
+ 'Unknown',
1169
+ 'KCS (Keyboard Control Style)',
1170
+ 'SMIC (Server Management Interface Chip)',
1171
+ 'BT (Block Transfer)',
1172
+ 'SSIF (SMBus System Interface)'
1173
+ ],
1174
+ register_spacing: [
1175
+ 'Successive Byte Boundaries',
1176
+ '32-bit Boundaries',
1177
+ '16-byte Boundaries'
1178
+ ]
1179
+ },
1180
+ 'System Power Supply' => {
1181
+ type: [
1182
+ 'Other',
1183
+ 'Unknown',
1184
+ 'Linear',
1185
+ 'Switching',
1186
+ 'Battery',
1187
+ 'UPS',
1188
+ 'Converter',
1189
+ 'Regulator'
1190
+ ],
1191
+ status: [
1192
+ 'Other',
1193
+ 'Unknown',
1194
+ 'OK',
1195
+ 'Non-critical',
1196
+ 'Critical',
1197
+ 'Non-recoverable'
1198
+ ],
1199
+ switching: [
1200
+ 'Other',
1201
+ 'Unknown',
1202
+ 'Manual',
1203
+ 'Auto-switch',
1204
+ 'Wide Range',
1205
+ 'N/A'
1206
+ ]
1207
+ },
1208
+ 'Management Controller Host Interface' => {
1209
+ type: [
1210
+ 'KCS: Keyboard Controller Style',
1211
+ '8250 UART Register Compatible',
1212
+ '16450 UART Register Compatible',
1213
+ '16550/16550A UART Register Compatible',
1214
+ '16650/16650A UART Register Compatible',
1215
+ '16750/16750A UART Register Compatible',
1216
+ '16850/16850A UART Register Compatible'
1217
+ ],
1218
+ device_type: [
1219
+ 'USB',
1220
+ 'PCI/PCIe'
1221
+ ],
1222
+ protocol_record_type: [
1223
+ 'Reserved',
1224
+ 'IPMI',
1225
+ 'MCTP',
1226
+ 'Redfish over IP'
1227
+ ],
1228
+ protocol_assignment_type: [
1229
+ 'Unknown',
1230
+ 'Static',
1231
+ 'DHCP',
1232
+ 'AutoConf',
1233
+ 'Host Selected'
1234
+ ],
1235
+ address_type: [
1236
+ 'Unknown',
1237
+ 'IPv4',
1238
+ 'IPv6'
1239
+ ]
1240
+ },
1241
+ 'TPM Device' => {
1242
+ characteristics: [
1243
+ 'TPM Device characteristics not supported',
1244
+ 'Family configurable via firmware update',
1245
+ 'Family configurable via platform software support',
1246
+ 'Family configurable via OEM proprietary mechanism'
1247
+ ]
1248
+ }
1249
+ }
1250
+
1251
+ @dmi_types = {
1252
+ 'BIOS' => 0,
1253
+ 'System' => 1,
1254
+ 'Baseboard' => 2,
1255
+ 'Chassis' => 3,
1256
+ 'Processor' => 4,
1257
+ 'Memory Controller' => 5,
1258
+ 'Memory Module' => 6,
1259
+ 'Cache' => 7,
1260
+ 'Port Connector' => 8,
1261
+ 'System Slots' => 9,
1262
+ 'On Board Devices' => 10,
1263
+ 'OEM Strings' => 11,
1264
+ 'System Configuration Options' => 12,
1265
+ 'BIOS Language' => 13,
1266
+ 'Group Associations' => 14,
1267
+ 'System Event Log' => 15,
1268
+ 'Physical Memory Array' => 16,
1269
+ 'Memory Device' => 17,
1270
+ '32-bit Memory Error' => 18,
1271
+ 'Memory Array Mapped Address' => 19,
1272
+ 'Memory Device Mapped Address' => 20,
1273
+ 'Built-in Pointing Device' => 21,
1274
+ 'Portable Battery' => 22,
1275
+ 'System Reset' => 23,
1276
+ 'Hardware Security' => 24,
1277
+ 'System Power Controls' => 25,
1278
+ 'Voltage Probe' => 26,
1279
+ 'Cooling Device' => 27,
1280
+ 'Temperature Probe' => 28,
1281
+ 'Electrical Current Probe' => 29,
1282
+ 'Out-of-band Remote Access' => 30,
1283
+ 'Boot Integrity Services' => 31,
1284
+ 'System Boot' => 32,
1285
+ '64-bit Memory Error' => 33,
1286
+ 'Management Device' => 34,
1287
+ 'Management Device Component' => 35,
1288
+ 'Management Device Threshold Data' => 36,
1289
+ 'Memory Channel' => 37,
1290
+ 'IPMI Device' => 38,
1291
+ 'System Power Supply' => 39,
1292
+ 'Additional Information' => 40,
1293
+ 'Onboard Devices Extended Information' => 41,
1294
+ 'Management Controller Host Interface' => 42,
1295
+ 'TPM Device' => 43
1296
+ }
1297
+
1298
+ @dmi_types_inverted = {
1299
+ 0 => 'BIOS',
1300
+ 1 => 'System',
1301
+ 2 => 'Baseboard',
1302
+ 3 => 'Chassis',
1303
+ 4 => 'Processor',
1304
+ 5 => 'Memory Controller',
1305
+ 6 => 'Memory Module',
1306
+ 7 => 'Cache',
1307
+ 8 => 'Port Connector',
1308
+ 9 => 'System Slots',
1309
+ 10 => 'On Board Devices',
1310
+ 11 => 'OEM Strings',
1311
+ 12 => 'System Configuration Options',
1312
+ 13 => 'BIOS Language',
1313
+ 14 => 'Group Associations',
1314
+ 15 => 'System Event Log',
1315
+ 16 => 'Physical Memory Array',
1316
+ 17 => 'Memory Device',
1317
+ 18 => '32-bit Memory Error',
1318
+ 19 => 'Memory Array Mapped Address',
1319
+ 20 => 'Memory Device Mapped Address',
1320
+ 21 => 'Built-in Pointing Device',
1321
+ 22 => 'Portable Battery',
1322
+ 23 => 'System Reset',
1323
+ 24 => 'Hardware Security',
1324
+ 25 => 'System Power Controls',
1325
+ 26 => 'Voltage Probe',
1326
+ 27 => 'Cooling Device',
1327
+ 28 => 'Temperature Probe',
1328
+ 29 => 'Electrical Current Probe',
1329
+ 30 => 'Out-of-band Remote Access',
1330
+ 31 => 'Boot Integrity Services',
1331
+ 32 => 'System Boot',
1332
+ 33 => '64-bit Memory Error',
1333
+ 34 => 'Management Device',
1334
+ 35 => 'Management Device Component',
1335
+ 36 => 'Management Device Threshold Data',
1336
+ 37 => 'Memory Channel',
1337
+ 38 => 'IPMI Device',
1338
+ 39 => 'System Power Supply',
1339
+ 40 => 'Additional Information',
1340
+ 41 => 'Onboard Devices Extended Information',
1341
+ 42 => 'Management Controller Host Interface',
1342
+ 43 => 'TPM Device'
1343
+ }
1344
+
1345
+ def self.[](type)
1346
+ return unless valid?(type)
1347
+
1348
+ if type.instance_of?(Integer)
1349
+ @dmi_types_inverted[type]
1350
+ else
1351
+ @dmi_types[type]
1352
+ end
1353
+ end
1354
+
1355
+ def self.valid?(type)
1356
+ if type.instance_of?(Integer)
1357
+ @dmi_types_inverted.key?(type)
1358
+ elsif type.instance_of?(String)
1359
+ @dmi_types.key?(type)
1360
+ else
1361
+ raise ArgumentError, 'Invalid data type'
1362
+ end
1363
+ end
1364
+ end
1365
+ end
1366
+ end