summaryrefslogtreecommitdiff
path: root/recipes/linux-hotplug/files/sleeve.rc
blob: 864a2eb18269d1dec7e8afe769879155c0d1bf47 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
#
# H3600 Sleeve hotplug *.rc agent.
# This script is called by /etc/init.d/hotplug whenever
# a run level has changed.
# 
# A single argument is passed - start, restart, status, or stop
#
# We set up parameters that are equivalent to the ones created
# by the Kernel and pass them along to /sbin/hotplug (the
# function called by the kernel).
#
# Kernel NET hotplug params include:
#	
#	ACTION=%s [add or remove]
#	VENDOR_ID=%s
#	DEVICE_ID=%x
#	DEVICE_NAME=%s
#

. /etc/hotplug/hotplug.functions
# DEBUG=yes export DEBUG

SLEEVEFILE="/proc/bus/sleeve/device"
[ ! -f $SLEEVEFILE ] && exit 0

# give the sleeve driver a kick to make sure it recognizes the card -Jamey 6/26/01
# echo > /proc/sys/sleeve/insert

export DEVICE_NAME=`/bin/grep driver $SLEEVEFILE | /bin/sed -e 's/.*=//'`
export DEVICE_ID=`/bin/grep device $SLEEVEFILE | /bin/sed -e 's/.*=//'`
export VENDOR_ID=`/bin/grep vendor $SLEEVEFILE | /bin/sed -e 's/.*=//'`

case "$1" in
    start)
	export ACTION="add"
	/sbin/hotplug sleeve
	;;
    stop)
	export ACTION="remove"
	/sbin/hotplug sleeve
	;;
    restart)
	export ACTION="remove"
	/sbin/hotplug sleeve
	export ACTION="add"
	/sbin/hotplug sleeve
	;;
    status)
	if [ -f /var/lock/subsys/hotplug ]; then
	    mesg "Hot plug sleeve has been started, current device $DEVICE_NAME"
	else
	    mesg "Hot plug sleeve has not been started, current device $DEVICE_NAME"
	fi
	;;
    *)
	mesg "Usage: $0 {start|stop|status|restart}"
	;;
esac