From owner-svn-src-all@FreeBSD.ORG Fri Oct 31 08:12:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5825238; Fri, 31 Oct 2014 08:12:06 +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 A5913AC3; Fri, 31 Oct 2014 08:12:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V8C6cg071982; Fri, 31 Oct 2014 08:12:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V8C5dj071974; Fri, 31 Oct 2014 08:12:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410310812.s9V8C5dj071974@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 31 Oct 2014 08:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273891 - in stable/9/sys/dev/usb: . quirk serial X-SVN-Group: stable-9 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: Fri, 31 Oct 2014 08:12:07 -0000 Author: hselasky Date: Fri Oct 31 08:12:04 2014 New Revision: 273891 URL: https://svnweb.freebsd.org/changeset/base/273891 Log: MFC r269575, r269576 and r269578: - Add a second Huawei SCSI eject command as USB mode switch config files sometimes use one or the other. Maybe newer Huawei modems switched. - Return USB_ERR_INVAL if the eject method is not known. PR: 145319 Modified: stable/9/sys/dev/usb/quirk/usb_quirk.c stable/9/sys/dev/usb/quirk/usb_quirk.h stable/9/sys/dev/usb/serial/u3g.c stable/9/sys/dev/usb/usb_msctest.c stable/9/sys/dev/usb/usb_msctest.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/9/sys/dev/usb/quirk/usb_quirk.c Fri Oct 31 08:10:26 2014 (r273890) +++ stable/9/sys/dev/usb/quirk/usb_quirk.c Fri Oct 31 08:12:04 2014 (r273891) @@ -565,6 +565,7 @@ static const char *usb_quirk_str[USB_QUI [UQ_MSC_EJECT_WAIT] = "UQ_MSC_EJECT_WAIT", [UQ_MSC_EJECT_SAEL_M460] = "UQ_MSC_EJECT_SAEL_M460", [UQ_MSC_EJECT_HUAWEISCSI] = "UQ_MSC_EJECT_HUAWEISCSI", + [UQ_MSC_EJECT_HUAWEISCSI2] = "UQ_MSC_EJECT_HUAWEISCSI2", [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", [UQ_BAD_MIDI] = "UQ_BAD_MIDI", [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", Modified: stable/9/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- stable/9/sys/dev/usb/quirk/usb_quirk.h Fri Oct 31 08:10:26 2014 (r273890) +++ stable/9/sys/dev/usb/quirk/usb_quirk.h Fri Oct 31 08:12:04 2014 (r273891) @@ -103,6 +103,7 @@ enum { UQ_MSC_EJECT_WAIT, /* wait for the device to eject */ UQ_MSC_EJECT_SAEL_M460, /* ejects after Sael USB commands */ UQ_MSC_EJECT_HUAWEISCSI, /* ejects after Huawei SCSI command */ + UQ_MSC_EJECT_HUAWEISCSI2, /* ejects after Huawei SCSI 2 command */ UQ_MSC_EJECT_TCT, /* ejects after TCT SCSI command */ UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ Modified: stable/9/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/9/sys/dev/usb/serial/u3g.c Fri Oct 31 08:10:26 2014 (r273890) +++ stable/9/sys/dev/usb/serial/u3g.c Fri Oct 31 08:12:04 2014 (r273891) @@ -88,7 +88,8 @@ SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, #define U3GINIT_WAIT 7 /* Device reappears after a delay */ #define U3GINIT_SAEL_M460 8 /* Requires vendor init */ #define U3GINIT_HUAWEISCSI 9 /* Requires Huawei SCSI init command */ -#define U3GINIT_TCT 10 /* Requires TCT Mobile init command */ +#define U3GINIT_HUAWEISCSI2 10 /* Requires Huawei SCSI init command (2) */ +#define U3GINIT_TCT 11 /* Requires TCT Mobile init command */ enum { U3G_BULK_WR, @@ -725,6 +726,8 @@ u3g_test_autoinst(void *arg, struct usb_ method = U3GINIT_WAIT; else if (usb_test_quirk(uaa, UQ_MSC_EJECT_HUAWEISCSI)) method = U3GINIT_HUAWEISCSI; + else if (usb_test_quirk(uaa, UQ_MSC_EJECT_HUAWEISCSI2)) + method = U3GINIT_HUAWEISCSI2; else if (usb_test_quirk(uaa, UQ_MSC_EJECT_TCT)) method = U3GINIT_TCT; else if (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa) == 0) @@ -745,6 +748,9 @@ u3g_test_autoinst(void *arg, struct usb_ case U3GINIT_HUAWEISCSI: error = usb_msc_eject(udev, 0, MSC_EJECT_HUAWEI); break; + case U3GINIT_HUAWEISCSI2: + error = usb_msc_eject(udev, 0, MSC_EJECT_HUAWEI2); + break; case U3GINIT_SCSIEJECT: error = usb_msc_eject(udev, 0, MSC_EJECT_STOPUNIT); break; Modified: stable/9/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/9/sys/dev/usb/usb_msctest.c Fri Oct 31 08:10:26 2014 (r273890) +++ stable/9/sys/dev/usb/usb_msctest.c Fri Oct 31 08:12:04 2014 (r273891) @@ -98,6 +98,9 @@ static uint8_t scsi_cmotech_eject[] = static uint8_t scsi_huawei_eject[] = { 0x11, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_huawei_eject2[] = { 0x11, 0x06, 0x20, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -477,6 +480,7 @@ bbb_command_start(struct bbb_transfer *s sc->data_rem = data_len; sc->data_timeout = (data_timeout + USB_MS_HZ); sc->actlen = 0; + sc->error = 0; sc->cmd_len = cmd_len; memset(&sc->cbw->CBWCDB, 0, sizeof(sc->cbw->CBWCDB)); memcpy(&sc->cbw->CBWCDB, cmd_ptr, cmd_len); @@ -828,6 +832,11 @@ usb_msc_eject(struct usb_device *udev, u &scsi_huawei_eject, sizeof(scsi_huawei_eject), USB_MS_HZ); break; + case MSC_EJECT_HUAWEI2: + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_huawei_eject2, sizeof(scsi_huawei_eject2), + USB_MS_HZ); + break; case MSC_EJECT_TCT: /* * TCTMobile needs DIR_IN flag. To get it, we @@ -839,9 +848,10 @@ usb_msc_eject(struct usb_device *udev, u break; default: DPRINTF("Unknown eject method (%d)\n", method); - err = 0; - break; + bbb_detach(sc); + return (USB_ERR_INVAL); } + DPRINTF("Eject CD command status: %s\n", usbd_errstr(err)); bbb_detach(sc); Modified: stable/9/sys/dev/usb/usb_msctest.h ============================================================================== --- stable/9/sys/dev/usb/usb_msctest.h Fri Oct 31 08:10:26 2014 (r273890) +++ stable/9/sys/dev/usb/usb_msctest.h Fri Oct 31 08:12:04 2014 (r273891) @@ -33,6 +33,7 @@ enum { MSC_EJECT_ZTESTOR, MSC_EJECT_CMOTECH, MSC_EJECT_HUAWEI, + MSC_EJECT_HUAWEI2, MSC_EJECT_TCT, };