kmdf usbsamp

Discussion in 'Windows Vista Drivers' started by abaljry, Sep 11, 2008.

  1. abaljry

    abaljry Guest

    I have usb dongle that has 4 interfaces.
    so I think I need to modify the SelectInterfaces function in the usbsamp
    sample to support multiple interfaces.
    the problem that I found is the limited resources talk about that, and the
    only way I found is:
    if (numInterfaces == 1){

    WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&params);

    }

    else {

    settingPairs = ExAllocatePoolWithTag(

    PagedPool,

    sizeof(WDF_USB_INTERFACE_SETTING_PAIR) * numInterfaces,

    MEM_TAG

    );

    if (settingPairs == NULL){

    return STATUS_INSUFFICIENT_RESOURCES;

    }

    InitSettingPairs(

    UsbDevice,

    settingPairs,

    numInterfaces

    );

    WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES(

    &params,

    numInterfaces,

    settingPairs

    );

    }

    status = WdfUsbTargetDeviceSelectConfig(

    UsbDevice,

    NULL,

    &params

    );

    But I don't know what InitSettingPairs should do?
     
    abaljry, Sep 11, 2008
    #1
    1. Advertisements

  2. What does InitSettingPairs() do? each entry in the settingPairs array
    should set a WDFUSBINTERFACE and the setting index you want to use during
    select config

    d
     
    Doron Holan [MSFT], Sep 11, 2008
    #2
    1. Advertisements

  3. abaljry

    abaljry Guest

    abaljry, Sep 11, 2008
    #3
  4. InitSettings would look something like this
    InitSettings(WDFUSBDEVICE UsbDevice, PWDF_USB_INTERFACE_SETTING_PAIR Pairs,
    ULONG NumSettings)
    {
    for(UCHAR i = 0; i < NumSettings; i++) {
    Pairs.UsbInterface = WdfUsbDeviceGetInterface(UsbDevice, i);
    Pairs.SettingIndex = 0;
    }
    }

    d

    --
    Please do not send e-mail directly to this alias. this alias is for
    newsgroup purposes only.
    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Doron Holan [MSFT], Sep 12, 2008
    #4
  5. abaljry

    shrutika Guest


    Hi,

    Can anyone tell me what WdfUsbDeviceGetInterface() function does?
    This function is used in InitSettingPairs().


    Thanks,
    shrutika
     
    shrutika, Mar 6, 2014
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.