NetBSD-Bugs archive

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

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



The following reply was made to PR kern/45156; it has been noted by GNATS.

From: Moritz Wilhelmy <moritz%wzff.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/45156: Patch to support XS Stick P14 USB 3G Modem and
 similar devices
Date: Mon, 18 Jul 2011 19:30:45 +0200

 On Mon, Jul 18, 2011 at 16:40:03 +0000, David Laight wrote:
 >  That isn't the point, since none of the bytes are variable you don't
 >  need an on-stack buffer, a compile-time initialised one will do.
 
 The other devices should probably be fixed too, in that case.
 I don't care which version will be adapted, all I want is my 3G stick
 to work :^)
 
 This might still have a quirk, since I have to plug in the stick twice
 in order to do a full mode switch. Here the relevant bits from dmesg:
 
 | u3ginit0 at uhub4 port 4: Switching to 3G mode
 | u3ginit0: detached
 | u3ginit0: at uhub4 port 4 (addr 2) disconnected
 
 This is after I plug the stick in for the first time. Afterwards,
 /dev/ttyU3 isn't yet usable. After I plug it out and reinsert it, I get
 the following messages:
 
 | u3ginit0 at uhub4 port 4: Switching to 3G mode
 | u3ginit0: detached
 | u3ginit0: at uhub4 port 4 (addr 2) disconnected
 | u3g0 at uhub4 port 4 configuration 1 interface 0
 | ucom0 at u3g0 portno 0: 3G Modem
 | u3g1 at uhub4 port 4 configuration 1 interface 1
 | ucom1 at u3g1 portno 1: 3G Modem
 | u3g2 at uhub4 port 4 configuration 1 interface 2
 | ucom2 at u3g2 portno 2: 3G Modem
 | u3g3 at uhub4 port 4 configuration 1 interface 3
 | ucom3 at u3g3 portno 3: 3G Modem
 | umass0 at uhub4 port 4 configuration 1 interface 4
 | umass0: USB Modem USB Modem, rev 2.00/0.00, addr 2
 | umass0: using SCSI over Bulk-Only
 | scsibus0 at umass0: 2 targets, 1 lun per target
 | sd0 at scsibus0 target 0 lun 0: <USBModem, Disk, 2.31> disk removable
 | sd0: drive offline
 | sd0(umass0:0:0:0):  Check Condition on CDB: 0x00 00 00 00 00 00
 |     SENSE KEY:  Not Ready
 |      ASC/ASCQ:  Medium Not Present
 | 
 | sd0: unable to open device, error = 19
 
 Afterwards, the device is usable.
 
 New diff which initialises the array directly attached, so whoever
 actually fixes this has less boring copypasta work, regardless of which
 way they prefer it.
 
 Note that the other devices are initialised the same way as in my first
 diff, see u3g_huawei_k3765_reinit and u3g_novatel_reinit in particular.
 
        Moritz
 
 
 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      18 Jul 2011 17:04:19 -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,20 @@ u3g_huawei_k3765_reinit(usbd_device_hand
  }
  
  static int
 +u3g_unknown_1c9e_reinit(usbd_device_handle dev)
 +{
 +      /* magic string adapted from usb_modeswitch database */
 +      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
 +      };
 +
 +      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 +503,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;
        }
 


Home | Main Index | Thread Index | Old Index