On Thu, 15 Apr 2004, Johan Braeken wrote:

> I read about the "scsiglue.c" file on this mailinglist and decided to do some 
> testing.
> With a "max_sectors" value of 16 I got the fastest transferrate, so my slow 
> USB problem is solved. (Although it is not a real solution.)
> The transferrate improved from 12,9kB/s to 218,8kB/s. That's a big 
> difference. ;-)

It sure is.  And it indicates the underlying problem is almost certainly
some limitation in your camera's firmware.

> Is the sectorsize something that is negotiated when the USB device is plugged 
> in?

No, the sector size is fixed at 512 bytes.  The max_sector value is set by 
default in the usb-storage driver to 240, but you can change it by editing 
the source file (as you did) or, under Linux 2.6, by using sysfs.


> Before changing scsiglue.c the logfiles went like this:
> 
> When I was lucky the transfer was only really slow. I could see the "activity 
> light" light up once, then 5 seconds nothing, one little blink, 5 seconds 
> nothing, ...
> This behaviour is reflected when you look at the timestamp of the "*** thread 
> awakened." messages.
> 
> When I was not so lucky, my camera would lock up and the batteries needed to 
> be removed to bring it back to life. I think this is what happened when you 
> investigate these logfiles further.
> 
> After changing the scsiglue.c file, the accesslight is flashing really fast 
> during transfers.

That's a pretty clear indication your camera doesn't like transferring
more than 8 KB at a time, or that something is interfering with it.  When
asked to send 64 KB, as in the log below, it takes 5 seconds to complete
the transfer.  And sometimes it crashes completely.


> Apr 11 22:18:55 paranoid usb-storage: *** thread awakened.
> Apr 11 22:18:55 paranoid usb-storage: Command READ_10 (10 bytes)
> Apr 11 22:18:55 paranoid usb-storage:  28 00 00 00 84 4f 00 00 80 00
> Apr 11 22:18:55 paranoid usb-storage: Bulk Command S 0x43425355 T 0x45 L 65536 
> F 128 Trg 0 LUN 0 CL 10
> Apr 11 22:18:55 paranoid usb-storage: usb_stor_bulk_transfer_buf: xfer 31 
> bytes
> Apr 11 22:18:55 paranoid usb-storage: Status code 0; transferred 31/31
> Apr 11 22:18:55 paranoid usb-storage: -- transfer complete
> Apr 11 22:18:55 paranoid usb-storage: Bulk command transfer result=0
> Apr 11 22:18:55 paranoid usb-storage: usb_stor_bulk_transfer_sglist: xfer 
> 65536 bytes, 16 entries
> Apr 11 22:18:59 paranoid usb-storage: Status code 0; transferred 65536/65536
> Apr 11 22:18:59 paranoid usb-storage: -- transfer complete
> Apr 11 22:18:59 paranoid usb-storage: Bulk data transfer result 0x0

There, you can see, the transfer took 5 seconds.  It's the camera that 
determines the rate of the transfer.

> Apr 11 22:18:59 paranoid usb-storage: Attempting to get CSW...
> Apr 11 22:18:59 paranoid usb-storage: usb_stor_bulk_transfer_buf: xfer 13 
> bytes
> Apr 11 22:18:59 paranoid usb-storage: Status code 0; transferred 13/13
> Apr 11 22:18:59 paranoid usb-storage: -- transfer complete
> Apr 11 22:18:59 paranoid usb-storage: Bulk status result = 0
> Apr 11 22:18:59 paranoid usb-storage: Bulk Status S 0x53425355 T 0x45 R 0 Stat 
> 0x0
> Apr 11 22:18:59 paranoid usb-storage: scsi cmd done, result=0x0
> Apr 11 22:18:59 paranoid usb-storage: *** thread sleeping.


> Apr 11 22:19:04 paranoid usb-storage: queuecommand called
> Apr 11 22:19:04 paranoid usb-storage: *** thread awakened.
> Apr 11 22:19:04 paranoid usb-storage: Command READ_10 (10 bytes)
> Apr 11 22:19:04 paranoid usb-storage:  28 00 00 00 85 4f 00 00 80 00
> Apr 11 22:19:04 paranoid usb-storage: Bulk Command S 0x43425355 T 0x47 L 65536 
> F 128 Trg 0 LUN 0 CL 10
> Apr 11 22:19:04 paranoid usb-storage: usb_stor_bulk_transfer_buf: xfer 31 
> bytes
> Apr 11 22:19:04 paranoid usb 2-1: control timeout on ep0in
> Apr 11 22:19:09 paranoid usb 2-1: control timeout on ep0in
> Apr 11 22:19:14 paranoid usb 2-1: control timeout on ep0in
> Apr 11 22:19:19 paranoid usb 2-1: control timeout on ep0in
> Apr 11 22:19:24 paranoid usb 2-1: control timeout on ep0in
> Apr 11 22:19:29 paranoid usb 2-1: control timeout on ep0in

I don't know what caused those messages to appear.  They didn't come from
usb-storage.  Do you have another program that might be trying to access
your camera at the same time?  (Hint: try "lsof | grep /proc/bus/usb".)  

Some devices don't like it when that happens.  You might find when you
turn the other program off you can use the original value of max_sectors
with no problem.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to