func findUSBDevice(vendor, product int) (string, error) {
	device := ""
	err := filepath.Walk("/sys/bus/usb/devices", func(path string, info os.FileInfo, err error) error {
		if device != "" {
			return filepath.SkipDir
		}
		if err != nil {
			return err
		}
		if hasID(path, "idVendor", vendor) && hasID(path, "idProduct", product) {
			device = path
			return filepath.SkipDir
		}
		return nil
	})
	if err != nil && err != filepath.SkipDir {
		return device, err
	}
	if device == "" {
		return device, DeviceNotFoundError{Vendor: vendor, Product: product}
	}
	// filepath.Walk won't follow symlinks, so expand it first.
	return filepath.EvalSymlinks(device)
}
// findUSBDevice returns the /sys/bus/usb/devices/... path for
// the USB device with the given vendor and product identifiers.
findUSBDevice returns the /sys/bus/usb/devices/... path for
the USB device with the given vendor and product identifiers.
// findUSBDevice returns the / sys / bus / usb / devices / ... path for // the USB device with the given vendor and product identifiers .
func findUSBDevice(vendor, product int) (string, error) {
	device := ""
	err := filepath.Walk("/sys/bus/usb/devices", func(path string, info os.FileInfo, err error) error {
		if device != "" {
			return filepath.SkipDir
		}
		if err != nil {
			return err
		}
		if hasID(path, "idVendor", vendor) && hasID(path, "idProduct", product) {
			device = path
			return filepath.SkipDir
		}
		return nil
	})
	if err != nil && err != filepath.SkipDir {
		return device, err
	}
	if device == "" {
		return device, DeviceNotFoundError{Vendor: vendor, Product: product}
	}
	return filepath.EvalSymlinks(device)
}
func findUSBDevice ( vendor , product int ) ( string , error ) { device := " " err := filepath . Walk ( " " , func ( path string , info os . FileInfo , err error ) error { if device != " " { return filepath . SkipDir } if err != nil { return err } if hasID ( path , " " , vendor ) && hasID ( path , " " , product ) { device = path return filepath . SkipDir } return nil } ) if err != nil && err != filepath . SkipDir { return device , err } if device == " " { return device , DeviceNotFoundError { Vendor : vendor , Product : product } } return filepath . EvalSymlinks ( device ) }
findUSBDevice returns the /sys/bus/usb/devices/... path for
the USB device with the given vendor and product identifiers.
findUSBDevice returns the / sys / bus / usb / devices / ... path for the USB device with the given vendor and product identifiers .
// filepath.Walk won't follow symlinks, so expand it first.