NetBSD-Bugs archive

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

kern/45156: Patch to support XS Stick P14 USB 3G Modem and similar devices



>Number:         45156
>Category:       kern
>Synopsis:       Patch to support XS Stick P14 USB 3G Modem and similar devices
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 17 21:20:00 +0000 2011
>Originator:     Moritz Wilhelmy
>Release:        NetBSD 5.99.54
>Environment:
System: NetBSD fenrir 5.99.54 NetBSD 5.99.54 (GENERIC) #1: Sun Jul 17 20:57:07 
CEST 2011 root@fenrir:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
The XS Stick P14 is an USB modem that needs additional care. It appears as USB
mass storage device containing windows drivers by default. After sending a magic
string, it reinitialises as modem. Simply ejecting /dev/cd0d did not work,
because the device does not support it. 

I was unable to obtain the actual vendor name for 0x1c9e and the correct product
names for 0xf000 and 0x9605, so I called them "UNKNOWN". Thanks to Joerg
Sonnenberger for pointing me to u3g and the usb_modeswitch project for
discovering the magic string.

According to usb_modeswitch, there are other devices initialising as 1c9e:f000,
which can be reinitialised with the same magic number, but I was unable to
verify if they work, so I left them out for now. 
>How-To-Repeat:
Plug in the stick in vanilla NetBSD, it will show up as USB CD drive that does
not support being ejected. After applying the patch, it will auto-initialise as
ucom device taking up two slots. The first one (ttyU0 in my case) is not usable
and seemingly simply blocked by the manufacturer for no particular reason; the
second one (ttyU1) can be used to dial up.
>Fix:
Index: u3g.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/u3g.c,v
retrieving revision 1.17
diff -u -p -r1.17 u3g.c
--- u3g.c       10 Mar 2011 00:13:56 -0000      1.17
+++ u3g.c       17 Jul 2011 20:14:54 -0000
@@ -244,6 +244,9 @@ static const struct usb_devno u3g_devs[]
 
        /* Toshiba */
        { USB_VENDOR_TOSHIBA, USB_PRODUCT_TOSHIBA_HSDPA_MODEM_EU870DT1 },
+
+       /* Unknown vendor */
+       { USB_VENDOR_UNKNOWN_1C9E, USB_PRODUCT_UNKNOWN_1C9E_M9605 },
 };
 
 static int
@@ -416,6 +419,36 @@ u3g_huawei_k3765_reinit(usbd_device_hand
 }
 
 static int
+u3g_unknown_1c9e_reinit(usbd_device_handle dev)
+{
+       unsigned char cmd[31];
+
+       /* magic string adapted from usb_modeswitch database */
+       memset(cmd, 0, sizeof(cmd));
+       cmd[0] = 0x55; 
+       cmd[1] = 0x53;
+       cmd[2] = 0x42;
+       cmd[3] = 0x43;
+       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));
+}
+
+static int
 u3g_sierra_reinit(usbd_device_handle dev)
 {
        /* Some Sierra devices presents themselves as a umass device with
@@ -486,6 +519,11 @@ u3ginit_match(device_t parent, cfdata_t 
                        return u3g_novatel_reinit(uaa->device);
                break;
 
+       case USB_VENDOR_UNKNOWN_1C9E:
+               if (uaa->product == USB_PRODUCT_UNKNOWN_1C9E_INSTALLER)
+                       return u3g_unknown_1c9e_reinit(uaa->device);
+               break;
+
        default:
                break;
        }

Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.581
diff -u -p -r1.581 usbdevs
--- usbdevs     11 Jun 2011 13:50:06 -0000      1.581
+++ usbdevs     17 Jul 2011 20:14:19 -0000
@@ -510,6 +510,7 @@ vendor MEINBERG             0x1938  Meinberg Funkuhr
 vendor QUALCOMMINC     0x19d2  Qualcomm, Incorporated
 vendor QUANTA          0x1a32  Quanta
 vendor WINCHIPHEAD2    0x1a86  QinHeng Electronics
+vendor UNKNOWN_1C9E    0x1c9e  Unknown (0x1c9e)
 vendor MPMAN           0x1cae  MPMan
 vendor PEGATRON                0x1d4d  Pegatron
 vendor AIRTIES         0x1eda  AirTies
@@ -2731,6 +2732,10 @@ product UMEDIA ALL0298V2 0x3204  ALL0298 
 /* Universal Access products */
 product UNIACCESS PANACHE      0x0101  Panache Surf USB ISDN Adapter
 
+/* Products by unknown vendor */
+product UNKNOWN_1C9E INSTALLER 0xf000  Uninitialized USB Modem
+product UNKNOWN_1C9E M9605     0x9605  USB Modem 1c9e:9605
+
 /* U.S. Robotics products */
 product USR USR1120            0x00eb  USR1120 WLAN
 product USR USR5422            0x0118  USR5422 WLAN



Home | Main Index | Thread Index | Old Index