From owner-svn-src-all@FreeBSD.ORG Tue Feb 10 13:48:50 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 027B9FF2; Tue, 10 Feb 2015 13:48:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7EF4F7A; Tue, 10 Feb 2015 13:48:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1ADmnnH010807; Tue, 10 Feb 2015 13:48:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1ADmnCg010806; Tue, 10 Feb 2015 13:48:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201502101348.t1ADmnCg010806@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Feb 2015 13:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r278517 - stable/8/sys/dev/usb X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2015 13:48:50 -0000 Author: hselasky Date: Tue Feb 10 13:48:49 2015 New Revision: 278517 URL: https://svnweb.freebsd.org/changeset/base/278517 Log: MFC r278105: Separate out detection of prevent and allow medium removal quirk. PR: 185747 Modified: stable/8/sys/dev/usb/usb_msctest.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.c Tue Feb 10 13:47:29 2015 (r278516) +++ stable/8/sys/dev/usb/usb_msctest.c Tue Feb 10 13:48:49 2015 (r278517) @@ -106,6 +106,8 @@ static uint8_t scsi_request_sense[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_read_capacity[] = { 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_prevent_removal[] = { 0x1e, 0, 0, 0, 1, 0 }; +static uint8_t scsi_allow_removal[] = { 0x1e, 0, 0, 0, 0, 0 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -675,10 +677,28 @@ usb_msc_auto_quirk(struct usb_device *ud USB_MS_HZ); if (err != 0) { + if (err != ERR_CSW_FAILED) + goto error; + DPRINTF("Test unit ready failed\n"); + } + err = bbb_command_start(sc, DIR_OUT, 0, NULL, 0, + &scsi_prevent_removal, sizeof(scsi_prevent_removal), + USB_MS_HZ); + + if (err == 0) { + err = bbb_command_start(sc, DIR_OUT, 0, NULL, 0, + &scsi_allow_removal, sizeof(scsi_allow_removal), + USB_MS_HZ); + } + + if (err != 0) { if (err != ERR_CSW_FAILED) goto error; + DPRINTF("Device doesn't handle prevent and allow removal\n"); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW); } + timeout = 1; retry_sync_cache: @@ -691,11 +711,9 @@ retry_sync_cache: if (err != ERR_CSW_FAILED) goto error; - DPRINTF("Device doesn't handle synchronize cache " - "and prevent allow medium removal\n"); + DPRINTF("Device doesn't handle synchronize cache\n"); usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); - usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW); } else { /* @@ -722,13 +740,10 @@ retry_sync_cache: goto retry_sync_cache; DPRINTF("Device most likely doesn't " - "handle synchronize cache nor" - "prevent allow medium removal\n"); + "handle synchronize cache\n"); usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); - usbd_add_dynamic_quirk(udev, - UQ_MSC_NO_PREVENT_ALLOW); } else { if (err != ERR_CSW_FAILED) goto error;