Netac OnlyDisk Mini incorrectly detected as write protected

Edward Chapman <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
            <--------- 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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
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 =
0x10070000
Mar 11 13:19:36 srv1 kernel: end_request: I/O error, dev sdc, sector
49921
Mar 11 13:21:19 srv1 kernel: usbcore: deregistering interface driver
usb-storage

-------------------------------------------------------------------------
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

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
unusual_devs.h.patch (text/x-patch, 659 B)
--- 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,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.