Skip to content

Commit

Permalink
wait up to 15 seconds, and detect rev c in bootstub
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Aug 25, 2017
1 parent 72a92f5 commit d01c91f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions board/bootstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ extern void *_app_start[];
int main() {
__disable_irq();
clock_init();
detect();

if (revision == PANDA_REV_C) {
set_usb_power_mode(USB_POWER_CLIENT);
}

if (enter_bootloader_mode == ENTER_SOFTLOADER_MAGIC) {
enter_bootloader_mode = 0;
Expand Down
15 changes: 8 additions & 7 deletions panda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@ def reset(self, enter_bootstub=False, enter_bootloader=False):
if not enter_bootloader:
self.close()
time.sleep(1.0)
try:
self.connect()
except Exception:
# retry after 5 seconds
print("connecting to bootstub is taking a while...")
time.sleep(5.0)
self.connect()
# wait up to 15 seconds
for i in range(0, 15):
try:
self.connect()
break
except Exception:
print("reconnecting is taking %d seconds..." % i)
time.sleep(1.0)


def flash(self, fn=None, code=None):
Expand Down

0 comments on commit d01c91f

Please sign in to comment.