lxd/devices.go
func findNvidiaMinorOld() (string, error) {
	var minor string

	// For now, just handle most common case (single nvidia card)
	ents, err := ioutil.ReadDir("/dev")
	if err != nil {
		return "", err
	}

	rp := regexp.MustCompile("^nvidia([0-9]+)$")
	for _, ent := range ents {
		matches := rp.FindStringSubmatch(ent.Name())
		if matches == nil {
			continue
		}

		if minor != "" {
			return "", fmt.Errorf("No device minor index detected, and more than one NVIDIA card present")
		}
		minor = matches[1]
	}

	if minor == "" {
		return "", fmt.Errorf("No device minor index detected, and no NVIDIA card present")
	}

	return minor, nil
}
func findNvidiaMinorOld() (string, error) {
	var minor string

	// For now, just handle most common case (single nvidia card)
	ents, err := ioutil.ReadDir("/dev")
	if err != nil {
		return "", err
	}

	rp := regexp.MustCompile("^nvidia([0-9]+)$")
	for _, ent := range ents {
		matches := rp.FindStringSubmatch(ent.Name())
		if matches == nil {
			continue
		}

		if minor != "" {
			return "", fmt.Errorf("No device minor index detected, and more than one NVIDIA card present")
		}
		minor = matches[1]
	}

	if minor == "" {
		return "", fmt.Errorf("No device minor index detected, and no NVIDIA card present")
	}

	return minor, nil
}
// Fallback for old drivers which don't provide "Device Minor:"