Reland "usb_image_manager: call settle before looping candidates"

This is a reland of 3e37ba7815420ac493d0740b7da1dc040cf13365

The reland does the same as the original change, but it also maintains
the loop over the dev files. This is because we saw a regression where
the settle call might finish before the usb devices are even enumerated
again. This allows those devices to be found again.

Original change's description:
> usb_image_manager: call settle before looping candidates
>
> Letting the events settle before looking for the device file helps
> ensure that we don't return a stale entry that settle might have
> removed.
>
> BUG=b:153202599
> TEST=dut-control image_usbkey_dev
> image_usbkey_dev:/dev/sda
> TEST=dut-control image_usbkey_dev // no dev attached
> 2020-04-15 14:53:22,027 - usbImageManager - WARNING - No USB storage
> device found for image transfer. Make sure you are using the usb port
> next to the ethernet adapter.
> 2020-04-15 14:53:22,028 - usbImageManager - WARNING - Stick should be at
> /sys/bus/usb/devices/1-1.4.
> 2020-04-15 14:53:22,029 - usbImageManager - WARNING - If using a hub on
> the image key port, please make sure to use port 1 on the hub. This
> should be at /sys/bus/usb/devices/1-1.4.1.
> image_usbkey_dev:
>
> Change-Id: I225851c2a0cc780e315c4a955dbc2189f3431021
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/hdctools/+/2151047
> Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> Reviewed-by: Garry Wang <xianuowang@chromium.org>
> Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>

BUG=b:153202599
TEST=dut-control image_usbkey_dev -p 9998
image_usbkey_dev:/dev/sda

TEST=cat /var/log/servod_9998/latest.DEBUG | grep Spent
2020-06-04 18:33:28,953 - usbImageManager - DEBUG -
usb_image_manager.py:174:_Get_image_usbkey_dev - Spent 0.0020 seconds to
find 'sda'.

Change-Id: I2f773a405ed473089356783543634966dfc2a6ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/hdctools/+/2231489
Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
1 file changed
tree: 2f7bce4f24eddcf9ab81eed6774b47e3a9f137c3
  1. beaglebone/
  2. chromeos/
  3. defs/
  4. docs/
  5. include/
  6. lib/
  7. polld/
  8. serial_server/
  9. servo/
  10. src/
  11. test/
  12. usbkm232/
  13. .gitignore
  14. getversion.sh
  15. LICENSE
  16. Makefile
  17. navbar.md
  18. OWNERS
  19. README.md
  20. setup.py
README.md

hdctools: Chrome OS Hardware Debug & Control Tools

This repository contains source code and documentation for the Servo debug boards. The tools in this repository require the full CrOS chroot, while the Standalone hdctools can be used without the chroot.

Servo

servod

Closed Case Debugging (CCD)

Power Measurement

Resources