#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org 

START=42
start() {
	if [ -d /sys/bus/pcmcia/devices/ ]; then
		# 2.6 kernels
		cd /sys/bus/pcmcia/devices/
		for PCMCIA_DEVICE in *; do
			if [ $PCMCIA_DEVICE == \* ]; then
				continue;
			fi;
			MODALIAS=$(cat $PCMCIA_DEVICE/modalias)
			echo PCMCIA: $MODALIAS $PCMCIA_DEVICE
			if [ -z $MODALIAS ]; then
				continue;
			fi;
			ACTION=add
			SOCKET_NO=$(echo $PCMCIA_DEVICE | cut -d. -f1)
			DEVICE_NO=$(echo $MODALIAS | sed 's/.*pfn\(..\).*/\1/')
			export MODALIAS ACTION SOCKET_NO DEVICE_NO
			/sbin/hotplug-call pcmcia
		done;
	fi;
}
