Cannot open pipe to raw device HID interface

I am attempting to access a PCM2904 audio codec using the USB host on a Fez Domino. The chip presents a single configuration with 4 interfaces (control, streaming audio in, streaming audio out, HID). A portion of the constructor I’ve written is shown below.

        public PCM2904(USBH_Device device)
            // Cast the device.
            rawDevice = new USBH_RawDevice(device);

            // Get the configuration descriptor.  There is only one so set
            // the configuration to the configuration value given in the
            // descriptor.
            USBH_Descriptors.Configuration configDescriptor =
                0x00, 0x09, configDescriptor.bConfigurationValue, 0x00);

            // Locate each of the interfaces.
            for (int i = 0; i < configDescriptor.interfaces.Length; i++)
                // Check each of the interfaces in the list.
                USBH_Descriptors.Interface descInterface =
                if (descInterface.bInterfaceNumber == 0)
                    // Control interface.
                    if (descInterface.bAlternateSetting == 0)
                        controlInterfaceIndex = i;
                else if (descInterface.bInterfaceNumber == 1)
                    // Audio streaming data out interface.
                    if (descInterface.bAlternateSetting == 0)
                        streamingOutInterfaceIndex = i;
                else if (descInterface.bInterfaceNumber == 2)
                    // Audio streaming data in interface.
                    if (descInterface.bAlternateSetting == 0)
                        streamingInInterfaceIndex = i;
                else if (descInterface.bInterfaceNumber == 3)
                    // HID interface.
                    if (descInterface.bAlternateSetting == 0)
                        // There is only the one interface with a single endpoint so configure it.
                        hidInterfaceIndex = i;

                        // Set up the endpoint and pipe.
                        hidEndpoint = descInterface.endpoints[0];
                        hidPipe = rawDevice.OpenPipe(hidEndpoint);
                        hidPipe.TransferTimeout = 0;

                        // Set up a thread to read the data.
                        hidThread = new Thread(HidThread);
                        hidThread.Priority = ThreadPriority.Highest;

To begin with I am attempting to only access the HID (interface #3) and read the state of button presses. The code is based upon the USBH_RawDevice example. However, when I attempt to open a pipe using the HID endpoint I get an exception:

    #### Exception System.ArgumentException - 0xfd000000 (4) ####
    #### Message: 
    #### GHIElectronics.NETMF.USBHost.USBH_RawDevice+Pipe::Pipe_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_RawDevice+Pipe::.ctor [IP: 001f] ####
    #### GHIElectronics.NETMF.USBHost.USBH_RawDevice::OpenPipe [IP: 0009] ####

I suspect I am not initializing the device correctly but cannot seem to find examples of USB host dealing with multiple interfaces. If anyone can point me to an example or suggest what I may be doing incorrectly above I would appreciate it.


Maybe you skipped some previous audio interface?
Print the descriptors/interfaces and post them here. See this:

Also, print hidEndpoint to make sure you have the correct one.


Thanks for the suggestion, the class is coming in handy. Making progress, but I’m definitely going to have to write down what I’m learning here so I don’t forget it.