Newer
Older
Tardis / scripts / findboard.sh
@Jookia Jookia 18 days ago 532 bytes Bump copyright year
#!/bin/bash
# SPDX-License-Identifier: MIT
# Copyright (c) 2024 John Watts and the LuminaSensum contributors

set -e
SERIALPATH="$PWD/.boardserial"
USBDIR=/sys/bus/usb/devices
cd $USBDIR
for DEV in *; do
	cd "$USBDIR/$DEV"
	test -e idVendor -a -e idProduct || continue
	ID="$(cat idVendor):$(cat idProduct)"
	test "$ID" = "0483:374b" || continue
	cp serial "$SERIALPATH"
	echo "Found board!"
	exit 0
done
echo "Couldn't find board, please re-connect and run again."
echo "Make sure you have run 'sudo scripts/setup-udev.sh'"
exit 1