usbd_set_config_no vs. usbd_set_config_index

Andriy Gapon avg at icyb.net.ua
Thu Aug 16 09:50:38 PDT 2007


on 16/08/2007 19:41 Hans Petter Selasky said the following:
> On Thursday 16 August 2007, Andriy Gapon wrote:
>> on 16/08/2007 19:15 Hans Petter Selasky said the following:
>>> Hi,
>>>
>>> I would say that "usbd_set_config_index()" is more reliable and faster
>>> than "usbd_set_config_no()". I tried to get rid of
>>> all "usbd_set_config_no()".
>> Hmm, then I am puzzled how my change from *_index() to *_no() helped in
>> my case. Maybe some parameters were incorrect, or maybe different
>> devices need different parameters and that's where _no() comes useful.
> 
> What config number are you setting?
> 
> Have you dumped the configuration of your device using "udesc_dump" 
> (See /usr/ports/sysutils/udesc_dump) ?

Thank you for bearing with me.
To reiterate: I was trying palm/uppc-kmod on amd64 6.2 with standard USB
stack. attach routine had the following line:
err = usbd_set_config_index(dev, UPPC_CONFIG_INDEX, 1);
where UPPC_CONFIG_INDEX is defined to 1.
It failed with:
kernel: ucom0: failed to set configuration, err=STALLED
kernel: device_attach: ucom0 attach returned 6

My only change was from _index to _no and then it started to work.
Here's udesc_dump full output:

Standard Device Descriptor:
  bLength            18
  bDescriptorType    01
  bcdUSB             0200
  bDeviceClass       00
  bDeviceSubClass    00
  bDeviceProtocol    00
  bMaxPacketSize     16
  idVendor           0b05
  idProduct          420f
  bcdDevice          0000
  iManufacturer      1
  iProduct           2
  iSerialNumber      3
  bNumConfigurations 1

Configuration 0:
        Standard Configuration Descriptor:
          bLength             9
          bDescriptorType     02
          wTotalLength        32
          bNumInterface       1
          bConfigurationValue 1
          iConfiguration      0
          bmAttributes        80
          bMaxPower           250 (500 mA)

        Standard Interface Descriptor:
          bLength            9
          bDescriptorType    04
          bInterfaceNumber   0
          bAlternateSetting  0
          bNumEndpoints      2
          bInterfaceClass    ff
          bInterfaceSubClass ff
          bInterfaceProtocol ff
          iInterface         0

        Standard Endpoint Descriptor:
          bLength          7
          bDescriptorType  05
          bEndpointAddress 81 (in)
          bmAttributes     02 (Bulk)
          wMaxPacketSize   64
          bInterval        0

        Standard Endpoint Descriptor:
          bLength          7
          bDescriptorType  05
          bEndpointAddress 02 (out)
          bmAttributes     02 (Bulk)
          wMaxPacketSize   64
          bInterval        0

Codes Representing Languages by the Device:
  bLength          4
  bDescriptorType  03
  wLANGID[0]       0409

String (index 1): ASUS

String (index 2): ASUS PPC

String (index 3): f553b4ec-0dee-9dcc-7a63-40a7b4d674b9

-- 
Andriy Gapon


More information about the freebsd-usb mailing list