#!/bin/sh
|
|
# Copyright (C) 2008 OpenWrt.org
|
|
|
|
case "$ACTION" in
|
|
add)
|
|
SYSFS=/sys/bus/pcmcia/devices/
|
|
DEVPATH=$SOCKET_NO.$((0x$DEVICE_NO))
|
|
|
|
# check whether the CIS is completely broken
|
|
if [ ! -h $SYSFS$DEVPATH/driver ]; then
|
|
CISFILE=$(/usr/sbin/pcmcia-check-broken-cis $SOCKET_NO)
|
|
echo PCMCIA: $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
|
|
echo PCMCIA: allowing func_id based match for PCMCIA device $SOCKET_NO.$DEVICE_NO
|
|
echo -n "42" > $SYSFS$DEVPATH/allow_func_id_match;
|
|
fi;
|
|
fi;
|
|
;;
|
|
esac
|