@@ -134,12 +134,11 @@ func main() {
134134}
135135
136136type 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"`
143142}
144143
145144type listOutputJSON struct {
@@ -170,22 +169,18 @@ func outputList() {
170169
171170func newBoardPortJSON (port * enumerator.PortDetails ) * boardPortJSON {
172171 prefs := properties .NewMap ()
173- identificationPrefs := properties .NewMap ()
174172 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 ,
181178 }
182179 if port .IsUSB {
183180 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 )
189184 }
190185 return portJSON
191186}
0 commit comments