solokeys / solo1-cli

Solo 1 library and CLI in Python
https://pypi.org/project/solo-python
Apache License 2.0
183 stars 69 forks source link

[solo key update] wait for bootloader #113

Open coelner opened 3 years ago

coelner commented 3 years ago

Device: Somu Hacker the update itself work flawless (5.10.11-arch1-1 #1 SMP PREEMPT Wed, 27 Jan 2021 13:53:16 +0000 x86_64 GNU/Linux), but the update flow is too fast. The device gets with the first command into the bootloader but the flashing part does not wait long enough for it.

✔ [11:26|coelner@localhost bin]$ solo version
0.0.27
✔ [11:26|coelner@localhost bin]$ solo ls
:: Solos
1337DEADBEEF: SoloKeys Solo 4.0.0
✔ [11:26|coelner@localhost bin]$ solo key update
Wrote temporary copy of firmware-4.1.0.json to /tmp/tmp78tdsymh.json
sha256sums coincide: 0b4a198bde48a4c0bbe6931ddf5fc24aa22aad5cd3d45391ef542d6c5ec7e724
Switching into bootloader mode...
error:
problem flashing firmware!
no Solo found
✔ [11:26|coelner@localhost bin]$ solo key update
Not using FIDO2 interface.
Wrote temporary copy of firmware-4.1.0.json to /tmp/tmp5po_ozir.json
sha256sums coincide: 0b4a198bde48a4c0bbe6931ddf5fc24aa22aad5cd3d45391ef542d6c5ec7e724
using signature version >2.5.3
erasing firmware...
updated firmware 100%             
time: 9.44 s
bootloader is verifying signature...
...pass!

Congratulations, your key was updated to the latest firmware version: 4.1.0

I blame this line: https://github.com/solokeys/solo-python/blob/76d7255b47cc5697578bce8aac2982daf3aaab04/solo/cli/update.py#L187 after changing it to time.sleep(1.0) it works with the first try.