Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[PCI id] - update pb_check to test for either the SP1 or SP2 ids.
  • Loading branch information
Richard Neill committed Sep 14, 2013
1 parent 117a35e commit 5e98f47
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions pb_utils/src/pb_check.sh
@@ -1,25 +1,39 @@
#!/bin/bash
#Check for whether PulseBlaster PCI card is physically present. NB the PCI_STRING is for our specific PulseBlaster model.
#Check for whether PulseBlaster PCI card is physically present.

#We have an SP1 board.
SP1_ID=0x5920

#The SP2 board has either of these IDs.
SP2a_ID=0x8879
SP2b_ID=0x8852

#NB the PCI_STRING is for our specific PulseBlaster model.
PCI_STRING="Applied Micro Circuits Corp. S5920"
WRONG_EXAMPLE="Applied Micro Circuits Corp. Device 5922"
WRONG_EXAMPLE="Applied Micro Circuits Corp. Device 5922" #Misreads.

if [ $# != 0 ]; then
echo "This checks for the presence of a physical PulseBlaster device in this computer's PCI slot."
echo "It checks: 'lspci | grep \"$PCI_STRING\"'"
echo "It checks lspci for any of $SP1_ID, $SP2a_ID, $SP2b_ID"
echo "If found, return 0; else return 1."
exit 1
fi

echo -n "Checking for PulseBlaster..."
if lspci | grep -q "$PCI_STRING" ; then
if [ -n "$(lspci -d "*:$SP1_ID")" ]; then
echo "OK"
exit 0
elif [ -n "$(lspci -d "*:$SP2a_ID")" ]; then
echo "OK"
exit 0
elif [ -n "$(lspci -d "*:$SP2b_ID")" ]; then
echo "OK"
exit 0
else
echo "ERROR"
echo "Warning: PulseBlaster PCI device not present! Failed to find PCI device '$PCI_STRING'" >&2
echo "Warning: PulseBlaster PCI device not present! Failed to find PCI device with ID '$SP1_ID', '$SP2a_ID' or '$SP2b_ID'." >&2
echo "Turn off this PC, remove lid and wiggle the PCI cards carefully..." >&2
echo "Note: if a slightly wrong device is detected, e.g., lspci shows '$WRONG_EXAMPLE', this usually indicates the PCI device isn't correctly seated in the slot." >&2
echo "Note: if a slightly wrong device is detected, e.g., lspci shows '$WRONG_EXAMPLE', rather than '$PCI_STRING' this usually indicates the PCI device isn't correctly seated in the slot." >&2
#zenity --error --text="ERROR: PulseBlaster PCI device not present! Turn off, remove lid and wiggle the PCI cards carefully."
exit 1
fi
Expand Down

0 comments on commit 5e98f47

Please sign in to comment.