On Mon, 29 Jan 2007, Vaclav Barta wrote:

> > However, this doesn't mean the device will actually allow you to write on
> > it!  The only way to find out it to try it.
> >
> > You will still need to use usbreset together with the two plscsi commands
> > and blockdev.  But then you ought to be able to do a normal mount.
> Exactly. :-(  ``mount -t vfat /dev/sda1 /mnt/stick'' succeeds without 
> comments, and so does copying a small (<1KB) file, but when I then 
> unmount /mnt/stick, I get the following in /var/log/messages:
> Jan 29 19:32:44 quanxi kernel: sd 0:0:0:0: SCSI error: return code = 
> 0x08000002
> Jan 29 19:32:44 quanxi kernel: sda: Current: sense key=0x7
> Jan 29 19:32:44 quanxi kernel:     ASC=0x27 ASCQ=0x0

Yes.  Sense key 0x7 means "Data Protect" and ASC 0x27 means "Write 
protected".

> After mounting again, the stick has no trace of the "copied" file...

It was worth a try...

Here's a completely different patch.  You shouldn't need the previous one 
along with this.  This one is completely experimental and unlikely ever to 
be accepted into the standard kernel, but it might get your device to 
work.  The patch causes the SCSI core to send an INQUIRY command to each 
LUN before registering any of them, which is more or less what Windows 
does.  (You might have to apply the patch by hand, like the other one, but 
it shouldn't be too bad.)

Alan Stern


Index: usb-2.6/drivers/scsi/scsi_scan.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_scan.c
+++ usb-2.6/drivers/scsi/scsi_scan.c
@@ -808,14 +808,6 @@ static int scsi_add_lun(struct scsi_devi
                }
        }
 
-       /*
-        * Ok, the device is now all set up, we can
-        * register it and tell the rest of the kernel
-        * about it.
-        */
-       if (scsi_sysfs_add_sdev(sdev) != 0)
-               return SCSI_SCAN_NO_RESPONSE;
-
        return SCSI_SCAN_LUN_PRESENT;
 }
 
@@ -1404,6 +1396,14 @@ void scsi_rescan_device(struct device *d
 }
 EXPORT_SYMBOL(scsi_rescan_device);
 
+static void scsi_add_all_luns(struct scsi_target *starget)
+{
+       struct scsi_device *sdev;
+
+       list_for_each_entry(sdev, &starget->devices, same_target_siblings)
+               scsi_sysfs_add_sdev(sdev);
+}
+
 static void __scsi_scan_target(struct device *parent, unsigned int channel,
                unsigned int id, unsigned int lun, int rescan)
 {
@@ -1444,6 +1444,7 @@ static void __scsi_scan_target(struct de
                        scsi_sequential_lun_scan(starget, bflags,
                                                 starget->scsi_level, rescan);
        }
+       scsi_add_all_luns(starget);
 
  out_reap:
        /* now determine if the target has any children at all


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to