Added doc for new USB Product field (windows-only)
This commit is contained in:
@@ -18,6 +18,9 @@ type PortDetails struct {
|
||||
SerialNumber string
|
||||
|
||||
// Manufacturer 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
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
//
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import "log"
|
||||
import "go.bug.st/serial/enumerator"
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"go.bug.st/serial/enumerator"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ports, err := enumerator.GetDetailedPortsList()
|
||||
@@ -29,9 +32,12 @@ func main() {
|
||||
}
|
||||
for _, port := range ports {
|
||||
fmt.Printf("Port: %s\n", port.Name)
|
||||
if port.Product != "" {
|
||||
fmt.Printf(" Product Name: %s\n", port.Product)
|
||||
}
|
||||
if port.IsUSB {
|
||||
fmt.Printf(" USB ID %s:%s\n", port.VID, port.PID)
|
||||
fmt.Printf(" USB serial %s\n", port.SerialNumber)
|
||||
fmt.Printf(" USB ID : %s:%s\n", port.VID, port.PID)
|
||||
fmt.Printf(" USB serial : %s\n", port.SerialNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user