summaryrefslogtreecommitdiff
path: root/packages/pvrusb2-mci/files/firmware.hotplug
diff options
context:
space:
mode:
authorFrans Meulenbroeks <fransmeulenbroeks@yahoo.com>2006-06-29 15:16:21 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-06-29 15:16:21 +0000
commit62db438fe44ef40a780bb6915faf902c84055817 (patch)
treec14e5d00f9d7ac169bd989da7b7977ae8bcc5e16 /packages/pvrusb2-mci/files/firmware.hotplug
parentf3ea435114c6d51e41ac7e9474e3e223277427a0 (diff)
pvrusb2-mci: added missing hotplug files
Diffstat (limited to 'packages/pvrusb2-mci/files/firmware.hotplug')
-rwxr-xr-xpackages/pvrusb2-mci/files/firmware.hotplug61
1 files changed, 61 insertions, 0 deletions
diff --git a/packages/pvrusb2-mci/files/firmware.hotplug b/packages/pvrusb2-mci/files/firmware.hotplug
new file mode 100755
index 0000000000..40673a7b74
--- /dev/null
+++ b/packages/pvrusb2-mci/files/firmware.hotplug
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Firmware-specific hotplug policy agent.
+#
+# Kernel firmware hotplug params include:
+#
+# ACTION=%s [add or remove]
+# DEVPATH=%s [in 2.5 kernels, /sys/$DEVPATH]
+# FIRMWARE=%s
+#
+# HISTORY:
+#
+# 24-Jul-2003 Initial version of "new" hotplug agent.
+#
+# $Id: firmware.agent,v 1.3 2004/03/14 15:52:56 ukai Exp $
+#
+
+cd /etc/hotplug.d/firmware
+. ./hotplug.functions
+# DEBUG=yes export DEBUG
+
+# directory of the firmware files
+FIRMWARE_DIR=/lib/firmware
+
+# mountpoint of sysfs
+SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts)
+
+# use /proc for 2.4 kernels
+if [ "$SYSFS" = "" ]; then
+ SYSFS=/proc
+fi
+
+#
+# What to do with this firmware hotplug event?
+#
+case "$ACTION" in
+
+add)
+ if [ ! -e $SYSFS/$DEVPATH/loading ]; then
+ sleep 1
+ fi
+
+ if [ -f "$FIRMWARE_DIR/$FIRMWARE" ]; then
+ echo 1 > $SYSFS/$DEVPATH/loading
+ cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data
+ echo 0 > $SYSFS/$DEVPATH/loading
+ else
+ echo -1 > $SYSFS/$DEVPATH/loading
+ fi
+
+ ;;
+
+remove)
+ ;;
+
+*)
+ mesg "Firmware '$ACTION' event not supported"
+ exit 1
+ ;;
+
+esac