@@ -134,12 +134,11 @@ func main() {
134
134
}
135
135
136
136
type boardPortJSON struct {
137
- Address string `json:"address"`
138
- Label string `json:"label,omitempty"`
139
- Prefs * properties.Map `json:"prefs,omitempty"`
140
- IdentificationPrefs * properties.Map `json:"identificationPrefs,omitempty"`
141
- Protocol string `json:"protocol,omitempty"`
142
- ProtocolLabel string `json:"protocolLabel,omitempty"`
137
+ Address string `json:"address"`
138
+ Label string `json:"label,omitempty"`
139
+ Protocol string `json:"protocol,omitempty"`
140
+ ProtocolLabel string `json:"protocolLabel,omitempty"`
141
+ Properties * properties.Map `json:"properties,omitempty"`
143
142
}
144
143
145
144
type listOutputJSON struct {
@@ -170,22 +169,18 @@ func outputList() {
170
169
171
170
func newBoardPortJSON (port * enumerator.PortDetails ) * boardPortJSON {
172
171
prefs := properties .NewMap ()
173
- identificationPrefs := properties .NewMap ()
174
172
portJSON := & boardPortJSON {
175
- Address : port .Name ,
176
- Label : port .Name ,
177
- Protocol : "serial" ,
178
- ProtocolLabel : "Serial Port" ,
179
- Prefs : prefs ,
180
- IdentificationPrefs : identificationPrefs ,
173
+ Address : port .Name ,
174
+ Label : port .Name ,
175
+ Protocol : "serial" ,
176
+ ProtocolLabel : "Serial Port" ,
177
+ Properties : prefs ,
181
178
}
182
179
if port .IsUSB {
183
180
portJSON .ProtocolLabel = "Serial Port (USB)"
184
- portJSON .Prefs .Set ("vendorId" , "0x" + port .VID )
185
- portJSON .Prefs .Set ("productId" , "0x" + port .PID )
186
- portJSON .Prefs .Set ("serialNumber" , port .SerialNumber )
187
- portJSON .IdentificationPrefs .Set ("pid" , "0x" + port .PID )
188
- portJSON .IdentificationPrefs .Set ("vid" , "0x" + port .VID )
181
+ portJSON .Properties .Set ("vid" , "0x" + port .VID )
182
+ portJSON .Properties .Set ("pid" , "0x" + port .PID )
183
+ portJSON .Properties .Set ("serialNumber" , port .SerialNumber )
189
184
}
190
185
return portJSON
191
186
}
0 commit comments