USB card reader

Taylor, ForrestX forrestx.taylor at intel.com
Tue Nov 25 01:25:26 UTC 2003


On Mon, 2003-11-24 at 16:26, A.J. Bonnema wrote:
> Taylor, ForrestX wrote:
> >>Doing "fdisk -l /dev/sda" gives no result (it just returns).
> >>
> >>The device is being recognized as a ND5010 Card Reader from Neodio 
> >>Technologies Corp. using lsusb and lsusb -s 003:002 -v. Furthermore the 
> >>disk is recognized correctly by cat /proc/bus/usb/devices as a USB 
> >>Storage Device.
> >>
> >>Anyone know what's wrong?
> > 
> > 
> > You may have a problem like I did this weekend:
> > 
> > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=110653
> > 
> > The Fedora/Red Hat kernels don't have multi-LUN support (basically one
> > device with multiple disks).  You can manually add the LUNs in /proc:
> > 
> > echo "scsi-add-single-device 0 0 0 1" > /proc/scsi/scsi
> > echo "scsi-add-single-device 0 0 0 2" > /proc/scsi/scsi
> > echo "scsi-add-single-device 0 0 0 3" > /proc/scsi/scsi
> > 
> > See if that helps.
> > 
> > Forrest
> 
> </gratitude-mode>
> Fantastic! Great! This is it! Thank you very much!!
> <gratitude-mode>
> 
> And thank you for documenting the bug. It works like a charm. I'm very 
> content I can finally read the bugger.....
> 
> What I wonder about is, how did you find the error and how did you find 
> the statements to correct it?

It took me an hour or two of googling to make some sense out of it. 
Originally I was trying to mount /dev/sda1, because I thought that it
would only see one slot at a time.  I eventually found Question 9 under
Trouble Shooting from the FAQ on http://www.linux-usb.org/.  From there
it was just testing and documentation.

I created a patch for USB hotplug that should look at your scsi devices
and send the lines automatically.  If you get a chance, try it out (and
remove the scsi-add-single-device lines you may have added elsewhere.

To use this patch, su to root and cd to /etc/hotplug.  Make a backup
copy of hotplug.functions (cp hotplug.functions hotplug.functions.orig),
and run patch:
patch -p2 < /path/to/hotplug-multilun.patch

Unplug the USB card reader, and plug it back in, and then look at
/proc/scsi/scsi to see if you have more than one device for you card
reader.  I have only tested it a few times, but it works for me.  Let me
know how it works for you.  If it works for you, I'll post it on
bugzilla.

Forrest
-------------- next part --------------
--- /etc/hotplug/hotplug.functions.orig	2003-11-24 12:12:27.000000000 -0800
+++ /etc/hotplug/hotplug.functions	2003-11-24 12:23:16.000000000 -0800
@@ -171,6 +171,19 @@
 	fi
 	if echo "$MODULE" | grep -q "usb-storage" > /dev/null 2>&1 ; then
 	    [ -x /usr/sbin/updfstab ] &&  /usr/sbin/updfstab
+
+	    # Grab the scsi variables from /proc/scsi/scsi
+	    SCSI=`grep -B 1 "USB Card Reader" /proc/scsi/scsi | grep Host | awk '{print $2}' | awk -Fscsi '{print $2}'`
+	    CHANNEL=`grep -B 1 "USB Card Reader" /proc/scsi/scsi | grep Host | awk '{print $4}' | bc -l`
+	    ID=`grep -B 1 "USB Card Reader" /proc/scsi/scsi | grep Host | awk '{print $6}' | bc -l`
+
+	    mesg Adding multi-LUN support
+	    # Add LUNs 1-15
+	    i=1
+	    while [[ $i -lt 16 ]];do
+	    echo "scsi-add-single-device $SCSI $CHANNEL $ID $i" >> /proc/scsi/scsi
+	    i=`echo "$i+1" | bc -l`
+	    done
 	fi
     done
 }


More information about the fedora-list mailing list