Skip to contentSkip to conversation

Hotplug scripts for ieee1394

DISCUSSION Kristian Hogsberg 4 participants 7 messages Sep 16, 2001

lore
Share & tools
lore
#0 lore raw

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 11 lines · Kristian Hogsberg

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?

I just added it to cvs, thanks a lot for doing this!

It's looking like it's time for another linux-hotplug release, does anyone have any outstanding issues that need to be addressed before I make another release?

thanks,

greg k-h

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Kristian Hogsberg

Way cool!

Quoted 1 line

I just added it to cvs, thanks a lot for doing this!

You barely beat me to it ... :)

I added a couple things to this. The LABEL variable wasn't set, which meant that "no such driver" diagnostics wouldn't be helpful. I added the ": case $expected $actual" statements to the match logic, so that it's easier to use "sh -x" to debug things (as it is for the other agents). And also tweaked the doc a little, so it's clear that 2.4.10 and the right modutils are needed, and there's a HISTORY section.

Is there something that addresses the "cold-plugging" (boot time) init of ieee1394/firewire/i-link/... devices, like the "usbmodules" command?

* Scenario: firewire driver is statically linked, device is connected at boot time, but hotplugging won't behave since filesystems aren't ready yet.
* Solution: a /etc/hotplug/ieee1394.rc script that scans the bus and issues fake hotplug events for those devices.

There could be other solutions of course.

Quoted 3 lines

It's looking like it's time for another linux-hotplug release, does anyone have any outstanding issues that need to be addressed before I make another release?

I finally got around to integrating a bunch of the fixes from SuSE, though not all of them. It would be good to have the scripts sense whether they're running on a RedHat-ish system or SuSE one, and use the appropriate style admin scripts for (a) hotplug options, and
(b) network administration. (Best to have distros agree more on such stuff, but that's a bit out of scope for me ... :)

Unless someone else wants to volunteer to address those issues in the near future, I think it's a fine time to release. This one will have the "fxload" utility (hotplugging can load EZ-USB FX/FX2 firmware), some of the SuSE support, bugfixes, IEEE1394, and stuff I've forgotten ... should be interesting! :)

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Kristian Hogsberg
Quoted 4 lines · David Brownell

Way cool!

Quoted 1 line

I just added it to cvs, thanks a lot for doing this!

Quoted 8 lines

You barely beat me to it ... :)

I added a couple things to this. The LABEL variable wasn't set, which meant that "no such driver" diagnostics wouldn't be helpful. I added the ": case $expected $actual" statements to the match logic, so that it's easier to use "sh -x" to debug things (as it is for the other agents). And also tweaked the doc a little, so it's clear that 2.4.10 and the right modutils are needed, and there's a HISTORY section.

Nice, I knew I must have missed some details -- I'm not too familiar with those shell-script details...

Quoted 10 lines

Is there something that addresses the "cold-plugging" (boot time) init of ieee1394/firewire/i-link/... devices, like the "usbmodules" command?

* Scenario: firewire driver is statically linked, device is connected at boot time, but hotplugging won't behave since filesystems aren't ready yet.
* Solution: a /etc/hotplug/ieee1394.rc script that scans the bus and issues fake hotplug events for those devices.

There could be other solutions of course.

Currently there is no such mechanism, the ieee1394 subsystem maintains no /proc entries at the moment. I'd like to add it eventually, but currently it can't be supported easily.

Kristian

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Kristian Hogsberg

I provided some skeletal documentation:

http://linux-hotplug.sourceforge.net/?selected=ieee1394

As more information becomes available, it can easily be integrated. The CONFIG_HOTPLUG page also now lists ieee1394 as one of the hotpluggable subsystems.

There are a few "TBS" entries that should get completed. I don't know 1394, and my current kernel is only at pre2, so I'm not clear what the answers should be. For example, does 1394 probe() drivers for its hotplugging (like PCI and USB), using the device_id table entry that matches? And pre2 doesn't seem to have docs on the ieee1394 subsystem (in Documentation/*) so I just pointed to the sf.net project. (I'd rather have both ... :)

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Kristian Hogsberg
Quoted 6 lines
Quoted 2 lines

Is there something that addresses the "cold-plugging" (boot time) init of ieee1394/firewire/i-link/... devices, like the "usbmodules" command?

Currently there is no such mechanism, the ieee1394 subsystem maintains no /proc entries at the moment. I'd like to add it eventually, but currently it can't be supported easily.

OK, it's a known issue then. Workaround is simple: either re-plug, or statically link the relevant drivers. Providing subsystem status is a significant issue, it's worth NOT rushing it ... :)

- Dave

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Kristian Hogsberg
Quoted 8 lines · David Brownell

I provided some skeletal documentation:

http://linux-hotplug.sourceforge.net/?selected=ieee1394

As more information becomes available, it can easily be integrated. The CONFIG_HOTPLUG page also now lists ieee1394 as one of the hotpluggable subsystems.

Quoted 7 lines

There are a few "TBS" entries that should get completed. I don't know 1394, and my current kernel is only at pre2, so I'm not clear what the answers should be. For example, does 1394 probe() drivers for its hotplugging (like PCI and USB), using the device_id table entry that matches? And pre2 doesn't seem to have docs on the ieee1394 subsystem (in Documentation/*) so I just pointed to the sf.net project. (I'd rather have both ... :)

modutils should handle loading protocol drivers for ieee1394 devices with Kristian's patches submitted to them. As for docs, I'll try to whip some up this week. Thanks for the work guys. IEEE 1394 support seems to be maturing nicely :)

Ben

Signature · 9 lines
 .----------====-=-===-=====-----------===------------=-=-----.
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  [email protected]  --  [email protected]  --  [email protected]  '
 `---=====------====-------------=-=-----=-==-===-------=--=---'

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel