Skip to content

Commit 21a54d0

Browse files
committed
Clear cache if device info is not valid.
Add authorizing status
1 parent 18df5ef commit 21a54d0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/list_devices.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
def get_property(name=None):
2525
infos = run_script(adb_path + " -s " + name + " shell getprop | grep 'ro.build.version.release]\|ro.build.version.sdk]\|ro.product.manufacturer]\|ro.product.model\|ro.build.display.id]\|ro.build.version.incremental]' | awk -F'[][]' -v n=2 '{ print $(2*n) }'")
2626
infos = infos.rstrip().split('\n')
27+
log.debug("getprop result for {0}: {1}".format(name, infos))
2728
return infos
2829

2930
def get_device_items(arg, devices):
@@ -46,10 +47,14 @@ def get_device_items(arg, devices):
4647
title = name + " [OFFLINE]"
4748
elif values[1] == 'connecting':
4849
title = name + " [CONNECTING]"
50+
elif values[1] == 'authorizing':
51+
title = name + " [AUTHORIZING]"
4952
else:
5053
title = name
5154
infos = wf.cached_data("{0}-property".format(name), lambda: get_property(name), max_age=600)
5255
if not infos or len(infos) < 6:
56+
log.error("Info length {0}, infos: {1}".format(len(infos), infos))
57+
wf.clear_cache(lambda f: f == "{0}-property.pickle".format(name))
5358
continue
5459
manufacturer = infos[4].title()
5560
model = infos[5].title()
@@ -80,7 +85,7 @@ def list_devices(args):
8085

8186
devices = run_script(adb_path + " devices -l | sed -n '1!p' | tr -s ' '")
8287
devices = devices.rstrip().split('\n')
83-
88+
log.debug("{} adb device(s) found".format(len(devices)))
8489
items, wifiDevices = get_device_items(arg, devices)
8590

8691
if wifiDevices:

0 commit comments

Comments
 (0)