int main(int argc, char* argv[]) { PrintHello(); if (ProcessCmdLine(argc, argv) != 0) return -1; OpenUsbDevice(); if (dwRC == USBIO_ERR_SUCCESS) { GetDeviceDescriptor(); } if (dwRC == USBIO_ERR_SUCCESS) { GetConfigurationDescriptor(); } if (dwRC == USBIO_ERR_SUCCESS) { GetStringDescriptor(); } if (dwRC == USBIO_ERR_SUCCESS) { SetConfiguration(); } if (dwRC == USBIO_ERR_SUCCESS) { // In order to give the USB device-side program (t_usb) // enough time after getting configured to carry out // some device tests, we wait here for a short while // before proceeding: Delay(2000); GetConfigurationInfo(); } if (dwRC == USBIO_ERR_SUCCESS) { OpenPipes(); } if (dwRC == USBIO_ERR_SUCCESS) { ExchangeVersions(); } if (dwRC == USBIO_ERR_SUCCESS) { DoTransfers(); } if (dwRC == USBIO_ERR_SUCCESS) { ClosePipes(); } CloseUsbDevice(); return 0; }
// Initialize usb device. NTSTATUS UsbDev::InitializeUsbDevice(PVOID pDevExt) // shawn 2011/05/06 modify { NTSTATUS ntStatus = STATUS_SUCCESS; m_pDevExtTmp = pDevExt; // shawn 2011/05/06 add DBGU_TRACE(">>>UsbDev::InitializeUsbDevice !\n"); ntStatus = GetDeviceDescriptor(); if(NT_SUCCESS(ntStatus)) { ntStatus = GetConfigurationDescriptor(); if(NT_SUCCESS(ntStatus)) { ntStatus = SetConfiguration(); } } DBGU_TRACE("UsbDev::InitializeUsbDevice return %X\n", ntStatus); return ntStatus; }