none
Iterating a USBD_INTERFACE_INFORMATION list RRS feed

  • Question

  • I am trying to iterate a list of USBD_INTERFACE_INFORMATION  to get each item in the list. This list has arrived as part of a _URB_SELECT_CONFIGURATION request.

    void SelectConfig(
    		struct _URB_SELECT_CONFIGURATION * request)
    {
    	unsigned int offset=0;
    	
    	PUSB_INTERFACE_DESCRIPTOR intfdesc;
    	USBD_INTERFACE_INFORMATION *interface= &request->Interface;
    	for(i=0; i<request->ConfigurationDescriptor->bNumInterfaces; i++)
    	{
    		//Get the interface and do whatever..		
    		.....
    				
    		// Get the next item from the USBD_INTERFACE_INFORMATION list. But the interface is null.
    		
    		interface =(USBD_INTERFACE_INFORMATION *)((char *)interface  + sizeof(*interface) + (interface->NumberOfPipes - 1)*
    			sizeof(interface->Pipes[0]));
    			
    	}

    My device has two interfaces .The first interface has no end points and the second interface has one end point. But getting the next item at secind iteration fails.ie. next item seems  seems invalid. What could be wring here? I investigated but couldn't find the root cause. Is there anything wrong with the way the next address is calculated? The variable interface after the calculation in the second iteration does not have the expected values.

    • Edited by its_me_here Thursday, August 25, 2016 8:48 PM
    Thursday, August 25, 2016 8:45 PM

Answers

  • it should be as simple as

    interface = (USBD_INTERFACE_INFORMATION*) ( ((PUCHAR) interface)+interface->Length );


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, August 26, 2016 6:35 AM

All replies

  • it should be as simple as

    interface = (USBD_INTERFACE_INFORMATION*) ( ((PUCHAR) interface)+interface->Length );


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, August 26, 2016 6:35 AM
  • Thank you ,Doron.
    Thursday, September 1, 2016 6:42 AM