Re: usb flashkey disk copy error

From: Barney Wolff <barney_at_databus.com>
Date: Fri, 12 Sep 2003 15:52:56 -0400
Patch below had some problems.  Needed #ifdef USB_DEBUG around the
ref to ohcidebug to compile, and either BROKEN_OHCI added to the
list of valid options or (as I did) kludged to 1.  Worse, trying
to mount_msdosfs my camera caused an instant panic:  "Length went
negative: -4096".  If that's not enough info, I imagine I can
recreate the panic.

Just to restate my particular problem, I get the wrong data on read
of an existing file from the memory stick on the camera.  I have
not dared to try writing to it since reads don't work.
Thanks,
Barney

On Sun, Sep 07, 2003 at 01:39:08PM -0700, John-Mark Gurney wrote:
> Barney Wolff wrote this message on Sun, Sep 07, 2003 at 15:48 -0400:
> > I can't do more detailed diagnosis right now, but could in a few days.
> 
> When you get a chance (or anyone else who has this problem), try the
> attached patch, and add options BROKEN_OHCI to your kernel config file.
> Please set hw.usb.ohci.debug=1, and send me the dmesg output of the
> writes.  (When you copy the data to the media.)
> 
> Hmmm. I just thought of something.  Now is the data corrupt still correupt
> on another system?  What I mean is did the data get written properly, but
> just isn't being read back from the media correctly.  Unless you are
> coping a file larger than memory size, the cmp just pulls it from memory,
> not from the media.  The umount/mount forces a flush of the cache, and so
> attempts to read from the media.
> 
> Thanks.
> 
> -- 
>   John-Mark Gurney				Voice: +1 415 225 5579
> 
>      "All that I will do, has been done, All that I have, has not."

> Index: ohci.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/dev/usb/ohci.c,v
> retrieving revision 1.132
> diff -u -r1.132 ohci.c
> --- ohci.c	2003/08/24 17:55:54	1.132
> +++ ohci.c	2003/09/07 20:28:13
> _at__at_ -513,6 +513,14 _at__at_
>  
>  	DPRINTFN(alen < 4096,("ohci_alloc_std_chain: start len=%d\n", alen));
>  
> +	if (ohcidebug && alen > 4096) {
> +		printf("len: %d, pages: ", alen);
> +		for (len = 0; len < alen; len += OHCI_PAGE_SIZE) {
> +			printf("%s0x%x", len == 0 ? "" : ", ", DMAADDR(dma,
> +			    len));
> +		}
> +	}
> +
>  	len = alen;
>  	cur = sp;
>  
> _at__at_ -546,9 +554,14 _at__at_
>  		 * We can describe the above using maxsegsz = 4k and nsegs = 2
>  		 * in the future.
>  		 */
> +#if BROKEN_OHCI
> +		if (len < OHCI_PAGE_SIZE - OHCI_PAGE_OFFSET(dataphys))
> +#else
>  		if (OHCI_PAGE(dataphys) == OHCI_PAGE(DMAADDR(dma, offset +
>  		    len - 1)) || len - (OHCI_PAGE_SIZE -
> -		    OHCI_PAGE_OFFSET(dataphys)) <= OHCI_PAGE_SIZE) {
> +		    OHCI_PAGE_OFFSET(dataphys)) <= OHCI_PAGE_SIZE)
> +#endif
> +		{
>  			/* we can handle it in this TD */
>  			curlen = len;
>  		} else {


-- 
Barney Wolff         http://www.databus.com/bwresume.pdf
I'm available by contract or FT, in the NYC metro area or via the 'Net.
Received on Fri Sep 12 2003 - 10:52:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:22 UTC