xref: /linux/Documentation/firmware_class/hotplug-script (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
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
9*3317fad5SMagnus Dammif [ "$SUBSYSTEM" == "firmware" -a "$ACTION" == "add" ]; then
10*3317fad5SMagnus 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
14*3317fad5SMagnus Damm  else
15*3317fad5SMagnus Damm    echo -1 > /sys/$DEVPATH/loading
16*3317fad5SMagnus Damm  fi
17*3317fad5SMagnus Dammfi
18