From owner-freebsd-current Thu Dec 19 3:10:53 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7253B37B401 for ; Thu, 19 Dec 2002 03:10:51 -0800 (PST) Received: from smtp1.powertech.no (smtp1.powertech.no [195.159.0.145]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F1A943ED4 for ; Thu, 19 Dec 2002 03:10:50 -0800 (PST) (envelope-from frode@nordahl.net) Received: from ws24.ns5.powertech.no (ws24.ns5.powertech.no [195.159.6.24]) by smtp1.powertech.no (Postfix) with ESMTP id 295F289E2; Thu, 19 Dec 2002 12:10:48 +0100 (CET) Subject: Re: UMASS USB bug? (getting the Sony disk-on-key device working). From: Frode Nordahl To: Matthew Dillon Cc: freebsd-current@FreeBSD.ORG In-Reply-To: <200212191032.gBJAWNj0039522@apollo.backplane.com> References: <200212191032.gBJAWNj0039522@apollo.backplane.com> Content-Type: text/plain Organization: Message-Id: <1040296107.2012.23.camel@ws24.ns5.powertech.no> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 19 Dec 2002 12:08:27 +0100 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hey, Matt While you're at it, could you have a look at PR kern/46176 ? =) At least would you tell me if you have the same problem with your device(s) On Thu, 2002-12-19 at 11:32, Matthew Dillon wrote: > It took a hellofalong time pulling my hair out trying to figure out > why the Sony disk-on-key I just bought didn't work. > > First I added a Quirk entry for the standard 6-byte problem, but it > didn't solve the problem. > > Finally, after slogging through an insane amount of debugging (I mean, > it really generates a lot of debugging if you turn it all on!) I came > up with the following patch. It appears that when an error occurs > and the umass device tries to read the sense data that it fails > comparing: > > sc->transfer_datalen - sc->transfer_actlen != UGETDW(sc->csw.dCSWDataResidue). > > As far as I can sc->transfer_actlen is NEVER updated. It is always 0, so > I don't quite see how the calculation could ever possibly be correct > if DataResidue is what I think it is (a count-down of the number of > unused bytes after a transfer). > > Note that my other UMASS device, a compact flash reader, has always > worked fine with just the Quirk entry. I really need a USB expert to > tell me what is going on :-) > > With the patch below my Sony diskkey works. Note that the junk at the > end of the patch is debugging. I noticed that the CAM layer thought > the READCAPACITY command succeeded when it didn't, and it was generating > weird sector-size errors due to the malloc'd return buffer containing > garbage. I had to put real values in the buffer to catch the problem > consistently. I don't know why the UMASS layer was returning a > success code to CAM for failed READCAPACITY commands but it took an > hour just to figure that CAM was using garbage in the return buffer. > > USB Experts gravitate here! Tell me I'm right or explain to me why I'm > wrong, because this stuff is incredibly complex and I'm having problems > thinking straight at 2:30 a.m. :-) > > -Matt > -- Frode Nordahl To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message