def connect_and_check(): '''check adb devices connect or not''' adb = WrapCommand('%s devices' % ADB, shell=True) adb.start() i = 5 while i > 0 and adb.is_alive(): i -= 1 time.sleep(1) if adb.is_alive(): adb.stop() print 'adb111' adb.join() print adb.results for line in adb.results[0].split(os.linesep): if line.endswith("device") or line.endswith("recovery"): return True return False
def connect_and_check(): '''check adb devices connect or not''' adb = WrapCommand('%s devices' % ADB,shell=True) adb.start() i = 5 while i > 0 and adb.is_alive(): i -= 1 time.sleep(1) if adb.is_alive(): adb.stop() print 'adb111' adb.join() print adb.results for line in adb.results[0].split(os.linesep): if line.endswith("device") or line.endswith("recovery"): return True return False