func()

in plugins/internal/discovery/device_discovery.go [157:188]


func (d *DeviceDiscovery) DiscoverDevices(filter DeviceFilter, includeIntegrated bool, includeDetachable bool) error {

	// Attempt to perform device discovery
	result, _, _ := procDiscoverDevices.Call(d.handle, uintptr(filter), d.booleanArgument(includeIntegrated), d.booleanArgument(includeDetachable))
	if int32(result) == -1 {
		return d.getLastErrorMessage()
	}

	// Determine the number of discovered devices
	numDevices, err := d.getNumDevices()
	if err != nil {
		return err
	}

	// Clear the existing list of devices
	d.Devices = []*Device{}

	// Retrieve the details of each device in turn
	for index := 0; index < int(numDevices); index += 1 {

		// Attempt to retrieve the device details
		device, err := d.getDevice(index)
		if err != nil {
			return err
		}

		// Add the device to our list
		d.Devices = append(d.Devices, device)
	}

	return nil
}