File: pcmcia.agent

package info (click to toggle)
pcmciautils 014-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 328 kB
  • ctags: 791
  • sloc: ansic: 3,804; sh: 284; makefile: 238; lex: 219; yacc: 104
file content (51 lines) | stat: -rwxr-xr-x 1,043 bytes parent folder | download | duplicates (9)
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
#!/bin/sh
#
# PCMCIA-specific hotplug policy agent
#
# $Id$
#

#DEBUG=yes; export DEBUG
SYSFS=/sys

cd /etc/hotplug
. ./hotplug.functions

if [ "$ACTION" = "" ]; then
    mesg Bad PCMCIA agent invocation, no action
    exit 1
fi

debug_mesg $SOCKET_NO $DEVICE_NO $MODALIAS $DEVPATH

case $ACTION in

add)
	modprobe $MODALIAS

	# check whether the CIS is completely broken
	if [ ! -h $SYSFS$DEVPATH/driver ]; then
		CISFILE=$(pcmcia-check-broken-cis $SOCKET_NO)
		debug_mesg $CISFILE;
		if [ ! -z $CISFILE ]; then
			if [ -f /lib/firmware/$CISFILE ]; then
				cat /lib/firmware/$CISFILE > $SYSFS/class/pcmcia_socket/pcmcia_socket$(SOCKET_NO)/cis
			fi;
		fi;
	fi;

	# allow a match solely based on the "function ID" field
	if [ ! -h $SYSFS$DEVPATH/driver ]; then
		if [ -w $SYSFS$DEVPATH/allow_func_id_match ]; then
			debug_mesg allowing func_id based match for PCMCIA device $SOCKET_NO.$DEVICE_NO
			echo -n "42" > $SYSFS$DEVPATH/allow_func_id_match;
		fi;
	fi;
	;;
remove)
	;;
*)
	debug_mesg "PCMCIA '$ACTION' event not supported"
	;;

esac