Re: [linux-usb-devel] Re: [PATCH] USB changes for 2.5.58

David Brownell
2003-01-16T20:40:00Z

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

Greg KH wrote:
> On Thu, Jan 16, 2003 at 11:43:23AM -0800, Matthew Dharm wrote:
>
>>Well, we only create the host when the device is first attached. After
>>that, if it goes away and comes back, we re-connect it to the old SCSI
>>host.
>
>
> Ick, so when the device is gone, where does the SCSI host go? Is it
> still represented in sysfs and in the SCSI core properly?

Just for the record ... I think usb-storage is the only USB driver
that tries to keep state about devices across disconnect/reconnect.

I agree with Greg that hotplugging (including unplug/replug) should
work well with SCSI. But given the problems of determining "identity"
of a disk (or volume or whatever) I'm sort of curious what working
well should really mean.

Have any of the SCSI people been looking much at SCSI hotplug on 2.5?
I attach "/etc/hotplug/scsi.agent" from one of my desktops; all it
does is make sure the right drivers are loaded, it doesn't have a
clue yet about whether/how/where to mount disks or do other stuff.

- Dave

[-- Attachment #2: scsi.agent --]
[-- Type: text/plain, Size: 1022 bytes --]

#!/bin/bash
#
# SCSI hotplug agent for 2.5 kernels
#
# ACTION=add
# DEVPATH=devices/scsi0/0:0:0:0
#

cd /etc/hotplug
. hotplug.functions

case $ACTION in

add)
# 2.5.50 kernel bug: this happens sometimes
if [ ! -d /sys/$DEVPATH ]; then
mesg "bogus sysfs DEVPATH=$DEVPATH"
exit 1
fi

TYPE=$(cat /sys/$DEVPATH/type)
case "$TYPE" in
# 2.5.51 style attributes; <scsi/scsi.h> TYPE_* constants
0) TYPE=disk ; MODULE=sd_mod ;;
# FIXME some tapes use 'osst' not 'st'
1) TYPE=tape ; MODULE=st ;;
2) TYPE=printer ;;
3) TYPE=processor ;;
4) TYPE=worm ; MODULE=sr_mod ;;
5) TYPE=cdrom ; MODULE=sr_mod ;;
6) TYPE=scanner ;;
7) TYPE=mod ; MODULE=sd_mod ;;
8) TYPE=changer ;;
9) TYPE=comm ;;
14) TYPE=enclosure ;;
esac
if [ "$MODULE" != "" ]; then
mesg "$TYPE at $DEVPATH"
modprobe $MODULE
else
mesg "how to add device type=$TYPE at $DEVPATH ??"
fi
;;

*)
debug_mesg SCSI $ACTION event not supported
exit 1
;;

esac