Add a second Huawei SCSI eject command as USB mode switch config files

sometimes use one or the other. Maybe newer Huawei modems switched.

Add a quirk for it as well.

PR:		145319
Submitted by:	rozhuk.im gmail.com
This commit is contained in:
Nick Hibma 2014-08-05 09:35:25 +00:00
parent e28d2b2275
commit c5377460ea
5 changed files with 18 additions and 1 deletions

View File

@ -562,6 +562,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = {
[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",

View File

@ -102,6 +102,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 */

View File

@ -86,7 +86,8 @@ SYSCTL_INT(_hw_usb_u3g, OID_AUTO, debug, CTLFLAG_RW,
#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,
@ -720,6 +721,8 @@ u3g_test_autoinst(void *arg, struct usb_device *udev,
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)
@ -740,6 +743,9 @@ u3g_test_autoinst(void *arg, struct usb_device *udev,
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;

View File

@ -103,6 +103,9 @@ static uint8_t scsi_cmotech_eject[] = { 0xff, 0x52, 0x44, 0x45, 0x56, 0x43,
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 };
@ -840,6 +843,11 @@ usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method)
&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

View File

@ -33,6 +33,7 @@ enum {
MSC_EJECT_ZTESTOR,
MSC_EJECT_CMOTECH,
MSC_EJECT_HUAWEI,
MSC_EJECT_HUAWEI2,
MSC_EJECT_TCT,
};