Added doc for new USB Product field (windows-only)
This commit is contained in:
@@ -18,7 +18,10 @@ type PortDetails struct {
|
|||||||
SerialNumber string
|
SerialNumber string
|
||||||
|
|
||||||
// Manufacturer string
|
// Manufacturer string
|
||||||
Product string
|
|
||||||
|
// Product is an OS-dependent string that describes the serial port, it may
|
||||||
|
// be not always available and it may be different across OS.
|
||||||
|
Product string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDetailedPortsList retrieve ports details like USB VID/PID.
|
// GetDetailedPortsList retrieve ports details like USB VID/PID.
|
||||||
|
|||||||
@@ -15,9 +15,12 @@
|
|||||||
//
|
//
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
import "log"
|
"fmt"
|
||||||
import "go.bug.st/serial/enumerator"
|
"log"
|
||||||
|
|
||||||
|
"go.bug.st/serial/enumerator"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ports, err := enumerator.GetDetailedPortsList()
|
ports, err := enumerator.GetDetailedPortsList()
|
||||||
@@ -29,9 +32,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
for _, port := range ports {
|
for _, port := range ports {
|
||||||
fmt.Printf("Port: %s\n", port.Name)
|
fmt.Printf("Port: %s\n", port.Name)
|
||||||
|
if port.Product != "" {
|
||||||
|
fmt.Printf(" Product Name: %s\n", port.Product)
|
||||||
|
}
|
||||||
if port.IsUSB {
|
if port.IsUSB {
|
||||||
fmt.Printf(" USB ID %s:%s\n", port.VID, port.PID)
|
fmt.Printf(" USB ID : %s:%s\n", port.VID, port.PID)
|
||||||
fmt.Printf(" USB serial %s\n", port.SerialNumber)
|
fmt.Printf(" USB serial : %s\n", port.SerialNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user