func getDevice()

in cmd/ptpcheck/cmd/map.go [60:82]


func getDevice(iface string) error {
	ifaces, err := phc.IfacesInfo()
	if err != nil {
		return err
	}
	if len(ifaces) == 0 {
		return fmt.Errorf("no network devices found")
	}
	found := []phc.IfaceData{}
	for _, d := range ifaces {
		if d.Iface.Name == iface {
			found = append(found, d)
		}
	}
	if len(found) == 0 {
		return fmt.Errorf("no nic information for %s", iface)
	}
	for _, d := range found {
		printIfaceData(d, false)
	}
	return nil

}