hotplug-script 443 B

123456789101112131415161718
  1. #!/bin/sh
  2. # Simple hotplug script sample:
  3. #
  4. # Both $DEVPATH and $FIRMWARE are already provided in the environment.
  5. HOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/
  6. if [ "$SUBSYSTEM" == "firmware" -a "$ACTION" == "add" ]; then
  7. if [ -f $HOTPLUG_FW_DIR/$FIRMWARE ]; then
  8. echo 1 > /sys/$DEVPATH/loading
  9. cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data
  10. echo 0 > /sys/$DEVPATH/loading
  11. else
  12. echo -1 > /sys/$DEVPATH/loading
  13. fi
  14. fi