Many thanks for the reply Alan!
Well I finally had a chance to compile debugfs and usbmon into my 2.6.20
kernel just now. I also took out my hack of
sd_read_write_protect_flag() in drivers/scsi/sd.c to reintroduce the
write protect problem. I left the device in
drivers/usb/storage/unusual_devs.h.
And would you believe it, on rebooting and plugging the stick in, it
correctly detected it as NOT write protected. So with the device added
to unusual_devs.h with US_FL_IGNORE_RESIDUE, it works perfectly :)
I think what happened is when I was originally testing I would remove
the usb-storage module, make changes to unusual_devs.h, then modprobe
the module again. SCSI sd was compiled into the kernel, and I didn't
reboot the whole time I was testing. Therefore I think continually
removing/reinserting the module with changes each time, combined with
plugging/unplugging the stick, and not reloading the SCSI sd code, must
have confused the kernel somehow, causing it to incorrectly detect it as
write protected.
Anyway, bottom line is it works perfectly now, but requires adding the
device to unusual_devs.h
I've attached the patch again that does this. Is it possible to get
this added upstream?
regards,
Eddie
On Tue, 2007-03-13 at 22:07 -0400, Alan Stern wrote:
> On Wed, 14 Mar 2007, Edward Chapman wrote:
>
> > Hi,
> >
> > On vanilla kernel 2.6.20, Netac OnlyDisk Mini 512MB usb stick lets you
> > write a file and copy it from the device until it is unmounted. Upon
> > mounting the device again, attempts to copy the file written on last
> > mount results in SCSI I/O errors and the cp command eventually failing
> > (see error log at the bottom of this message).
>
> Those error messages aren't very informative. It would help to have a
> usbmon log. Instructions for usbmon are in the kernel source file
> Documentation/usb/usbmon.txt.
>
> Post a log showing what happens when you mount the drive, copy a short
> file (no more than 1 KB), unmount it, mount it again, and try to copy the
> file back.
>
> > The good news is adding the device to drivers/usb/storage/unusual_devs.h
> > with the US_FL_IGNORE_RESIDUE flag completely cures the problem :) I've
> > attached a patch against 2.6.20 to add the device to this file.
> >
> > The bad news is adding the device to unusual_devs.h and using any of the
> > flags (I tried many of them) causes the device to be incorrectly
> > detected as write protected. I tried using US_FL_NO_WP_DETECT (does
> > this disable write protect?)
>
> It doesn't disable write-protect -- the only way to do that is by setting
> the device's switch off. However it does prevent the kernel from asking
> the device whether it is write-protected.
>
> > but to no avail. I've had to hack
> > sd_read_write_protect_flag() in drivers/scsi/sd.c to disable write
> > protect detection in order to use the device with it added to
> > unusual_devs.h.
> >
> > Without adding the device to unusual_devs.h, write protect detection
> > works fine. The device does have a write protect switch by the way, and
> > yes I have it set to off.
> >
> > So my question is can anyone help me figure out the incorrect write
> > protect detection problem? I can test, provide whatever info needed. I
> > have over 40 of these devices so I'm desperate to iron out this last
> > issue :)
>
> Post another usbmon log showing what happens with your unusual_devs entry
> present.
>
> Alan Stern
>
--- linux-2.6.20/drivers/usb/storage/unusual_devs.h 2007-03-09 18:58:04.000000000 +0000
+++ linux-2.6.20b/drivers/usb/storage/unusual_devs.h 2007-03-13 23:59:21.000000000 +0000
@@ -1286,6 +1286,14 @@
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
+/* Reported by Edward Chapman <[EMAIL PROTECTED]>
+ Netac OnlyDisk Mini U2CV2 512MB USB 2.0 Flash Drive */
+UNUSUAL_DEV( 0x0dd8, 0xd202, 0x0000, 0x9999,
+ "Netac",
+ "USB Flash Disk",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_IGNORE_RESIDUE ),
+
/* Reported by Benjamin Schiller <[EMAIL PROTECTED]>
* It is also sold by Easylite as DJ 20 */
UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103,
-------------------------------------------------------------------------
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-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel