Skip to main content
minhthe2305
Associate II
October 27, 2009
Question

HID device with multiple interfaces

  • October 27, 2009
  • 4 replies
  • 1782 views
Posted on October 27, 2009 at 22:18

HID device with multiple interfaces

    This topic has been closed for replies.

    4 replies

    minhthe2305
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:27

    Hi,

    I am working with the demo board STM32F10X-128K-EVAL. I am making the HID device with multiple intefaces (based on the Custom HID project for the demo board).

    I changed the usb_desc.c by adding one more interface and also, set up the endpoint 2 ENDP2 for the second interface.

    When I run the code, only the first interface is enumerated successfully.

    I dont know what is the problem?

    Could somebody help?

    Thanks.

    minhthe2305
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:27

    Actually, my code works well. That is a stupid question.

    minhthe2305
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:27

    Thank you for your replying.

    I added one more interface and report descriptor in usb_desc.c.

    Also, I changed the CustomHID_Data_Setup function like this:

    RESULT CustomHID_Data_Setup(u8 RequestNo)

    {

    u8 *(*CopyRoutine)(u16);

    CopyRoutine = NULL;

    if ((RequestNo == GET_DESCRIPTOR)

    && (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT)) )

    {

    if (pInformation->USBwValue1 == REPORT_DESCRIPTOR)

    {

    if( pInformation->USBwIndex0 == 0 )

    {

    CopyRoutine = CustomHID_GetReportDescriptor;

    }else if( pInformation->USBwIndex0 == 1 )

    {

    CopyRoutine = RFID_GetReportDescriptor;

    }

    }

    }

    if (CopyRoutine == NULL)

    {

    return USB_UNSUPPORT;

    }

    pInformation->Ctrl_Info.CopyData = CopyRoutine;

    pInformation->Ctrl_Info.Usb_wOffset = 0;

    (*CopyRoutine)(0);

    return USB_SUCCESS;

    }

    With my code now, the device appears as 2 HID devices with 2 interfaces in PC like this:

    -HID device

    -HID device

    -USB human interface device

    -USB human interface device

    I attach a figure for this.

    Did you experience this problem?

    ccowdery9
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:27

    Have you changed the decriptors to indicate a composite device?

    Chris.