From owner-freebsd-usb@FreeBSD.ORG Wed Apr 4 14:09:11 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B002C16A401 for ; Wed, 4 Apr 2007 14:09:11 +0000 (UTC) (envelope-from freebsdusb@bindone.de) Received: from mail.bindone.de (sidewinder.bindone.de [62.146.109.98]) by mx1.freebsd.org (Postfix) with SMTP id 29A2013C448 for ; Wed, 4 Apr 2007 14:09:10 +0000 (UTC) (envelope-from freebsdusb@bindone.de) Received: (qmail 13521 invoked from network); 4 Apr 2007 14:05:49 -0000 Received: from unknown (HELO bombat.bindone.de) (84.151.221.254) by mail.bindone.de with SMTP; 4 Apr 2007 14:05:49 -0000 Message-ID: <4613B17D.3020701@bindone.de> Date: Wed, 04 Apr 2007 16:09:01 +0200 From: grem User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.2) Gecko/20070318 SeaMonkey/1.1.1 MIME-Version: 1.0 To: freebsd-usb@freebsd.org References: <200703290011.l2T0BAKa035949@www.freebsd.org> In-Reply-To: <200703290011.l2T0BAKa035949@www.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: usb/110988: [patch] Handling of quirk IGNORE_RESIDUE is umass.c is broken X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2007 14:09:11 -0000 Hi, is there any way to get this into the source tree? Michael Gmelin wrote: >> Number: 110988 >> Category: usb >> Synopsis: [patch] Handling of quirk IGNORE_RESIDUE is umass.c is broken >> Confidential: no >> Severity: serious >> Priority: medium >> Responsible: freebsd-usb >> State: open >> Quarter: >> Keywords: >> Date-Required: >> Class: sw-bug >> Submitter-Id: current-users >> Arrival-Date: Thu Mar 29 00:20:02 GMT 2007 >> Closed-Date: >> Last-Modified: >> Originator: Michael Gmelin >> Release: FreeBSD 6.2-RELEASE-p3 i386 >> Organization: > /bin/done digital solutions GmbH >> Environment: > FreeBSD bombat.bindone.de 6.2-RELEASE-p3 FreeBSD 6.2-RELEASE-p3 #21: Wed Mar 28 04:08:44 CEST 2007 root@bombat.bindone.de:/usr/src/sys/i386/compile/bombat i386 >> Description: > I had to add a new device to usbdevs/umass.c which requires the IGNORE_RESIDUE quirk to be set (extra PR will follow). It didn't work, because IGNORE_RESIDUE isn't handled properly in umass.c (it isn't really handled at all, since Residue is set in lines are 1668-1672 in > umass.c in the following was: > > int Residue; > Residue = UGETDW(sc->csw.dCSWDataResidue); > if (Residue == 0 && > sc->transfer_datalen - sc->transfer_actlen != 0) > Residue = sc->transfer_datalen - sc->transfer_actlen; > > The patch below fixes this issue (tested and proven to work). >> How-To-Repeat: > Use a really broken USB device which returns "random" values for sc->csw.dCSWDataResidue (like devices that use the SuperTop IDEDEVICE USB controller, e.g. the ICY BOX IB-220U-Wh). Every attempt to use the device will lead to error messages, like: > > dd if=/dev/zero of=/dev/da0 count=10 > da0: end of device > > or > > disklabel da0 > read: Unknown error > etc. > >> Fix: > Apply the attached patch, which forces residue to be calculated if IGNORE_RESIDUE is set. > > > Patch attached with submission follows: > > --- umass.c.orig Thu Mar 29 02:07:04 2007 > +++ umass.c Thu Mar 29 02:08:06 2007 > @@ -1666,7 +1666,10 @@ > } > > int Residue; > - Residue = UGETDW(sc->csw.dCSWDataResidue); > + if (sc->quirks & IGNORE_RESIDUE) > + Residue = 0; > + else > + Residue = UGETDW(sc->csw.dCSWDataResidue); > if (Residue == 0 && > sc->transfer_datalen - sc->transfer_actlen != 0) > Residue = sc->transfer_datalen - sc->transfer_actlen; > >> Release-Note: >> Audit-Trail: >> Unformatted: > _______________________________________________ > freebsd-usb@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-usb > To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org"