From 5769f9680411996fc4e01d881f5db27d0c365bab Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sun, 11 Dec 2016 23:46:15 +0100 Subject: [PATCH] Temporarily remove USB manufacturer/product info I need to find a better way to obtain those infos. --- serial.go | 5 +++-- usb_linux.go | 20 ++++++++++---------- usb_windows.go | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/serial.go b/serial.go index 91b3332..54a1703 100644 --- a/serial.go +++ b/serial.go @@ -63,8 +63,9 @@ type PortDetails struct { VID string PID string SerialNumber string - Manufacturer string - Product string + + // Manufacturer string + // Product string } // GetDetailedPortsList retrieve ports details like USB VID/PID. diff --git a/usb_linux.go b/usb_linux.go index 35355bb..c671140 100644 --- a/usb_linux.go +++ b/usb_linux.go @@ -74,21 +74,21 @@ func parseUSBSysFS(usbDevicePath string, details *PortDetails) error { if err != nil { return err } - manufacturer, err := readLine(filepath.Join(usbDevicePath, "manufacturer")) - if err != nil { - return err - } - product, err := readLine(filepath.Join(usbDevicePath, "product")) - if err != nil { - return err - } + //manufacturer, err := readLine(filepath.Join(usbDevicePath, "manufacturer")) + //if err != nil { + // return err + //} + //product, err := readLine(filepath.Join(usbDevicePath, "product")) + //if err != nil { + // return err + //} details.IsUSB = true details.VID = vid details.PID = pid details.SerialNumber = serial - details.Manufacturer = manufacturer - details.Product = product + //details.Manufacturer = manufacturer + //details.Product = product return nil } diff --git a/usb_windows.go b/usb_windows.go index c053297..1e3a6c4 100644 --- a/usb_windows.go +++ b/usb_windows.go @@ -295,7 +295,7 @@ func retrievePortDetailsFromDevInfo(device *deviceInfo, details *PortDetails) er friendlyNameP := (*byte)(unsafe.Pointer(&friendlyName[0])) friendlyNameSize := uint32(len(friendlyName) * 2) if setupDiGetDeviceRegistryProperty(device.set, &device.data, spdrpDeviceDesc /* spdrpFriendlyName */, nil, friendlyNameP, &friendlyNameSize, nil) { - details.Product = syscall.UTF16ToString(friendlyName[:]) + //details.Product = syscall.UTF16ToString(friendlyName[:]) } return nil