From owner-p4-projects@FreeBSD.ORG Thu Sep 25 19:00:46 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BDAB01065690; Thu, 25 Sep 2008 19:00:46 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80F18106569E for ; Thu, 25 Sep 2008 19:00:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6E0748FC1A for ; Thu, 25 Sep 2008 19:00:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8PJ0kjM066900 for ; Thu, 25 Sep 2008 19:00:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8PJ0kh7066894 for perforce@freebsd.org; Thu, 25 Sep 2008 19:00:46 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 25 Sep 2008 19:00:46 GMT Message-Id: <200809251900.m8PJ0kh7066894@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 150457 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2008 19:00:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=150457 Change 150457 by hselasky@hselasky_laptop001 on 2008/09/25 19:00:15 Pre IFC @ 150453 The Huawei IDs have been moved to UGENSA. They are not compatible with the UBSA driver. Add automatic removal of Huawei auto-install disk. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#26 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_msctest.c#8 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_msctest.h#4 edit .. //depot/projects/usb/src/sys/dev/usb2/serial/ubsa2.c#9 edit .. //depot/projects/usb/src/sys/dev/usb2/serial/ugensa2.c#10 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#26 (text+ko) ==== @@ -29,6 +29,7 @@ #include #include #include +#include #define USB_DEBUG_VAR usb2_debug @@ -1579,8 +1580,9 @@ config_index, usb2_errstr(err), udev->port_no, udev->address); - } else if ((!config_quirk) && - ((config_index + 1) < udev->ddesc.bNumConfigurations)) { + } else if (config_quirk) { + /* user quirk selects configuration index */ + } else if ((config_index + 1) < udev->ddesc.bNumConfigurations) { if ((udev->cdesc->bNumInterface < 2) && (usb2_get_no_endpoints(udev->cdesc) == 0)) { @@ -1601,6 +1603,11 @@ goto repeat_set_config; } } + } else if (UGETW(udev->ddesc.idVendor) == USB_VENDOR_HUAWEI) { + if (usb2_test_huawei(udev, 0) == 0) { + DPRINTFN(0, "Found Huawei auto-install disk!\n"); + err = USB_ERR_STALLED; /* fake an error */ + } } } else { err = 0; /* set success */ ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_msctest.c#8 (text+ko) ==== @@ -564,3 +564,49 @@ free(sc, M_USB); return (err); } + +/* + * Huawei Exxx radio devices have a built in flash disk which is their + * default power up configuration. This allows the device to carry its + * own installation software. + * + * Instead of following the USB spec, and create multiple + * configuration descriptors for this, the devices expects the driver + * to send UF_DEVICE_REMOTE_WAKEUP to endpoint 2 to reset the device, + * so it reprobes, now with the radio exposed. + */ + +usb2_error_t +usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index) +{ + struct usb2_device_request req; + struct usb2_interface *iface; + struct usb2_interface_descriptor *id; + usb2_error_t err; + + if (udev == NULL) { + return (USB_ERR_INVAL); + } + iface = usb2_get_iface(udev, iface_index); + if (iface == NULL) { + return (USB_ERR_INVAL); + } + id = iface->idesc; + if (id == NULL) { + return (USB_ERR_INVAL); + } + if (id->bInterfaceClass != UICLASS_MASS) { + return (USB_ERR_INVAL); + } + /* Bend it like Beckham */ + req.bmRequestType = UT_WRITE_DEVICE; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, 2); + USETW(req.wLength, 0); + + /* We get error at return, but it works */ + err = usb2_do_request_flags(udev, NULL, &req, NULL, 0, NULL, 1 * USB_MS_HZ); + + return (0); /* success */ +} ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_msctest.h#4 (text+ko) ==== @@ -28,5 +28,6 @@ #define _USB2_MSCTEST_H_ usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index); +usb2_error_t usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index); #endif /* _USB2_MSCTEST_H_ */ ==== //depot/projects/usb/src/sys/dev/usb2/serial/ubsa2.c#9 (text+ko) ==== @@ -289,8 +289,6 @@ {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36, 0)}, /* Option GlobeTrotter 3G QUAD */ {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD, 0)}, - /* Huawei Mobile */ - {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE, 0)}, /* Sierra Wireless LENOVO UMTS card */ {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3, 0)}, /* Qualcomm, Inc. ZTE CDMA */ ==== //depot/projects/usb/src/sys/dev/usb2/serial/ugensa2.c#10 (text+ko) ==== @@ -179,6 +179,7 @@ {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 0)}, {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 0)}, {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E270, 0)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE, 0)}, {USB_VPI(USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620, 0)}, {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM, 0)}, {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620, 0)},