flash_usb: Wait for busnum file to exist when flashing with picoboot

This solves an issue where the USB directory could exist, but the busnum
file itself may not exist immediately. This was encountered when
flashing a Pico connected to a Raspberry Pi 5.

Signed-off-by: Jack Wakefield <jackwakefield@protonmail.com>
This commit is contained in:
Jack Wakefield authored and KevinOConnor committed 2024-09-22 19:26:18 -04:00
1 parent d9236f1c20
commit b4aca122a1
1 file changed
+1 -1
+1 -1
View File
@@ -198,7 +198,7 @@ def flash_picoboot(device, binfile, sudo):
# We need one level up to get access to busnum/devnum files
usbdir = os.path.dirname(devpath)
enter_bootloader(device)
wait_path(usbdir)
wait_path(usbdir + "/busnum")
with open(usbdir + "/busnum") as f:
bus = f.read().strip()
with open(usbdir + "/devnum") as f: