예제 #1
0
        internal PipeList(WDU_PIPE_INFO pPipe0, WDU_ALTERNATE_SETTING
                          pActiveAltSetting, WDU_DEVICE_HANDLE hDev)
        {
            WDU_PIPE_INFO pipe_info;
            DWORD         dwPipeIndex  = 0;
            DWORD         dwNumOfPipes = pActiveAltSetting.Descriptor.bNumEndpoints;
            DWORD         dwPipeSize   = (DWORD)Marshal.SizeOf(typeof(WDU_PIPE_INFO));

            //inserting the control pipe to the list
            this.Insert(0, new UsbPipe(pPipe0, hDev));

            //retrieving the rest of the pipes from the active alternating
            //settings struct and inserting them into the pipes' list
            for (dwPipeIndex = 0; dwPipeIndex < dwNumOfPipes; ++dwPipeIndex)
            {
                pipe_info = (WDU_PIPE_INFO)Convert.ChangeType
                                (Marshal.PtrToStructure(new
                                                        IntPtr(pActiveAltSetting.pPipes.ToInt64()
                                                               + dwPipeIndex * dwPipeSize), typeof(WDU_PIPE_INFO)),
                                typeof(WDU_PIPE_INFO));
                UsbPipe pipe = new UsbPipe(pipe_info, hDev);

                this.Insert((int)dwPipeIndex + 1, pipe);
            }
        }
예제 #2
0
 internal UsbPipe(WDU_PIPE_INFO pipe, WDU_DEVICE_HANDLE hDev)
 {
     m_pPipe = pipe;
     m_hDev  = hDev;
 }