aboutsummaryrefslogtreecommitdiff
path: root/testdefs/probe_device
blob: 24bd354f234dddfa045ddc674b70fba86e53aa21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
#
# Quick script to update an ARM energy probe config file.
#
# 1. Find the first likely-looking serial device in /dev/serial/by-id
# 2. Put it into the config file we're told about on the command line

CONF=$1

ls -alR /dev/

LAVA='echo # '
if [ -n `which lava-test-case || true` ]; then
    LAVA='lava-test-case'
fi

LAVA_RAISE='echo # '
if [ -n `which lava-test-raise || true` ]; then
    LAVA_RAISE='lava-test-raise'
fi

DEVICE=$(ls -1 /dev/serial/by-id/usb-NXP_SEMICOND_ARM_Energy_Probe* | head -1)
if [ "$DEVICE"x = ""x ] ; then
    echo "Failed to detect an AEP to use. ABORT"
    ${LAVA_RAISE} "Failed to detect an AEP to use. ABORT"
    exit 1
fi
${LAVA} aep-detection --result pass

cat $CONF | sed "s:PROBE_DEVICE_HERE:$DEVICE:"g > $CONF.1
mv -f $CONF.1 $CONF

exit 0