summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-08-30 10:22:56 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-08-31 08:47:24 +0000
commit32c192985b2409817efbe2ffae3f71d9d442ae9b (patch)
tree86104eec3cd01d4d501e5b50765c176331377a53
parent1bac23ab206fbab989ccdd3755f00a16e5892ba5 (diff)
android: improve adb_debug_info()
Using 'lsusb' in LAVA-LXC directly is misleading. This is because from within the container lsusb will show all usb devices that are connected to host and there is no way to mask host devices from what is attached to the container. Though the devices show up on lsusb, each device should be added to the container via 'lxc-device add' command to make it accessible from within the container(which is done by LAVA). The current approach uses 'lsusb -D <device>' to get the information of devices found in '/dev/bus/usb' Change-Id: I28dc05f61685d995ac7fa9cc0e9831a936ef3a20 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/lib/android-test-lib17
1 files changed, 12 insertions, 5 deletions
diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib
index 0c720fb..40c3ef3 100755
--- a/automated/lib/android-test-lib
+++ b/automated/lib/android-test-lib
@@ -10,13 +10,20 @@ install_latest_adb() {
}
adb_debug_info() {
- info_msg "'find /dev/bus/usb' output"
- find /dev/bus/usb
+ info_msg "Printing USB device info for debugging..."
if which lsusb; then
- info_msg "'lsusb' output"
- lsusb
+ find /dev/bus/usb -type c | while read -r device; do
+ # In the 'Cannot open /dev/bus/usb/*' case, print nothing and use that error
+ # message directly. When shell option '-e' enabled in test script, putting
+ # 'lsusb -D <device>' in 'if' block also avoids unexpected test exit.
+ if device_info="$(lsusb -D "${device}" | grep "Device:")"; then
+ echo "$device: $device_info"
+ fi
+ done
else
- info_msg "usbutils not installed. 'lsusb' skipped!"
+ info_msg "usbutils not installed, unable to get device information with 'lsusb'."
+ info_msg "Listing 'find /dev/bus/usb' output directly..."
+ find /dev/bus/usb
fi
}