From owner-freebsd-usb@FreeBSD.ORG Wed Apr 17 06:50:00 2013 Return-Path: Delivered-To: freebsd-usb@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ED576D66 for ; Wed, 17 Apr 2013 06:50:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id D4A3DEC9 for ; Wed, 17 Apr 2013 06:50:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r3H6o0Lo070761 for ; Wed, 17 Apr 2013 06:50:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r3H6o0sU070741; Wed, 17 Apr 2013 06:50:00 GMT (envelope-from gnats) Resent-Date: Wed, 17 Apr 2013 06:50:00 GMT Resent-Message-Id: <201304170650.r3H6o0sU070741@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Damjan Jovanovic Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F987AF2 for ; Wed, 17 Apr 2013 06:40:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E3C51E74 for ; Wed, 17 Apr 2013 06:40:38 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r3H6ebaD088428 for ; Wed, 17 Apr 2013 06:40:37 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r3H6ebxe088427; Wed, 17 Apr 2013 06:40:37 GMT (envelope-from nobody) Message-Id: <201304170640.r3H6ebxe088427@red.freebsd.org> Date: Wed, 17 Apr 2013 06:40:37 GMT From: Damjan Jovanovic To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: usb/177897: [u3g][patch] add support for the Huawei E352 modem X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 06:50:01 -0000 >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: