summaryrefslogtreecommitdiff
path: root/source/a/pcmciautils/config/rc.pcmcia
blob: 1f21be84e09890f571be2f68246d766a6c2f88a9 (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
61
62
63
64
65
#!/bin/sh
#
# rc.pcmcia: Script to initialize PCMCIA subsystem.
#	     Based in an example found in cardmgr-to-pcmciautils.txt
#	     and in Slackware rc.pcmcia found in pcmcia-cs package.
#

# Set this to the driver to use, one of:
# probe, yenta_socket, i82365, i82092, pd6729, tcic, etc.
#
DRIVER=probe
DRIVER_OPTS=

case "$1" in
	start)
		echo "Starting PCMCIA services:"
		fgrep -q pcmcia /proc/devices
		if [ $? -ne 0 ] ; then
			if [ "$DRIVER" = "probe" ]; then
			   echo "  <Probing for PCIC: edit /etc/rc.d/rc.pcmcia>"
			   for DRV in yenta_socket i82365 tcic ; do
				/sbin/modprobe $DRV > /dev/null 2>&1
				/sbin/pccardctl status | grep -q Socket && break 
				/sbin/modprobe -r $DRV > /dev/null 2>&1
			   done
			else
			echo "  <Loading PCIC: $DRIVER>"
			   /sbin/modprobe $DRIVER $DRIVER_OPTS > /dev/null 2>&1
			fi
			/sbin/modprobe pcmcia > /dev/null 2>&1 # just in case it's not auto-loaded
		else
			echo "  <PCIC already loaded>"
		fi
		;;

	stop)
	        echo -n "Shutting down PCMCIA services: "
		echo -n "cards "
		/sbin/pccardctl eject
		MODULES=`/sbin/lsmod | grep "pcmcia " | awk '{print $4}' | tr , ' '`
		for i in $MODULES ; do
			echo -n "$i "
			/sbin/modprobe -r $i > /dev/null 2>&1
		done
		echo -n "pcmcia "
		/sbin/modprobe -r pcmcia > /dev/null 2>&1
		if [ "$DRIVER" = "probe" ]; then
			for DRV in yenta_socket i82365 tcic ; do
				grep -qw $DRV /proc/modules && modprobe -r $DRV && \
					echo -n "$DRV " && break
			done
		else	
			/sbin/modprobe -r $DRIVER > /dev/null 2>&1
		fi
		echo -n "rsrc_nonstatic "
		/sbin/modprobe -r rsrc_nonstatic > /dev/null 2>&1
		echo "pcmcia_core"
		/sbin/modprobe -r pcmcia_core > /dev/null 2>&1
		;;
	
	restart)
		$0 stop
		$0 start
		;;
esac