Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/dev/usb Pull up following revision(s) (requested by c...



details:   https://anonhg.NetBSD.org/src/rev/d710db578e3f
branches:  netbsd-7
changeset: 798436:d710db578e3f
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Oct 15 08:43:08 2014 +0000

description:
Pull up following revision(s) (requested by christos in ticket #142):
        sys/dev/usb/u3g.c: revision 1.31
        sys/dev/usb/usbdevs: revision 1.681
        sys/dev/usb/usbdevs: revision 1.682
PR/49233: Ben Gergely: Add huawei e353 to u3g
(factor out some common code in the process)

diffstat:

 sys/dev/usb/u3g.c   |  90 ++++++++++++++++++++++++++++++++++++++--------------
 sys/dev/usb/usbdevs |  22 +++++++-----
 2 files changed, 77 insertions(+), 35 deletions(-)

diffs (208 lines):

diff -r 703a3095925c -r d710db578e3f sys/dev/usb/u3g.c
--- a/sys/dev/usb/u3g.c Wed Oct 15 08:37:34 2014 +0000
+++ b/sys/dev/usb/u3g.c Wed Oct 15 08:43:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: u3g.c,v 1.30 2013/09/02 07:39:03 christos Exp $        */
+/*     $NetBSD: u3g.c,v 1.30.4.1 2014/10/15 08:43:08 martin Exp $      */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.30 2013/09/02 07:39:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.30.4.1 2014/10/15 08:43:08 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -192,6 +192,7 @@
        { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K3765 },
        { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },
        { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E171 },
+       { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353 },
        /* OEM: Merlin */
        { USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 },
        /* OEM: Novatel */
@@ -334,6 +335,16 @@
        return (err == USBD_NORMAL_COMPLETION ? UMATCH_HIGHEST : UMATCH_NONE);
 }
 
+/* Byte 0..3: Command Block Wrapper (CBW) signature */
+static void
+set_cbw(unsigned char *cmd)
+{
+       cmd[0] = 0x55; 
+       cmd[1] = 0x53;
+       cmd[2] = 0x42;
+       cmd[3] = 0x43;
+}
+
 static int
 u3g_bulk_scsi_eject(usbd_device_handle dev)
 {
@@ -341,10 +352,7 @@
 
        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;
+       set_cbw(cmd);
        /* 4..7: CBW Tag, has to unique, but only a single transfer used. */
        cmd[4] = 0x01;
        /* 8..11: CBW Transfer Length, no data here */
@@ -372,10 +380,7 @@
 
        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;
+       set_cbw(cmd);
        /* 4..7: CBW Tag, has to unique, but only a single transfer used. */
        cmd[4] = 0x01;
        /* 8..11: CBW Transfer Length, no data here */
@@ -455,16 +460,14 @@
 
        /* magic string adapted from some webpage */
        memset(cmd, 0, sizeof(cmd));
-       cmd[0] = 0x55; 
-       cmd[1] = 0x53;
-       cmd[2] = 0x42;
-       cmd[3] = 0x43;
+       /* Byte 0..3: Command Block Wrapper (CBW) signature */
+       set_cbw(cmd);
+
        cmd[15]= 0x11;
        cmd[16]= 0x06;
 
        return send_bulkmsg(dev, cmd, sizeof(cmd));
 }
-
 static int
 u3g_huawei_e171_reinit(usbd_device_handle dev)
 {
@@ -472,10 +475,9 @@
 
        /* magic string adapted from some webpage */
        memset(cmd, 0, sizeof(cmd));
-       cmd[0] = 0x55; 
-       cmd[1] = 0x53;
-       cmd[2] = 0x42;
-       cmd[3] = 0x43;
+       /* Byte 0..3: Command Block Wrapper (CBW) signature */
+       set_cbw(cmd);
+
        cmd[15]= 0x11;
        cmd[16]= 0x06;
        cmd[17]= 0x20;
@@ -485,6 +487,28 @@
 }
 
 static int
+u3g_huawei_e353_reinit(usbd_device_handle dev)
+{
+       unsigned char cmd[31];
+
+       /* magic string adapted from some webpage */
+       memset(cmd, 0, sizeof(cmd));
+       /* Byte 0..3: Command Block Wrapper (CBW) signature */
+       set_cbw(cmd);
+
+       cmd[4] = 0x7f;
+       cmd[9] = 0x02;
+       cmd[12] = 0x80;
+       cmd[14] = 0x0a;
+       cmd[15] = 0x11;
+       cmd[16] = 0x06;
+       cmd[17] = 0x20;
+       cmd[23] = 0x01;
+
+       return send_bulkmsg(dev, cmd, sizeof(cmd));
+}
+
+static int
 u3g_sierra_reinit(usbd_device_handle dev)
 {
        /* Some Sierra devices presents themselves as a umass device with
@@ -508,12 +532,25 @@
 u3g_4gsystems_reinit(usbd_device_handle dev)
 {
        /* magic string adapted from usb_modeswitch database */
-       static unsigned char cmd[31] = {
-               0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, 0x80, 0x00,
-               0x00, 0x00, 0x80, 0x00, 0x06, 0x06, 0xf5, 0x04, 0x02, 0x52,
-               0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00
-       };
+       unsigned char cmd[31];
+
+       memset(cmd, 0, sizeof(cmd));
+       /* Byte 0..3: Command Block Wrapper (CBW) signature */
+       set_cbw(cmd);
+
+       cmd[4] = 0x12;
+       cmd[5] = 0x34;
+       cmd[6] = 0x56;
+       cmd[7] = 0x78;
+       cmd[8] = 0x80;
+       cmd[12] = 0x80;
+       cmd[14] = 0x06;
+       cmd[15] = 0x06;
+       cmd[16] = 0xf5;
+       cmd[17] = 0x04;
+       cmd[18] = 0x02;
+       cmd[19] = 0x52;
+       cmd[20] = 0x70;
 
        return send_bulkmsg(dev, cmd, sizeof(cmd));
 }
@@ -545,6 +582,9 @@
                case USB_PRODUCT_HUAWEI_E171INIT:
                        return u3g_huawei_e171_reinit(uaa->device);
                        break;
+               case USB_PRODUCT_HUAWEI_E353INIT:
+                       return u3g_huawei_e353_reinit(uaa->device);
+                       break;
                default:
                        return u3g_huawei_reinit(uaa->device);
                        break;
diff -r 703a3095925c -r d710db578e3f sys/dev/usb/usbdevs
--- a/sys/dev/usb/usbdevs       Wed Oct 15 08:37:34 2014 +0000
+++ b/sys/dev/usb/usbdevs       Wed Oct 15 08:43:08 2014 +0000
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680 2014/08/04 19:59:37 jdc Exp $
+$NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1725,15 +1725,17 @@
 
 /* Huawei Technologies products */
 product HUAWEI MOBILE          0x1001  Huawei Mobile
-product HUAWEI E220            0x1003  Huawei E220
-product HUAWEI EM770W          0x1404  Huawei EM770W
-product HUAWEI E1750           0x140c  Huawei E1750
-product HUAWEI E1750INIT       0x1446  Huawei E1750 USB CD
-product HUAWEI K3765           0x1465  Huawei K3765
-product HUAWEI E1820           0x14ac  Huawei E1820
-product HUAWEI E171INIT        0x14fe  Huawei E171 USB CD
-product HUAWEI E171            0x1506  Huawei E171
-product HUAWEI K3765INIT       0x1520  Huawei K3765 USB CD
+product HUAWEI E220            0x1003  Huawei E220
+product HUAWEI EM770W          0x1404  Huawei EM770W
+product HUAWEI E1750           0x140c  Huawei E1750
+product HUAWEI E1750INIT       0x1446  Huawei E1750 USB CD
+product HUAWEI K3765           0x1465  Huawei K3765
+product HUAWEI E1820           0x14ac  Huawei E1820
+product HUAWEI E171INIT                0x14fe  Huawei E171 USB CD
+product HUAWEI E171            0x1506  Huawei E171
+product HUAWEI E353            0x1507  Huawei E353
+product HUAWEI K3765INIT       0x1520  Huawei K3765 USB CD
+product HUAWEI E353INIT                0x1f01  Huawei E353 USB CD
 
 /* Huawei-3Com products */
 product HUAWEI3COM RT2573      0x0009  RT2573



Home | Main Index | Thread Index | Old Index