#!/usr/bin/env bash

class="/sys/class/xdma"
card=$(readlink $class/xdma${1}_user)
echo "Removing Card: $1"
remove=$(echo 1 | sudo tee $class/$card/device/remove)
sleep 1
echo "Rescanning Card: $1"
rescan=$(echo 1 | sudo tee /sys/bus/pci/rescan)
echo "Resetting Card: $1"
reset=$(experimental/max/framegrabber_testing/reset_card --card $1)
echo "Done"
