In on control endpoint

Steve Clark sclark at netwolves.com
Wed May 14 19:53:07 UTC 2008


Steve Clark wrote:
> Hans Petter Selasky wrote:
> 
>>Hi Steve,
>>
>>Can you send me a diff between the original file and the new one so that I can 
>>see where you inserted that code ? I suppose you inserted it at the wrong 
>>location.
>>
>>--HPS
>>
> 
> <....snip....>
> 
>>>I have decided to try your new usb stack. I am running on FreeBSD 6.1. The
>>>device I am trying to get working is a sierra wireless usb 597 EVDO modem.
>>>It is also has a slot for a micro-sd memory card, plus when it is first
>>>powered up it doesn't look like a modem it looks like a different device
>>>that has both the umass device plus a cdrom device that has windows
>>>software drivers on it. In this mode it has a VID of 0x1199 and a PID of
>>>0xfff, after a message on the control pipe it changes its identity to VID =
>>>0x1199, PID=0x0023.
>>>
>>>What I had done previously with the original 6.1 usba.c was in the match
>>>code look for the 1199:fff and then in the attach code send a message on
>>>the control pipe to set it in modem mode like the code below: {
>>>       ubsa_cfg_request( sc, 0x0b, 1);
>>>       ucom->sc_dying = 1;
>>>               goto error;
>>>  }
>>>
>>>I tried to do something similar in the usba.c that is part of your new code
>>>as follows: {
>>>       ubsa_cfg_request( sc, 0x0b, 1);
>>>               goto detach;
>>>  }
>>>
>>>but I immediately get a panic:
>>>Fatal trap 12 page fault in kernel mode
>>>...
>>>Stopped at usbd_config_td_is_gone
>>>bt gives:
>>>ucom_cfg_is_gone
>>>ubsa_cfg_request
>>>ubsa_attach
>>>...
>>>
>>>Which looks like it doesn't like the device disappearing when it switched
>>>modes. Any ideas how this should be handled? Or where I should be trying to
>>>switch the device into modem mode?
>>>
>>>Thanks,
>>>Steve
>>
>>
>>
>>
> Hi Hans,
> 
> Below is the diff you asked for - thanks for repsonding.
> 
> 
> --- ubsa.c.orig Wed May 14 13:10:19 2008
> +++ ubsa.c      Wed May 14 11:13:26 2008
> @@ -295,6 +295,9 @@
>         {USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE},
>         /* Qualcomm, Inc. ZTE CDMA */
>         {USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM},
> +       /* Sierra Wireless */
> +        { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_COMPASS_597 },
> +        { USB_VENDOR_SIERRA, 0xfff },
>         {0, 0}
>  };
> 
> @@ -322,7 +325,7 @@
>  {
>         struct usb_attach_arg *uaa = device_get_ivars(dev);
>         const struct ubsa_product *up = ubsa_products;
> -
> +       printf("ubsa:vendor=%x,product=%x\n",uaa->vendor,uaa->product);
>         if (uaa->usb_mode != USB_MODE_HOST) {
>                 return (UMATCH_NONE);
>         }
> @@ -332,10 +335,14 @@
>         while (up->vendor) {
>                 if ((up->vendor == uaa->vendor) &&
>                     (up->product == uaa->product)) {
> +       printf("ubsa:MATCH\n");
> +
>                         return (UMATCH_VENDOR_PRODUCT);
>                 }
>                 up++;
>         }
> +        printf("ubsa:NO_MATCH\n");
> +
>         return (UMATCH_NONE);
>  }
> 
> @@ -356,6 +363,12 @@
>         usbd_set_device_desc(dev);
> 
>         sc->sc_udev = uaa->device;
> +
> +        if ( uaa->vendor == USB_VENDOR_SIERRA && uaa->product == 0xfff )
> +        {
> +                ubsa_cfg_request( sc, 0x0b, 1 );
> +              goto detach;
> +        }
> 
>         /* configure the device */
> 
> _______________________________________________
> freebsd-usb at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe at freebsd.org"
> 
> 
Hi Hans,

I tried moving the ubsa_cfg_reguest() to various places in the ubsa_attach routine.
When I moved it after the call:
       error = usbd_transfer_setup(uaa->device, &(sc->sc_iface_index),
            sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &Giant); 

        if (error) {
                DPRINTF(0, "could not allocate all pipes\n");
                goto detach;
        }
The error message "could not allocate all pipes" is printed and the ubsa_attach function exits.
if I put before the if (error) it panics .

Attached is a lsusb -vvv I got from a linux system before the device is put in the modem mode.
sierra_tru.txt.
I had previously posted an lsusb -vvv from the device after it had been placed in modem mode.
when it is in modem mode it looks like a composite device? It has the modem which has 3 serial ports,
and a UMASS device.

Thanks again for taking an interest.
Steve

-------------- next part --------------

Bus 002 Device 002: ID 1199:0fff Sierra Wireless, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1199 Sierra Wireless, Inc.
  idProduct          0x0fff 
  bcdDevice            0.00
  iManufacturer           1 Sierra Wireless
  iProduct                2 USB MMC Storage
  iSerial                 3 SWOC22905731
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x07  EP 7 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0



More information about the freebsd-usb mailing list