PERFORCE change 150457 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Sep 25 19:00:47 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=150457
Change 150457 by hselasky at 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 <dev/usb2/include/usb2_error.h>
#include <dev/usb2/include/usb2_standard.h>
#include <dev/usb2/include/usb2_ioctl.h>
+#include <dev/usb2/include/usb2_devid.h>
#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)},
More information about the p4-projects
mailing list