code: func (w *wrapper) SetDevices(devs []DeviceConfiguration) (Waiter, error) {
  	w.mut.Lock()
  	defer w.mut.Unlock()
  
  	newCfg := w.cfg.Copy()
  	var replaced bool
  	for oldIndex := range devs {
  		replaced = false
  		for newIndex := range newCfg.Devices {
  			if newCfg.Devices[newIndex].DeviceID == devs[oldIndex].DeviceID {
  				newCfg.Devices[newIndex] = devs[oldIndex].Copy()
  				replaced = true
  				break
  			}
  		}
  		if !replaced {
  			newCfg.Devices = append(newCfg.Devices, devs[oldIndex].Copy())
  		}
  	}
  
  	return w.replaceLocked(newCfg)
  }
docs: // SetDevices adds new devices to the configuration, or overwrites existing
  // devices with the same ID.