On Wed, 10 Jan 2007, Vaclav Barta wrote:

> On Tuesday 09 January 2007 21:27, Alan Stern wrote:
> > On Tue, 9 Jan 2007, Vaclav Barta wrote:
> > > mount: block device /dev/sda1 is write-protected, mounting read-only
> > That's better than before.  As I recall, you couldn't even read the
> > partition table for /dev/sda, let alone try to mount /dev/sda1.
> Yes, I suppose we're making progress...

Your usbmon log is interesting.  It clearly shows that the first time 
/dev/sda1 is probed the write-protect setting is turned off, and the 
second time it is turned on.  Here's the first instance (shortly after the 
initial plug-in):

> df77ed40 949230516 S Bo:002:02 -115 31 = 55534243 06000000 c0000000 8000061a 
> 003f00c0 00000000 00000000 000000
> df77ed40 949230628 C Bo:002:02 0 31 >
> d3beb540 949230652 S Bi:002:01 -115 192 <
> d3beb540 949230751 C Bi:002:01 -121 36 = 23000000 051ef000 10200200 00040000 
> 00000000 00000000 00000000 00000000
> df77ed40 949230775 S Bi:002:01 -115 13 <
> df77ed40 949231008 C Bi:002:01 0 13 = 55534253 06000000 00000000 00

and the second (shortly after the blockdev command):

> df77ed40 1046019796 S Bo:002:02 -115 31 = 55534243 3d000000 c0000000 8000061a 
> 003f00c0 00000000 00000000 000000
> df77ed40 1046019954 C Bo:002:02 0 31 >
> df77e1c0 1046019985 S Bi:002:01 -115 192 <
> df77e1c0 1046020074 C Bi:002:01 -121 36 = 23008000 051ef000 10200200 00040000 
> 00000000 00000000 00000000 00000000
> df77ed40 1046020102 S Bi:002:01 -115 13 <
> df77ed40 1046020324 C Bi:002:01 0 13 = 55534253 3d000000 00000000 00

The crucial difference appears in the lines with the -121 status code.  
Those are the device's responses to the MODE SENSE(6) commands.  The 
write-protect flag is the 0x80 bit of the third byte of the response.  You 
can see that it is clear the first time and set the second time.  I have 
no idea why the device changes the setting.

Here's another approach to try.  Get hold of the "usbreset" program, which 
I posted here:

http://marc.theaimsgroup.com/?l=linux-usb-users&m=116827193506484&w=2

After plugging in your device, when the usual probing fails, do this:
First, run usbreset on it.  Then issue these commands:

        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg0
        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg1
        blockdev --rereadpt /dev/sda

If /dev/sda still ends up being read-only, try this sequence instead:

        usbreset ...
        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg0
        plscsi -x '0 0 0 0 0 0' /dev/sg0
        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg1
        plscsi -x '0 0 0 0 0 0' /dev/sg1
        blockdev --rereadpt /dev/sda

or even this one:

        usbreset ...
        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg0
        plscsi -x '0 0 0 0 0 0' /dev/sg0
        plscsi -x '0 0 0 0 0 0' /dev/sg0
        plscsi -x '12 0 0 0 24 0' -i 36 /dev/sg1
        plscsi -x '0 0 0 0 0 0' /dev/sg1
        plscsi -x '0 0 0 0 0 0' /dev/sg1
        blockdev --rereadpt /dev/sda

Unfortunately I can't think of any way to make this happen transparently
in the kernel.  The stumbling block is that Linux tries to set up each
LUN as it is probed, whereas Windows probes all the LUNs first before
setting up any of them -- and the device definitely wants things done the 
Windows way.

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