#!/bin/bash
#
# Typically called by the kernel from a reume event in the form
#    /sbin/pm_helper resume
#

#cd /etc/hotplug
#. hotplug.functions

DEBUG=yes export DEBUG

if [ "$DEBUG" != "" ]; then
    mesg "arguments ($*) env (`env`)"
fi

case $1 in 
suspend)
    echo "Called pm_helper with suspend - this shouldn't happen\n"
    ;;

resume)
    SLEEVEFILE="/proc/bus/sleeve/device"

    export DEVICE_NAME=`/bin/grep driver $SLEEVEFILE | /bin/sed -e 's/.*=//'`
    case $DEVICE_NAME in
    "Compaq Mercury Backpaq")
        cat /etc/fpga.bin > /dev/backpaq/fpga
        mesg 'BackPAQ fpga loaded'
        ;;
    "Compaq CompactFlash Sleeve")
        mesg 'CompactFlash resuming'
	;;
    "Compaq PC Card Sleeve")
        mesg 'PC card sleeve resuming'
	;;
    "Compaq Dual PC Card Sleeve")
        mesg 'Dual PC card sleeve resuming'
	;;
    *)
        mesg $1 event not handled for $DEVICE_NAME
	;;
    esac
    ;;
esac

