svn commit: r273891 - in stable/9/sys/dev/usb: . quirk serial
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Oct 31 08:12:07 UTC 2014
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,
};
More information about the svn-src-stable-9
mailing list