linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hotplug script firmware.agent
@ 2003-07-26 16:24 Marcel Holtmann
  0 siblings, 0 replies; only message in thread
From: Marcel Holtmann @ 2003-07-26 16:24 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

Hi Folks,

here is my firmware.agent script and it would be nice, if you include it
into the next release of the hotplug scripts.

Regards

Marcel


[-- Attachment #2: firmware.agent --]
[-- Type: text/x-sh, Size: 1189 bytes --]

#!/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.10 2003/07/24 19:32:23 holtmann Exp $
#

cd /etc/hotplug
. hotplug.functions
# DEBUG=yes export DEBUG

# directory of the firmware files
FIRMWARE_DIR=/usr/lib/hotplug/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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-26 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-26 16:24 Hotplug script firmware.agent Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).