From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 6 21:19:46 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1110B106566B for ; Wed, 6 Aug 2008 21:19:46 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.184]) by mx1.freebsd.org (Postfix) with ESMTP id 8974F8FC13 for ; Wed, 6 Aug 2008 21:19:45 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so111998fkk.11 for ; Wed, 06 Aug 2008 14:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=v42Bs46ClJwxAZf/NZOj7bi7TgolF/dERpI7TObQa+s=; b=UmQRDjVHgRJORcTceHhFlTgUa0ukxIZkCYSMopl7iqpOxBKe1iXgtPF5DCxENlCFJr /mtfLmRp8pPEfesOEpCmjZCONb1xcW5Y9hrqUaJs0XxQdyXTuhh+ARxcbJcgYlH4JT5J xKe3chyoiTJtJpkLGbnQMWjtQhFJb3nq9NpNI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; b=rCF8pvoj+gA4C6cJGdnhwMCbZ48VrTWxGFkq/N3el5dDPV9e9AC6AcZtcw6m3MRhXr nlsRt/DDS2FFM+k0q4k2z2RpOgl1DJbduB8Qi0Gxgdt39uZu4w0N33P5YHZAZ8gzccZy SxNlsJBm981FZAfhL/hzYpVS51xBU0OkHOYI4= Received: by 10.180.215.9 with SMTP id n9mr1283242bkg.59.1218055986088; Wed, 06 Aug 2008 13:53:06 -0700 (PDT) Received: from localhost ( [213.184.224.33]) by mx.google.com with ESMTPS id 35sm1050196fkt.12.2008.08.06.13.53.03 (version=SSLv3 cipher=RC4-MD5); Wed, 06 Aug 2008 13:53:05 -0700 (PDT) Date: Thu, 7 Aug 2008 00:01:27 +0300 From: Gleb Kurtsou To: Oliver Fromme Message-ID: <20080806210127.GA1367@h1.d> Mail-Followup-To: Oliver Fromme , freebsd-hackers@freebsd.org References: <20080806125719.GA8008@rebelion.Sisis.de> <200808061729.m76HTVVh003285@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200808061729.m76HTVVh003285@lurza.secnetix.de> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-hackers@freebsd.org Subject: Re: USB key && kernel: da0: Attempt to query device size failed: UNIT ?ATTENTION, Medium not present X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Aug 2008 21:19:46 -0000 On (06/08/2008 19:29), Oliver Fromme wrote: > Matthias Apitz wrote: > > I've updated usb/80361, see > > http://www.freebsd.org/cgi/query-pr.cgi?pr=80361 > > because I have the same problem as well that an USB key attaches fine > > when plugged in at boot time, but not later: Situation here is somewhat opposite. Device doesn't attach at boot or attaches some times. And needs special patch to attach later. % usbdevs -v port 1 addr 2: high speed, power 300 mA, config 1, USB DRIVE(0x0111), 0(0x04e8), rev 2.00 > > I'm just wondering what happens if you enforce a rescan > on the (virtual) SCSI bus. That is, after you have > plugged in the USB stick and the problem occured, type > "camcontrol rescan 0". > > If that doesn't help, please try this patch: > > =============================================================================== > --- src/sys/dev/usb/umass.c.orig 2008-05-21 16:22:03.000000000 +0200 > +++ src/sys/dev/usb/umass.c 2008-08-06 19:23:01.000000000 +0200 > @@ -2690,7 +2690,7 @@ > * completed, when interrupts have been enabled. > */ > > - callout_reset(&sc->cam_scsi_rescan_ch, MS_TO_TICKS(200), > + callout_reset(&sc->cam_scsi_rescan_ch, MS_TO_TICKS(2000), > umass_cam_rescan, sc); > } With this patch it gives following error: Aug 6 23:33:44 h1 kernel: umass0: <0 USB DRIVE, class 0/0, rev 2.00/2.00, addr 2> on uhub2 Aug 6 23:33:46 h1 kernel: da0 at umass-sim0 bus 0 target 0 lun 0 Aug 6 23:33:46 h1 kernel: da0: < USB DRIVE 2.00> Removable Direct Access SCSI-2 device Aug 6 23:33:46 h1 kernel: da0: 40.000MB/s transfers Aug 6 23:33:46 h1 kernel: da0: Attempt to query device size failed: UNIT ATTENTION, Not ready to ready change, I've tried to increase delay up to 4000, nothing changed. Without patch error message is different. Can reproduce it if somebody is interested in it. But what surprises is that with this patch device attaches during boot. > Note that this patch is not a solution. It's purpose is > to find out if the cause of your problem is the same as > the one in PR usb/80361. If it is, the patch from the PR > should be committed (it introduces a quirk for cases like > this), and your USB stick should be added to the quirks > list. I've been using another homemade patch for >2 years. Hope it can help to find a real solution. I have no idea what it does, I'm not sure a had one during writing it back then. Anyway key attaches and just works. diff -r 24788dc12d11 -r 519a067f2475 sys/dev/usb/umass.c --- a/sys/dev/usb/umass.c Sat Jun 03 13:05:16 2006 +0300 +++ b/sys/dev/usb/umass.c Sat Jun 03 13:08:35 2006 +0300 @@ -2514,7 +2514,7 @@ umass_cam_action(struct cam_sim *sim, un sense->extra_len = 10; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | - CAM_AUTOSNS_VALID; + /* CAM_AUTOSNS_VALID */ 0; xpt_done(ccb); return; } @@ -2805,7 +2805,7 @@ umass_cam_sense_cb(struct umass_softc *s */ ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; + | /* CAM_AUTOSNS_VALID */ 0; csio->scsi_status = SCSI_STATUS_CHECK_COND; #if 0 @@ -2836,7 +2836,7 @@ umass_cam_sense_cb(struct umass_softc *s break; } else { ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; + | /* CAM_AUTOSNS_VALID */ 0; csio->scsi_status = SCSI_STATUS_CHECK_COND; } xpt_done(ccb); @@ -2872,7 +2872,7 @@ umass_cam_quirk_cb(struct umass_softc *s ccb->ccb_h.status = CAM_REQ_CMP; #endif ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID; + | /* CAM_AUTOSNS_VALID */ 0; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; xpt_done(ccb); }