none
How to load WinCE USB Function client driver manually RRS feed

  • Question

  • Hi,

    I am trying to load WinCE USB Function Client driver manually thorugh application. With below code loading USB Function MDD driver(usbfn.dll) but not serialusbfn.dll my default client driver is Serial. Any Help?

    #include "stdafx.h"
    #define DRIVERSHELL_REG_KEY (TEXT("Drivers\\Builtin\\UFN"))

    int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
    {
     HANDLE hDriverShell = INVALID_HANDLE_VALUE,hUfn = NULL;
     BOOL RetVal = FALSE;
     DWORD err = NULL;
     if( hDriverShell == INVALID_HANDLE_VALUE )
     {
      hDriverShell = ActivateDeviceEx( DRIVERSHELL_REG_KEY,
       NULL,
       0,
       NULL
       );
      if (hDriverShell != INVALID_HANDLE_VALUE && hDriverShell != 0)
      {
       hUfn = CreateFile(L"UFN1:", FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
       err = GetLastError();
       RetVal = TRUE;

      }
      else
      {
       // Note: the driver may have succeded to load if the handle is zero
       RETAILMSG( 1, (TEXT("Failed to activate driver %d\n"), GetLastError() ));
      }
     }
     while(1)
     {
      Sleep(1000);
     }

      return 0;
    }

    Regards,

    Kiran


    kiran reddy
    Friday, March 11, 2011 12:07 PM

All replies

  • Hi,

    Have you tried passing serialusbfn registry key.. !

    what exactly your purpose behind this ? what you want to do ? if it is clear, it will be easy for the people on the forum to answer the question.

     

     


    Anant
    Friday, March 11, 2011 12:30 PM
  • Hi Anant,

    I didn't try serialusbfn registry. My understanding is UFNMDD driver searches for default client key(serialusbfn) and loads that. I am trying to write custom usb function client driver and for sample code I am referreing usb serial function client. I am facing issue in loading serialfunction client driver in KITL enabled mode. In KITL disabled mode it is loading(I observed through UART messages). I am trying to load it manually.

    Regards,

    Kiran

     


    kiran reddy
    Friday, March 11, 2011 12:42 PM
  • Are you using USB Functional RNDIS for KITL? if No, There is no relation between USB Functional drivers and KITL.

    Also check, is there any IMGNOKILT used in your platform.reg file. See the bellow registry entries used in MainstoneIII BSP.

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Usbfn] 

    IF IMGNOKITL
        "Dll"="ms2_usbfn.dll"
    ENDIF

    if KITL is enabled, it won't allow you to load the Usbfn driver. Hear, they are providing support for USB RNDIS KITL. so they are not allowing usbfn driver to load automatically.

    In your case if your are not using USN RNDIS for KITL, then no need to use the variable IMGNOKITL.


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    Friday, March 11, 2011 1:05 PM
  •  

    OK then it may be the case that KITL is using the same resources as (serial fun). are you using USB OTG ? is the KITL over USB ? can you check it with other transport KITL over ethernet ???

     

     

     

     

     


    Anant
    Friday, March 11, 2011 1:13 PM
  • Hi,

    In one of my previous project I wrote a Custom Client Driver.

    For this I referred Mass Storage Class.

    For loading and unloading USB Function Clients you can refer the following URL

    http://prabukumar.wordpress.com/2008/10/07/usb-function-driver-dynamic-switching-in-wince/ 

    Monday, March 14, 2011 5:03 AM