linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hotplug scripts for ieee1394
@ 2001-09-16 17:29 Kristian Hogsberg
  2001-09-16 18:33 ` Greg KH
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Kristian Hogsberg @ 2001-09-16 17:29 UTC (permalink / raw)
  To: linux-hotplug

Hi linux-hotplug maitainers,

I've added hotplug support to the ieee1394 subsystem. From
linux-2.4.10 the ieee1394 bus driver calls /sbin/hotplug to load
drivers and depmod from modutils-2.4.9 will generate
/lib/modules/x.x.x/modules.ieee1394map.  The missing link is
/etc/hotplug/ieee1394.agent.

I copied over usb.agent and changed it to work with the IEEE1394
hotplug events, the result is the ieee1394.agent draft included below.
Could you include this into the linux-hotplug distribution?

Kristian


#!/bin/bash
#
# IEEE1394-specific hotplug policy agent.
#
# This should handle 2.4.* IEEE1394 hotplugging, with a consistent
# framework for adding device and driver specific treatments.
#
# Kernel IEEE1394 params are:
#	
#	ACTION­d or remove
#	VENDOR_ID$ bit vendor id
#	GUIDd bit globally unique id
#	SPEFICIER_ID$ bit id of owner of specification
#	VERSION=version of specification
#
# See IEEE1212 for details on these parameters.

. hotplug.functions

# generated by modutils, for current 2.4.x kernels
MAP_CURRENT=$MODULE_DIR/modules.ieee1394map

# accumulates list of modules we may care about
DRIVERS

# if called too early in booting, things break
# (bash creates tempfiles)
if touch /tmp/test.$$ >/dev/null 2>&1
then
	rm -f /tmp/test.$$
else
	mesg Need writable /tmp ...
	exit 1
fi

declare -i device_vendor_id device_specifier_id device_version
device_vendor_id="0x$VENDOR_ID"
device_specifier_id="0x$SPECIFIER_ID"
device_version="0x$VERSION"

declare -i MATCH_VENDOR_ID MATCH_SPECIFIER_ID MATH_VERSION
MATCH_VENDOR_ID=0x0001
MATCH_SPECIFIER_ID=0x0004
MATCH_VERSION=0x0008

#
# stdin is "modules.ieee1394map" syntax
# on return, ONE matching module was added to $DRIVERS
#
ieee1394_map_modules ()
{
    local module ignored
    declare -i match_flags vendor_id model_id
    declare -i specifier_id version

    # comment line lists (current) pci_device_id field names
    read ignored

    while read module match_flags vendor_id model_id specifier_id version
    do

	if [ $(($match_flags & $MATCH_VENDOR_ID)) -ne 0 -a $vendor_id -ne $device_vendor_id ]; then
	    continue
	fi

	if [ $(($match_flags & $MATCH_SPECIFIER_ID)) -ne 0 -a $specifier_id -ne $device_specifier_id ]; then
	    continue
	fi

	if [ $(($match_flags & $MATCH_VERSION)) -ne 0 -a $version != $device_version ]; then
	    continue
	fi

        DRIVERS="$module $DRIVERS"
	break
    done
}

#
# What to do with this IEEE1394 hotplug event?
#
case $ACTION in

add)
    # on 2.4 systems, modutils maintains MAP_CURRENT
    if [ -r $MAP_CURRENT ]; then
    	load_drivers ieee1394 $MAP_CURRENT "IEEE1394"
    fi

    if [ "$DRIVERS" = "" ]; then
	mesg "... no drivers for $LABEL"
	exit 2
    fi
    ;;

remove)
    ieee1394_map_modules < $MAP_CURRENT
    for MODULE in $DRIVERS
    do
	if [ -x /etc/hotplug/ieee1394/$MODULE ]; then
            /etc/hotplug/ieee1394/$MODULE
	fi
    done
    ;;

*)
    mesg "IEEE1394 $ACTION event not supported"
    exit 1
    ;;

esac



_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-09-16 22:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-16 17:29 Hotplug scripts for ieee1394 Kristian Hogsberg
2001-09-16 18:33 ` Greg KH
2001-09-16 20:10 ` David Brownell
2001-09-16 21:32 ` Kristian Hogsberg
2001-09-16 21:39 ` David Brownell
2001-09-16 21:47 ` David Brownell
2001-09-16 22:33 ` Ben Collins

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).