-
Notifications
You must be signed in to change notification settings - Fork 3
/
type_08_port.go
228 lines (216 loc) · 5.06 KB
/
type_08_port.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
package dmi
import (
"fmt"
)
type PortConnectorType byte
const (
PortConnectorTypeNone PortConnectorType = iota
PortConnectorTypeCentronics
PortConnectorTypeMiniCentronics
PortConnectorTypeProprietary
PortConnectorTypeDB_25pinmale
PortConnectorTypeDB_25pinfemale
PortConnectorTypeDB_15pinmale
PortConnectorTypeDB_15pinfemale
PortConnectorTypeDB_9pinmale
PortConnectorTypeDB_9pinfemale
PortConnectorTypeRJ_11
PortConnectorTypeRJ_45
PortConnectorType50_pinMiniSCSI
PortConnectorTypeMini_DIN
PortConnectorTypeMicro_DIN
PortConnectorTypePS2
PortConnectorTypeInfrared
PortConnectorTypeHP_HIL
PortConnectorTypeAccessBusUSB
PortConnectorTypeSSASCSI
PortConnectorTypeCircularDIN_8male
PortConnectorTypeCircularDIN_8female
PortConnectorTypeOnBoardIDE
PortConnectorTypeOnBoardFloppy
PortConnectorType9_pinDualInlinepin10cut
PortConnectorType25_pinDualInlinepin26cut
PortConnectorType50_pinDualInline
PortConnectorType68_pinDualInline
PortConnectorTypeOnBoardSoundInputfromCD_ROM
PortConnectorTypeMini_CentronicsType_14
PortConnectorTypeMini_CentronicsType_26
PortConnectorTypeMini_jackheadphones
PortConnectorTypeBNC
PortConnectorType1394
PortConnectorTypeSASSATAPlugReceptacle
PortConnectorTypePC_98
PortConnectorTypePC_98Hireso
PortConnectorTypePC_H98
PortConnectorTypePC_98Note
PortConnectorTypePC_98Full
PortConnectorTypeOther
)
func (p PortConnectorType) String() string {
types := [...]string{
"None",
"Centronics",
"Mini Centronics",
"Proprietary",
"DB-25 pin male",
"DB-25 pin female",
"DB-15 pin male",
"DB-15 pin female",
"DB-9 pin male",
"DB-9 pin female",
"RJ-11",
"RJ-45",
"50-pin MiniSCSI",
"Mini-DIN",
"Micro-DIN",
"PS/2",
"Infrared",
"HP-HIL",
"Access Bus (USB)",
"SSA SCSI",
"Circular DIN-8 male",
"Circular DIN-8 female",
"On Board IDE",
"On Board Floppy",
"9-pin Dual Inline (pin 10 cut)",
"25-pin Dual Inline (pin 26 cut)",
"50-pin Dual Inline",
"68-pin Dual Inline",
"On Board Sound Input from CD-ROM",
"Mini-Centronics Type-14",
"Mini-Centronics Type-26",
"Mini-jack (headphones)",
"BNC",
"1394",
"SAS/SATA Plug Receptacle",
"PC-98",
"PC-98Hireso",
"PC-H98",
"PC-98Note",
"PC-98Full",
"Other",
}
return types[p]
}
type PortType byte
const (
PortTypeNone PortType = iota
PortTypeParallelPortXTATCompatible
PortTypeParallelPortPS2
PortTypeParallelPortECP
PortTypeParallelPortEPP
PortTypeParallelPortECPEPP
PortTypeSerialPortXTATCompatible
PortTypeSerialPort16450Compatible
PortTypeSerialPort16550Compatible
PortTypeSerialPort16550ACompatible
PortTypeSCSIPort
PortTypeMIDIPort
PortTypeJoyStickPort
PortTypeKeyboardPort
PortTypeMousePort
PortTypeSSASCSI
PortTypeUSB
PortTypeFireWireIEEEP1394
PortTypePCMCIATypeI2
PortTypePCMCIATypeII
PortTypePCMCIATypeIII
PortTypeCardbus
PortTypeAccessBusPort
PortTypeSCSIII
PortTypeSCSIWide
PortTypePC_98
PortTypePC_98_Hireso
PortTypePC_H98
PortTypeVideoPort
PortTypeAudioPort
PortTypeModemPort
PortTypeNetworkPort
PortTypeSATA
PortTypeSAS
PortType8251Compatible
PortType8251FIFOCompatible
PortTypeOther
)
func (p PortType) String() string {
types := [...]string{
"None",
"Parallel Port XT/AT Compatible",
"Parallel Port PS/2",
"Parallel Port ECP",
"Parallel Port EPP",
"Parallel Port ECP/EPP",
"Serial Port XT/AT Compatible",
"Serial Port 16450 Compatible",
"Serial Port 16550 Compatible",
"Serial Port 16550A Compatible",
"SCSI Port",
"MIDI Port",
"Joy Stick Port",
"Keyboard Port",
"Mouse Port",
"SSA SCSI",
"USB",
"FireWire (IEEE P1394)",
"PCMCIA Type I2",
"PCMCIA Type II",
"PCMCIA Type III",
"Cardbus",
"Access Bus Port",
"SCSI II",
"SCSI Wide",
"PC-98",
"PC-98-Hireso",
"PC-H98",
"Video Port",
"Audio Port",
"Modem Port",
"Network Port",
"SATA",
"SAS",
"8251 Compatible",
"8251 FIFO Compatible",
" Other",
}
return types[p]
}
type PortInformation struct {
infoCommon
InternalReferenceDesignator string
InternalConnectorType PortConnectorType
ExternalReferenceDesignator string
ExternalConnectorType PortConnectorType
Type PortType
}
func (p PortInformation) String() string {
return fmt.Sprintf("Port Information\n"+
"\tInternal Reference Designator: %s\n"+
"\tInternal Connector Type: %s\n"+
"\tExternal Reference Designator: %s\n"+
"\tExternal Connector Type: %s\n"+
"\tType: %s",
p.InternalReferenceDesignator,
p.InternalConnectorType,
p.ExternalReferenceDesignator,
p.ExternalConnectorType,
p.Type)
}
func newPortInformation(h dmiHeader) dmiTyper {
data := h.data
return &PortInformation{
InternalReferenceDesignator: h.FieldString(int(data[0x04])),
InternalConnectorType: PortConnectorType(data[0x05]),
ExternalReferenceDesignator: h.FieldString(int(data[0x06])),
ExternalConnectorType: PortConnectorType(data[0x07]),
Type: PortType(data[0x08]),
}
}
func GetPortInformation() *PortInformation {
if d, ok := gdmi[SMBIOSStructureTypePortConnector]; ok {
return d.(*PortInformation)
}
return nil
}
func init() {
addTypeFunc(SMBIOSStructureTypePortConnector, newPortInformation)
}