blob: 217fbd20434c11e4067856ed55b1ad54675e32fe [file] [log] [blame]
Joachim Steiger9b827282021-07-27 21:19:15 +02001#!/bin/bash
2
3# this script is to scan for octsim boards, sort them by usb path and generate a bankd_pcsc_slots.csv on stdout
4# basic flow
5# - get usb path and serialno tupel from dfu-util -l
6# - reformat and sort by usbpath, drop the usbpath (grep cut tr sort cut)
7# - generate the config file from the list of serialno in the format required by osmo-remsim-bankd (awk)
8
9dfu-util -l \
10 | grep "Found Runtime: \[1d50:6141\]" \
11 | cut -d ' ' -f 8,13 \
12 | tr -d ',' \
13 | cut -d \" -f 2,4 \
14 | tr \" ' ' \
15 | sort \
16 | cut -d ' ' -f 2 \
17 | awk 'BEGIN {count=0}{for (slot=0; slot<8; slot++) {print count, $0, 0slot; count++}}' \
18 | awk '{print "\"1\",\""$1"\",\"sysmocom sysmoOCTSIM \[CCID\] \("$2"\) [A-F0-9]{2} "$3"\""}'
19