none
IWDFDevice::CreateWdfFile returns ERROR_INVALID_FUNCTION?

    Question

  • Hi,

    I am writing a UMDF sensor driver for a device that connects to the system via Bluetooth and is accessible as an HID input device.  I saw the "Sensor Development Kit" sample driver and noticed that it works with the Freescale hardware via HID also though it connects to the system via USB.  Is there any difference in the way the UMDF driver communicates with the device in case it connects to the system via Bluetooth?  For some reason, I find that the call to "CreateWdfFile" returns "ERROR_INVALID_FUNCTION" even when I have the device paired with the system.  I am able to access the device directly via HID just fine.

    In the INF for the driver I have specified the hardware ID like so - HID\VID_1234&PID_5678 (haven't used the actual IDs here).  Is this sufficient for the UMDF framework to determine which driver it should use further down the stack?  Or is there something else that one needs to do?

    Please help!

    Thanks.

    -- 
    Ranju. V
    --

    Monday, January 11, 2010 3:02 AM

Answers

  • I managed to resolve this one myself.  Turns out I wasn't using the correct hardware ID.  On a whim I looked up what hardware IDs the Bluetooth device had been registered with under HKLM\SYSTEM\CurrentControlSet\Enum\HID and used another ID that had been given there and voila! - IWDFDevice::CreateWdfFile worked! :)  And sure enough, this is described quite clearly on MSDN here.  So, all's good!

    -- 
    Ranju. V
    --

    Tuesday, January 12, 2010 4:22 AM

All replies

  • I managed to resolve this one myself.  Turns out I wasn't using the correct hardware ID.  On a whim I looked up what hardware IDs the Bluetooth device had been registered with under HKLM\SYSTEM\CurrentControlSet\Enum\HID and used another ID that had been given there and voila! - IWDFDevice::CreateWdfFile worked! :)  And sure enough, this is described quite clearly on MSDN here.  So, all's good!

    -- 
    Ranju. V
    --

    Tuesday, January 12, 2010 4:22 AM
  • Hi  Rajasekharan Vengalil:

        I have countered the same createwdffile failed problem, return error-invalid-function; I think it's a problem related to hardware ID too, but I don't know how to change the hardware id. you mean read the hardware id from HKLM\SYSTEM\CurrentControlSet\Enum\, then use it in inf file?

    Software tool: VS2013 + WDK8.1,  remote debugger (“hello word”  UMDF test drive remote debugging success)

    using sample codes from msdn(SpbAccelerometer driver sample) UMDF driver

    http://msdn.microsoft.com/en-us/library/windows/hardware/dn458003%28v=vs.85%29.aspx

    For settings:

    1 in target computer, ACPI table changed(use asl file in sample codes), accelerometer added in the ACPI table(but real sensor device is not attached to I2C)

    2  package property setting as enable deployment , install and verify ,default driver package installation

    in deployment ,  when do driver preparation, there is a miss in hardware id.

    After build , there comes Error: driver deployment Task Failed: Default Driver Package Installation Task (possible reboot)

    I open the log for Default Driver Package Installation Task , it says 

    <Error

                    File=""

                    Line="-1"

                    ErrCode="0x0"

                    ErrType=""

                    ErrorText="Error 0x00000000"

                    UserText="WDTF_TEST                 : Driver package installed onto device but driver failed to start" CA="356006406" LA="356006758" >

     

    So I copy the pdb file to target computer , then use the pdb via traceview to see what happened in the driver codes.  There is a error 

    00000001             C++        2760       4816       0              1              07\11\2013-20:51:21:374               [CAccelerometerDevice::GetConfigurationData]Failed to create WDF file for IWDFDevice 01810088 - 0x80070001(ERROR_INVALID_FUNCTION)

     

     

    Source code is bellow

     

       

        hr = pWdfDevice->CreateWdfFile(nullptr, &spFile);

     

        if (FAILED(hr))

        {

            Trace(

                TRACE_LEVEL_ERROR,

                "Failed to create WDF file for IWDFDevice %p - %!HRESULT!",

                pWdfDevice,

                hr);

            goto exit;

        }

       

     

     

    Do you have any suggestion about fixing this error?

    Is it just a software level problem or related to the hardware(since real sensor is not attached, PnP manager can’t talk to device to get necessary info)?


    Friday, November 22, 2013 5:12 AM