-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiple pandas selector (#2015)
* multiple Panda cli helper * Don't flash all pandas by default. Use --all arg to flash all.
- Loading branch information
Showing
6 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import subprocess | ||
import argparse | ||
|
||
from panda import Panda | ||
|
||
board_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--all", action="store_true", help="Recover all Panda devices") | ||
args = parser.parse_args() | ||
|
||
subprocess.check_call(f"scons -C {board_path}/.. -j$(nproc) {board_path}", shell=True) | ||
|
||
serials = Panda.list() | ||
print(f"found {len(serials)} panda(s) - {serials}") | ||
if args.all: | ||
serials = Panda.list() | ||
print(f"found {len(serials)} panda(s) - {serials}") | ||
else: | ||
serials = [None] | ||
|
||
for s in serials: | ||
print("flashing", s) | ||
with Panda(serial=s) as p: | ||
print("flashing", p.get_usb_serial()) | ||
p.flash() | ||
exit(1 if len(serials) == 0 else 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import subprocess | ||
import argparse | ||
|
||
from panda import PandaJungle | ||
|
||
board_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--all", action="store_true", help="Recover all panda jungle devices") | ||
args = parser.parse_args() | ||
|
||
subprocess.check_call(f"scons -C {board_path}/.. -u -j$(nproc) {board_path}", shell=True) | ||
|
||
serials = PandaJungle.list() | ||
print(f"found {len(serials)} panda jungle(s) - {serials}") | ||
if args.all: | ||
serials = PandaJungle.list() | ||
print(f"found {len(serials)} panda jungles(s) - {serials}") | ||
else: | ||
serials = [None] | ||
|
||
for s in serials: | ||
print("flashing", s) | ||
with PandaJungle(serial=s) as p: | ||
print("flashing", p.get_usb_serial()) | ||
p.flash() | ||
|
||
exit(1 if len(serials) == 0 else 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters