Пример #1
0
func runDevices(args []string) {
	startAdbIfNeeded()
	devices, err := adb.Devices()
	if err != nil {
		log.Fatalf("Could not get devices: %v", err)
	}
	for _, device := range devices {
		fmt.Printf("%s - %s (%s)\n", device.ID, device.Model, device.Product)
	}
}
Пример #2
0
func mustOneDevice() *adb.Device {
	startAdbIfNeeded()
	devices, err := adb.Devices()
	if err != nil {
		log.Fatalf("Could not get devices: %v", err)
	}
	if len(devices) != 1 {
		log.Fatalf("Exactly one connected device is needed")
	}
	return devices[0]
}