none
Win CE 6.0: Dynamic enumeration of USB device RRS feed

  • Question

  • We are using FTDI USB to serial converter IC.

    Win CE 6.0.

    When the FTDI chip is reset (for unknown reason), FTDI COM ports are not available and the communication with the FTDI chip is lost.

    We tried dynamically enumerating the FTDI chip using ActivateDeviceEx function from the application end, but got the error 110 (The system cannot open the device or file specified. ).

    Additionally, Win CE 6.0 doesn't support any Set up API to re-enumerate the USB from the application end.

    Can you suggest a way to re-enumerate the FTDI chip so that the COM ports shall be acessed for communication even after the FTDI chip is reset.

    Wednesday, August 13, 2014 12:51 PM

Answers

  • Hi,

    Please refer to the thread:

    http://social.msdn.microsoft.com/Forums/en-US/b77cb3f1-c821-4e51-b926-aeaf717ccc4d/enumerating-usb-devices?forum=vssmartdevicesnative

    HANDLE hSearch; 
    DeviceSearchType DeviceSearch=DeviceSearchByBusName; 
    DEVMGR_DEVICE_INFORMATION di = {sizeof(DEVMGR_DEVICE_INFORMATION)}; 
    
    hSearch = FindFirstDevice(DeviceSearch, L"USB*", &DeviceInfo); 
    if( hSearch != INVALID_HANDLE_VALUE ) 
    
    do
    {
    
    
    ... Do something here
    
    } while(FindNextDevice( hSearch) );
    

    Or

    hSearch = FindFirstDevice(DeviceSearch, TEXT("HCD*"), &DeviceInfo);
        if (hSearch != INVALID_HANDLE_VALUE)
            do 
            {
                wprintf(TEXT("\tDevice Name: %s\n"), DeviceInfo.szDeviceName);
                wprintf(TEXT("\tBus Name: %s\n"), DeviceInfo.szBusName);
    
                hFile = CreateFile(DeviceInfo.szDeviceName, 
                            GENERIC_READ, 
                            FILE_SHARE_READ, 
                            NULL,
                            OPEN_EXISTING,
                            FILE_ATTRIBUTE_SYSTEM,
                            NULL);
                error = GetLastError();
                if (hFile == INVALID_HANDLE_VALUE)
                {
                    wprintf(TEXT("#######ERROR: Failed to open <%s>\n"), DeviceInfo.szDeviceName);
                    wprintf(TEXT("\tError code: %ld"), error);
                }
                else
                {
                    //Here I want to obtain the pointer to USB_DEVICE structure using LPGET_DEVICE_INFO type.
    
          //I intend to cast hFile to USB_HANDLE and after that to call GetDeviceInfo function.
    
                }
                CloseHandle(hFile);
            } while(FindNextDevice(hSearch, &DeviceInfo));
        else
            wprintf(TEXT("No USB device found!\n"));
    
    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 14, 2014 1:08 AM
    Moderator