Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Add support for some new and old ZTE modems, som...
details: https://anonhg.NetBSD.org/src/rev/36c85f6dae0e
branches: trunk
changeset: 789000:36c85f6dae0e
user: soren <soren%NetBSD.org@localhost>
date: Sat Aug 03 16:04:30 2013 +0000
description:
Add support for some new and old ZTE modems, some of which have a
SFF-8070i virtual installer CD instead of a SCSI class one.
Recent Huawei modems support (and in the case of the very latest models,
require) the use of a CDC NCM interface as an alternative to PPP. Avoid
attaching u3g to that interface.
diffstat:
sys/dev/usb/u3g.c | 78 +++++++++++++++++++++++++++++++++++++++++++--------
sys/dev/usb/ugensa.c | 6 ++--
sys/dev/usb/usbdevs | 20 +++++++++----
3 files changed, 82 insertions(+), 22 deletions(-)
diffs (241 lines):
diff -r d3d6384967b3 -r 36c85f6dae0e sys/dev/usb/u3g.c
--- a/sys/dev/usb/u3g.c Sat Aug 03 13:23:10 2013 +0000
+++ b/sys/dev/usb/u3g.c Sat Aug 03 16:04:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: u3g.c,v 1.28 2013/03/14 13:08:56 nonaka Exp $ */
+/* $NetBSD: u3g.c,v 1.29 2013/08/03 16:04:30 soren Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.28 2013/03/14 13:08:56 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.29 2013/08/03 16:04:30 soren Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -219,8 +219,6 @@
{ USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_HSDPA },
{ USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_GTMAXHSUPA },
/* OEM: Qualcomm, Inc. */
- { USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM },
- { USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_ZTE_MF626 },
{ USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_NTT_DOCOMO_L02C_MODEM },
/* OEM: Sierra Wireless: */
@@ -254,6 +252,12 @@
/* Toshiba */
{ USB_VENDOR_TOSHIBA, USB_PRODUCT_TOSHIBA_HSDPA_MODEM_EU870DT1 },
+ /* ZTE */
+ { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF622 },
+ { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF626 },
+ { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF628 },
+ { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF820D },
+
/* 4G Systems */
{ USB_VENDOR_4GSYSTEMS, USB_PRODUCT_4GSYSTEMS_XSSTICK_P14 },
};
@@ -271,7 +275,7 @@
/* Move the device into the configured state. */
err = usbd_set_config_index(dev, 0, 0);
if (err) {
- aprint_error("u3g: failed to set configuration index\n");
+ aprint_error("u3ginit: failed to set config index\n");
return UMATCH_NONE;
}
@@ -330,7 +334,7 @@
}
static int
-u3g_novatel_reinit(usbd_device_handle dev)
+u3g_bulk_scsi_eject(usbd_device_handle dev)
{
unsigned char cmd[31];
@@ -347,7 +351,9 @@
/* 13: CBW Lun: 0 */
/* 14: CBW Length */
cmd[14] = 0x06;
+
/* Rest is the SCSI payload */
+
/* 0: SCSI START/STOP opcode */
cmd[15] = 0x1b;
/* 1..3 unused */
@@ -359,6 +365,37 @@
}
static int
+u3g_bulk_ata_eject(usbd_device_handle dev)
+{
+ unsigned char cmd[31];
+
+ memset(cmd, 0, sizeof(cmd));
+ /* Byte 0..3: Command Block Wrapper (CBW) signature */
+ cmd[0] = 0x55;
+ cmd[1] = 0x53;
+ cmd[2] = 0x42;
+ cmd[3] = 0x43;
+ /* 4..7: CBW Tag, has to unique, but only a single transfer used. */
+ cmd[4] = 0x01;
+ /* 8..11: CBW Transfer Length, no data here */
+ /* 12: CBW Flag: output, so 0 */
+ /* 13: CBW Lun: 0 */
+ /* 14: CBW Length */
+ cmd[14] = 0x06;
+
+ /* Rest is the SCSI payload */
+
+ /* 0: ATA pass-through */
+ cmd[15] = 0x85;
+ /* 1..3 unused */
+ /* 4 XXX What is this command? */
+ cmd[19] = 0x24;
+ /* 5: unused */
+
+ return send_bulkmsg(dev, cmd, sizeof(cmd));
+}
+
+static int
u3g_huawei_reinit(usbd_device_handle dev)
{
/*
@@ -517,7 +554,7 @@
switch (uaa->product){
case USB_PRODUCT_NOVATEL2_MC950D_DRIVER:
case USB_PRODUCT_NOVATEL2_U760_DRIVER:
- return u3g_novatel_reinit(uaa->device);
+ return u3g_bulk_scsi_eject(uaa->device);
break;
default:
break;
@@ -529,14 +566,21 @@
return u3g_sierra_reinit(uaa->device);
break;
- case USB_VENDOR_QUALCOMMINC:
- if (uaa->product == USB_PRODUCT_QUALCOMMINC_ZTE_STOR)
- return u3g_novatel_reinit(uaa->device);
+ case USB_VENDOR_QUALCOMM:
+ if (uaa->product == USB_PRODUCT_QUALCOMM_NTT_DOCOMO_L02C_STORAGE)
+ return u3g_bulk_scsi_eject(uaa->device);
break;
- case USB_VENDOR_QUALCOMM:
- if (uaa->product == USB_PRODUCT_QUALCOMM_NTT_DOCOMO_L02C_STORAGE)
- return u3g_novatel_reinit(uaa->device);
+ case USB_VENDOR_ZTE:
+ switch (uaa->product){
+ case USB_PRODUCT_ZTE_INSTALLER:
+ case USB_PRODUCT_ZTE_MF820D_INSTALLER:
+ (void)u3g_bulk_ata_eject(uaa->device);
+ (void)u3g_bulk_scsi_eject(uaa->device);
+ return UMATCH_HIGHEST;
+ default:
+ break;
+ }
break;
case USB_VENDOR_4GSYSTEMS:
@@ -614,6 +658,14 @@
}
/*
+ * Huawei modems use the vendor-specific class for all interfaces,
+ * both tty and CDC NCM, which we should avoid attaching to.
+ */
+ if (uaa->vendor == USB_VENDOR_HUAWEI && id->bInterfaceSubClass == 2 &&
+ (id->bInterfaceProtocol & 0xf) == 6) /* 0x16, 0x46, 0x76 */
+ return (UMATCH_NONE);
+
+ /*
* 3G modems generally report vendor-specific class
*
* XXX: this may be too generalised.
diff -r d3d6384967b3 -r 36c85f6dae0e sys/dev/usb/ugensa.c
--- a/sys/dev/usb/ugensa.c Sat Aug 03 13:23:10 2013 +0000
+++ b/sys/dev/usb/ugensa.c Sat Aug 03 16:04:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugensa.c,v 1.30 2011/12/23 00:51:46 jakllsch Exp $ */
+/* $NetBSD: ugensa.c,v 1.31 2013/08/03 16:04:30 soren Exp $ */
/*
* Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugensa.c,v 1.30 2011/12/23 00:51:46 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugensa.c,v 1.31 2013/08/03 16:04:30 soren Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -96,8 +96,8 @@
{{ USB_VENDOR_DELL, USB_PRODUCT_DELL_HSDPA }, 0 },
{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_FLEXPACKGPS }, 0 },
{{ USB_VENDOR_QUALCOMM_K, USB_PRODUCT_QUALCOMM_K_CDMA_MSM_K }, 0 },
- {{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_AC8700 }, 0 },
{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305 }, 0 },
+ {{ USB_VENDOR_ZTE, USB_PRODUCT_ZTE_AC8700 }, 0 },
/*
* The following devices are untested, but they are purported to
diff -r d3d6384967b3 -r 36c85f6dae0e sys/dev/usb/usbdevs
--- a/sys/dev/usb/usbdevs Sat Aug 03 13:23:10 2013 +0000
+++ b/sys/dev/usb/usbdevs Sat Aug 03 16:04:30 2013 +0000
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.650 2013/05/27 16:32:58 kiyohara Exp $
+$NetBSD: usbdevs,v 1.651 2013/08/03 16:04:30 soren Exp $
/*
* Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -529,7 +529,7 @@
vendor QCOM 0x18e8 Qcom
vendor LINKSYS3 0x1915 Linksys
vendor MEINBERG 0x1938 Meinberg Funkuhren
-vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated
+vendor ZTE 0x19d2 ZTE
vendor QUANTA 0x1a32 Quanta
vendor TERMINUS 0x1a40 Terminus Technology
vendor WINCHIPHEAD2 0x1a86 QinHeng Electronics
@@ -2578,10 +2578,6 @@
product QUALCOMM MSM_HSDPA 0x6613 HSDPA MSM
product QUALCOMM2 RWT_FCT 0x3100 RWT FCT-CDMA 2000 1xRTT modem
product QUALCOMM2 CDMA_MSM 0x3196 CDMA Technologies MSM modem
-product QUALCOMMINC CDMA_MSM 0x0001 CDMA Technologies MSM modem
-product QUALCOMMINC ZTE_MF626 0x0031 CDMA Technologies MSM modem
-product QUALCOMMINC ZTE_STOR 0x2000 USB ZTE Storage
-product QUALCOMMINC AC8700 0xfffe CDMA 1xEVDO USB modem
/* Qualcomm Kyocera products */
product QUALCOMM_K CDMA_MSM_K 0x17da Qualcomm Kyocera CDMA Technologies MSM
@@ -2685,6 +2681,8 @@
product ROLAND FANTOMX 0x006d Fantom-X MIDI Synth.
product ROLAND UA25 0x0074 EDIROL UA-25
product ROLAND UA101 0x007d EDIROL UA-101
+product ROLAND PC50A 0x008b EDIROL PC-50 (advanced)
+product ROLAND PC50 0x008c EDIROL PC-50
product ROLAND UA101F 0x008d EDIROL UA-101 USB1
product ROLAND UA1EX 0x0096 EDIROL UA-1EX
product ROLAND UM3 0x009A EDIROL UM-3
@@ -3300,6 +3298,16 @@
product ZOOM 2986L 0x9700 2986L Fax modem
product ZOOM 3095 0x3095 3095 USB Fax modem
+/* ZTE products */
+product ZTE MF622 0x0001 MF622 modem
+product ZTE MF628 0x0015 MF628 modem
+product ZTE MF626 0x0031 MF626 modem
+product ZTE MF820D_INSTALLER 0x0166 MF820D CD
+product ZTE MF820D 0x0167 MF820D modem
+product ZTE INSTALLER 0x2000 UMTS CD
+product ZTE MC2718 0xffe8 MC2718 modem
+product ZTE AC8700 0xfffe CDMA 1xEVDO USB modem
+
/* Zydas Technology Corporation products */
product ZYDAS ZD1201 0x1201 ZD1201
product ZYDAS ZD1211 0x1211 ZD1211 WLAN abg
Home |
Main Index |
Thread Index |
Old Index