#!/bin/sh
#
# The following script shows all sorts of problems
# with pcmcia for the 2.6.13-rc6 kernel.
#
# In my case the following cards are inserted:
#
# 3com 3CRWB6096B Bluetooth card (serial_cs)
# Pretec ATA Flash Disk 16MB (ide_cs)
#
# There are are no accesses to the pcmcia cards
# except from this script.
#
while [ 1 ]
do
	echo tic
	#
	# comment the following command and the modules of
	# the inserted pcmcia cards (e.g. serial_cs) will
	# stay in use after cardmgr is terminated thus making
	# removal of the pcmcia modules impossible
	#
	/sbin/cardctl eject
	/sbin/killproc /sbin/cardmgr
	for i in pcmcia yenta_socket rsrc_nonstatic pcmcia_core
	do
		rmmod $i
	done
	#
	# comment the following delay and you can get
	# oopses for ide_cs if a pcmcia flash disk is
	# inserted (e.g. at ide_do_request+82)
	#
	usleep 1000000
	echo tac
	for i in pcmcia_core rsrc_nonstatic yenta_socket pcmcia
	do
		modprobe $i
	done
	/sbin/cardmgr > /dev/null 2>&1
	#
	# comment the following delay or change it to
	# 100000 and rmmod of yenta_socket will hang
	# with 'users' of the module even as there are
	# none - alternatively modules like serial_cs
	# will hang with 'users' and thus can't be
	# removed
	#
	usleep 10000000
done
