Re: [linux-usb-devel] Netac OnlyDisk Mini incorrectly detected as write protected

2007-03-15 Thread Edward Chapman
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.0 +
+++ linux-2.6.20b/drivers/usb/storage/unusual_devs.h	2007-03-13 23:59:21.0 +
@@ -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, 0x, 0x,
+		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.phpp=sourceforgeCID=DEVDEV___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Netac OnlyDisk Mini incorrectly detected as write protected

2007-03-13 Thread Edward Chapman
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).

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?) 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 :)

many thanks,
Eddie


Errors WITHOUT device in unusual_devs.h:

Mar 11 13:16:07 srv1 kernel: usbcore: registered new interface driver
libusual
Mar 11 13:16:07 srv1 kernel: Initializing USB Mass Storage driver...
Mar 11 13:16:07 srv1 kernel: usbcore: registered new interface driver
usb-storage
Mar 11 13:16:07 srv1 kernel: USB Mass Storage support registered.
Mar 11 13:16:23 srv1 kernel: usb 5-2.7: new high speed USB device using
ehci_hcd and address 6
Mar 11 13:16:23 srv1 kernel: usb 5-2.7: configuration #1 chosen from 1
choice
Mar 11 13:16:23 srv1 kernel: scsi2 : SCSI emulation for USB Mass Storage
devices
Mar 11 13:16:23 srv1 kernel: usb-storage: device found at 6
Mar 11 13:16:23 srv1 kernel: usb-storage: waiting for device to settle
before scanning
Mar 11 13:16:28 srv1 kernel: scsi 2:0:0:0: Direct-Access Netac
OnlyDisk 1.10 PQ: 0 ANSI: 2
Mar 11 13:16:28 srv1 kernel: SCSI device sdc: 1024000 512-byte hdwr
sectors (524 MB)
Mar 11 13:16:28 srv1 kernel: sdc: Write Protect is off
Mar 11 13:16:28 srv1 kernel: sdc: Mode Sense: 00 00 00 00
Mar 11 13:16:28 srv1 kernel: sdc: assuming drive cache: write through
Mar 11 13:16:28 srv1 kernel: SCSI device sdc: 1024000 512-byte hdwr
sectors (524 MB)
Mar 11 13:16:28 srv1 kernel: sdc: Write Protect is off
Mar 11 13:16:28 srv1 kernel: sdc: Mode Sense: 00 00 00 00
Mar 11 13:16:28 srv1 kernel: sdc: assuming drive cache: write through
Mar 11 13:16:28 srv1 kernel:  sdc: sdc1
Mar 11 13:16:28 srv1 kernel: sd 2:0:0:0: Attached scsi removable disk
sdc
Mar 11 13:16:28 srv1 kernel: sd 2:0:0:0: Attached scsi generic sg2 type
0
Mar 11 13:16:28 srv1 kernel: usb-storage: device scan complete
Mar 11 13:19:00 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:00 srv1 kernel: end_request: I/O error, dev sdc, sector
8351
Mar 11 13:19:00 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:00 srv1 kernel: end_request: I/O error, dev sdc, sector
8479
Mar 11 13:19:01 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:01 srv1 kernel: end_request: I/O error, dev sdc, sector
8795
Mar 11 13:19:01 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:01 srv1 kernel: end_request: I/O error, dev sdc, sector
8995
Mar 11 13:19:01 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:01 srv1 kernel: end_request: I/O error, dev sdc, sector
9309
Mar 11 13:19:01 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:01 srv1 kernel: end_request: I/O error, dev sdc, sector
9509
Mar 11 13:19:01 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
- SNIP ---
Mar 11 13:19:35 srv1 kernel: end_request: I/O error, dev sdc, sector
48061
Mar 11 13:19:35 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:35 srv1 kernel: end_request: I/O error, dev sdc, sector
48375
Mar 11 13:19:35 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:35 srv1 kernel: end_request: I/O error, dev sdc, sector
48575
Mar 11 13:19:36 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:36 srv1 kernel: end_request: I/O error, dev sdc, sector
48889
Mar 11 13:19:36 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:36 srv1 kernel: end_request: I/O error, dev sdc, sector
49731
Mar 11 13:19:36 srv1 kernel: Buffer I/O error on device sdc1, logical
block 24836
Mar 11 13:19:36 srv1 kernel: Buffer I/O error on device sdc1, logical
block 24837
Mar 11 13:19:36 srv1 kernel: sd 2:0:0:0: SCSI error: return code =
0x1007
Mar 11 13:19:36 srv1 kernel: 

Re: [linux-usb-devel] Netac OnlyDisk Mini incorrectly detected as write protected

2007-03-13 Thread Alan Stern
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


-
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.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel