Skip to content

Commit 92d1d45

Browse files
committed
Logging
1 parent ebf3fc9 commit 92d1d45

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

board_serial

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/python3
22
import os
3+
import random
34
import sys
45

56
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
@@ -16,11 +17,14 @@ if __name__ == "__main__":
1617

1718
devices = list(filter(lambda x: x["dev_type"] == sys.argv[1], chips))
1819

20+
sys.stderr.write(f"Have {len(chips)} chips, {len(devices)} match of type {sys.argv[1]}")
21+
1922
if len(devices) == 0:
20-
print("Device not found")
23+
sys.stderr.write(f"No devices of type {sys.argv[1]} found")
2124
sys.exit(1)
2225

23-
device = devices[0]
26+
device = random.choice(devices)
27+
sys.stderr.write(f"Selected {device['serial']}")
2428

2529
print(device['serial'])
2630

0 commit comments

Comments
 (0)