#!/bin/bash

# pbload: The PulseBlaster device loader- Aditya Kadambi, July 2003

# Root or die
if [ "$(id -u)" != "0" ]
then
	echo "You must be root to load or unload kernel modules"
	exit 1
fi

module="pulseblasterPBD02PC"
device="pbPCI"
mode="666"


#invoke insmod with a base_array option
/sbin/insmod ./pulseblasterPBD02PC.o ||exit 1

major=`cat /proc/devices | gawk "\\$2==\"$module\" {print \\$1}"`

#give permissions to your own groups. We use nmr in our lab
group="nmr"

mknod /dev/${device}0 c $major 0
chgrp $group /dev/${device}0
chmod $mode /dev/${device}0
echo device /dev/pbPCI0 created

echo pulseblaster drivers loaded. 
