11da177e4SLinus Torvalds#!/bin/sh
21da177e4SLinus Torvalds
31da177e4SLinus Torvalds# Simple hotplug script sample:
41da177e4SLinus Torvalds#
51da177e4SLinus Torvalds# Both $DEVPATH and $FIRMWARE are already provided in the environment.
61da177e4SLinus Torvalds
71da177e4SLinus TorvaldsHOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/
81da177e4SLinus Torvalds
93317fad5SMagnus Dammif [ "$SUBSYSTEM" == "firmware" -a "$ACTION" == "add" ]; then
103317fad5SMagnus Damm  if [ -f $HOTPLUG_FW_DIR/$FIRMWARE ]; then
111da177e4SLinus Torvalds    echo 1 > /sys/$DEVPATH/loading
121da177e4SLinus Torvalds    cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data
131da177e4SLinus Torvalds    echo 0 > /sys/$DEVPATH/loading
143317fad5SMagnus Damm  else
153317fad5SMagnus Damm    echo -1 > /sys/$DEVPATH/loading
163317fad5SMagnus Damm  fi
173317fad5SMagnus Dammfi
18