none
Hardware ID not recognized RRS feed

  • Question

  • HI,

    I am developing driver for a PCI-e based multiport serial controller that hosts multiple COM ports. I am writing two drivers for this.

    1. The controller driver which acts as FDO for controller as well as creating PDOs for the serial Ports

    2. THe Serial port dirver which creates FDOs for UART ports.

    IN COntroller driver while creating PDOs for UART ports, i am giving a hardward ID as PTL\PTLSER_795412D8_795412D8.

    I have seen a related post on this. It suggested to remove null characters from the device ID string etc. I made sure i don't have null characters in the Device ID and Hardware ID. Also i am specifying all the values for Hardware ID, Device ID, Compatible ID and Instance ID. 

    I am copying values of Device ID and Hardware ID etc into a UNICODE_STRING buffer before assigning them to the PDOs.

    I am copying them in the below mentioned manner. 

    swprintf(buf.Buffer,L"PTL" L"\\" PTLSER_DESCRIPTION L"_%08X_%08X", FdoData->ulDeviceId, FdoData->ulSubDeviceId);

    "buf" is a UNICODE_STRING with the following values. 

    WCHAR stringBuffer[MAX_ID_LEN]; - MAX_ID_LEN is 128 

    buf.Buffer = stringBuffer;
    buf.Length = 128;
    buf.MaximumLength = sizeof(stringBuffer);

    and then i assign device ID using the below API.

    status = WdfPdoInitAssignDeviceID(pDeviceInit, &buf);

    Likewise i assign Hardware ID, COmpatible ID etc values also.

    After we install the driver, we are getting the below error in device manager. 

     

    and i can't see the devices for which i created PDOs. Can somebody please help me with this?


    vidyasagar196

    Wednesday, June 11, 2014 2:10 PM

Answers

  • the Length field of a unicode_string is the number of bytes in the string that are formatted, so it would not be 128. With this code, just call RtlInitUnicodeString after the swprintf call. Even better would be to skip swprintf and call RtlUnicodeStringPrintf on a properly initialized unicode_string var

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

    Wednesday, June 11, 2014 2:34 PM

All replies

  • the Length field of a unicode_string is the number of bytes in the string that are formatted, so it would not be 128. With this code, just call RtlInitUnicodeString after the swprintf call. Even better would be to skip swprintf and call RtlUnicodeStringPrintf on a properly initialized unicode_string var

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

    Wednesday, June 11, 2014 2:34 PM
  • a) About the length, we were using 128 and we were priting the values of"buf" in logging statements. We are getting proper values in the logs. Hence we assumed 128 is proper. 

    If 128 is not proper then how can i know what is the proper value for this? 

    b) I am using  RtlInitUnicodeString in the following way. 


    UNICODE_STRING  buf;

    RtlInitUnicodeString(&buf, L"PTL\\PTLSER_1234ABCD_1234ABCD");

    Does this work? 

    How should i use RtlUnicodeStringPrintf properly?

    c) apart from logs is there anyway i can know what is hte hardware ID value that is being passed to Framework ?


    vidyasagar196

    Wednesday, June 11, 2014 2:53 PM