>Number:         177897
>Category:       usb
>Synopsis:       [u3g][patch] add support for the Huawei E352 modem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 17 06:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Damjan Jovanovic
>Release:        PCBSD 9.1
>Organization:
>Environment:
FreeBSD pcbsd-2516 9.1-RELEASE-p2 FreeBSD 9.1-RELEASE-p2 #9 r249522M: Wed Apr 
17 07:59:19 SAST 2013     root@pcbsd-2516:/usr/obj/usr/src/sys/U3GTEST  amd64
>Description:
Add support for the Huawei E352 3G modem, and get u3g to reset it from 
mass-storage device to a 3G modem which can be dialled using /dev/cuaU0.0.

A new SCSI reset command had to be added for this, as using the old 
U3GINIT_HUAWEISCSI command turns the device into a broken Huawei E173 instead.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: sys/dev/usb/quirk/usb_quirk.c
===================================================================
--- sys/dev/usb/quirk/usb_quirk.c       (revision 249522)
+++ sys/dev/usb/quirk/usb_quirk.c       (working copy)
@@ -532,6 +532,7 @@
        [UQ_BAD_MIDI]                   = "UQ_BAD_MIDI",
        [UQ_AU_VENDOR_CLASS]            = "UQ_AU_VENDOR_CLASS",
        [UQ_SINGLE_CMD_MIDI]            = "UQ_SINGLE_CMD_MIDI",
+       [UQ_MSC_EJECT_HUAWEISCSI2]      = "UQ_MSC_EJECT_HUAWEISCSI2",
 };
 
 /*------------------------------------------------------------------------*
Index: sys/dev/usb/quirk/usb_quirk.h
===================================================================
--- sys/dev/usb/quirk/usb_quirk.h       (revision 249522)
+++ sys/dev/usb/quirk/usb_quirk.h       (working copy)
@@ -104,6 +104,8 @@
        UQ_AU_VENDOR_CLASS,     /* audio device uses vendor and not audio class 
*/
        UQ_SINGLE_CMD_MIDI,     /* at most one command per USB packet */
 
+       UQ_MSC_EJECT_HUAWEISCSI2,       /* ejects after another Huawei SCSI 
command */
+
        USB_QUIRK_MAX
 };
 
Index: sys/dev/usb/serial/u3g.c
===================================================================
--- sys/dev/usb/serial/u3g.c    (revision 249522)
+++ sys/dev/usb/serial/u3g.c    (working copy)
@@ -95,6 +95,7 @@
 #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     11      /* Requires another Huawei SCSI 
init command */
 
 enum {
        U3G_BULK_WR,
@@ -285,6 +286,8 @@
        U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI),
        U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI),
        U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI),
+       U3G_DEV(HUAWEI, E352, 0),
+       U3G_DEV(HUAWEI, E352_INIT, U3GINIT_HUAWEISCSI2),
        U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI),
        U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI),
        U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI),
@@ -683,6 +686,8 @@
                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)
@@ -703,6 +708,9 @@
                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;
Index: sys/dev/usb/usb_msctest.c
===================================================================
--- sys/dev/usb/usb_msctest.c   (revision 249522)
+++ sys/dev/usb/usb_msctest.c   (working copy)
@@ -98,6 +98,9 @@
 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 };
@@ -781,6 +784,11 @@
                    &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
Index: sys/dev/usb/usb_msctest.h
===================================================================
--- sys/dev/usb/usb_msctest.h   (revision 249522)
+++ sys/dev/usb/usb_msctest.h   (working copy)
@@ -34,6 +34,7 @@
        MSC_EJECT_CMOTECH,
        MSC_EJECT_HUAWEI,
        MSC_EJECT_TCT,
+       MSC_EJECT_HUAWEI2
 };
 
 int usb_iface_is_cdrom(struct usb_device *udev,
Index: sys/dev/usb/usbdevs
===================================================================
--- sys/dev/usb/usbdevs (revision 249522)
+++ sys/dev/usb/usbdevs (working copy)
@@ -1885,6 +1885,8 @@
 product HUAWEI E1752           0x1446  3G modem
 product HUAWEI K3765           0x1465  3G modem
 product HUAWEI E1820           0x14ac  E1820 HSPA+ USB Slider
+product HUAWEI E352_INIT       0x14fe  E352/E353 3G modem initial
+product HUAWEI E352            0x1506  E352/E353 3G modem
 product HUAWEI K3765_INIT      0x1520  K3765 Initial
 product HUAWEI E173            0x1c05  3G modem
 product HUAWEI E173_INIT       0x1c0b  3G modem initial


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to