Hi Doron,
Thanks for your reply.Below I have posted the functions that my driver
contains.Please let me know if those are enough or I am missing
anything else.
DriverEntry(x)
{
1.Initialize the config sturcture.
2.Create a KMDF driver object using wdfDriverCreate( ) fn.
}
EvtDeviceAdd(x)
{
1.Setting up callback fns for Pnp and power callbacks
a)EvtDevicePrepareHardware callback
b)EvtDeviceD0Entry callback
c)EvtDeviceD0Exit callback
Register the above fns using WdfDeviceInitSetPnpPowerEventCallbacks
fn.
2.Create a KMDF device object using wdfDeviceCreate( ) fn.
3.Create IO queues for read and write request.
IS THERE ANY OTHER THING THAT NEEDED TO BE DONE HERE,ANY OTHER
INITIALISATION,REGISTRATION FOR CALL BACK FUNCTIONS THAT I HAVE
MISSED.Do I need to register any othe call back fn or initialise any
other thing.
}
EvtDeviceDOEntry( )
{
1.Using WdfIoTargetStart( ) we would send queued request to device.
2.Loading the firmware.(U have mentioned that it would be better that
loading take place in preparehardware callback,but the documentation
clearly says to do it in DeviceDOEntry callback fn).
It might be so silly.How to load the firmware.I should call EvtIoWrite(
).I have registered this function while creating IO
queues.DeviceIOControl from application will call EvtIowrite callback
fn internally.what does loading the firmware in EvtDeviceDOEntry fn
mean.I am not able to get it.How will I load the firmware.
}
EvtDevicePrepareHardware callback( )
{
1.In spec they have given DFU_DETACH should be given to the device.How
will I detach the device.It is said that while enumerating as a DFU
device if a particular bit is enabled in the device descriptor the
device automatically generates the detach-attach sequence.At that time
a reset is given using the WdfUsbTargetDeviceCyclePortSynchronously fn
before the timer elapses.
}
EvtDeviceDOExit( )
{
1.call WdfUsbTargetDeviceCyclePortSynchronously fn again to reset the
device so that it operates in normal mode.
}
My other doubts are
1.If I give WdfUsbTargetDeviceCyclePortSynchronously the device is
resetted.Now while enumerating again how will DFU mode come into
picture.what actually happens?
2.AFter DFU mode comes into picture downloading takes place.calling
DeviceIoControl from application will call EvtIowrite fn.What does
loading firmware in EvtDeviceDOEntry mean.
3.Is it correct that the next reset (after downloading firmware)should
take place in EvtDeviceDOExit( ) fn.which is the ideal way?
4.Do I need to configure any USB pipes or USB Interfaces.Since it is
jus a DFU driver which sits on top of usb function driver I dont think
so we need to configure USB pipes and USB interfaces.It is the function
of the below fn driver.
5.Does all the USB device have the DFU descriptor embedded in its
normal run time descriptor?
Hope it is a lenthy posting.Please dont mind.
I need to do this within a short span.
Thanks in advance.
Expecting a reply post.
Doron Holan [MS] wrote:
> The WDFDEVICE created in DriverEntry is a KMDF driver object, not the NT
> object. you do not want to reset the pipe, you want to reset the entire
> device. I think you proably want to use
> WdfUsbTargetDeviceCyclePortSynchronously to reset the device.
>
> you probably want to download new firmware in EvtDevicePrepareHardware or
> EvtDeviceD0Entry, most likely EvtDevicePrepareHardware though and then
> immediately reset the device.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "zyx" <vidhya_542001 DeleteThis @yahoo.co.in> wrote in message
> news:1166272288.627796.222700@16g2000cwy.googlegroups.com...
> > Hi,
> > I have few more doubts.
> > I have found few things to reset the device
> > 1.In the EvtDeviceD0Exit function which is registered in adddevice
> > callback function I have to reset the device.I havent started to
> > work.jus a idea.
> > 2.In the EvtDeviceD0Exit function I have given
> > WdfUsbTargetPipeResetSynchronously or
> > WdfUsbTargetPipeFormatRequestForReset(dont know which exactly)followed
> > by wdfrequestsend.This should reset the device.Hope I am correct.
> > correct me if I am wrong.
> > IT WOULD BE GREAT IF YOU CLARIFY ALL MY DOUBTS.
> > THAKS IN ADVANCE
> >
> >
> > zyx wrote:
> >> Hi Doron,
> >> I have another doubt regarding driver entry routine.
> >> The input parameter for that routine is driver object and registry
> >> path.
> >> what does the wdfdrivercreate function do.The documentation says that
> >> it creates a driver object for calling the driver.what is the diff
> >> between both the driver object.ie,the input parameter and the one
> >> obtained by wdfdrivercreate method.
> >> I am not able to get it.
> >> Thanks in advance.
> >>
> >> zyx wrote:
> >> > Hi Doron,
> >> > I have gone thru the KMDF architecture to an extent.I think so I can
> >> > pick up the remaining things while implementing it.Right now I need to
> >> > get the basic idea of what I should do.
> >> > My work is to upgrade the device firmware.I have gone thru USB Device
> >> > Firmware Upgrade Specification.
> >> > According to my understanding for upgrading the device,I need to reset
> >> > the device so that the next time the device enumerates as a DFU device.
> >> > WdfUsbTargetPipeFormatRequestForReset is a method I found in the
> >> > documentation to reset device.I dont know whether it is correct.correct
> >> > me if I am wrong.The spec for USB DFU says to reset the device.Does it
> >> > mean resetting the pipe,or someother thing which I dont know.
> >> > Does resetting the device take place in driver entry routine as the
> >> > driver gets loaded in driver entry routine.
> >> > My first aim is to upgrade.so I will be concentarting on the write path
> >> > rather than reading from the driver.
> >> > In the spec they have given that the firmware upgrdation takes place in
> >> > 4 phases.
> >> > I am not able to get the function which takes place in enumeration
> >> > state.The question is ,
> >> > Is there anything special thing that happens only in DFU class driver
> >> > than other driver.Normally all the driver's first step is
> >> > enumeration.Do I need to do anything special in DFU.
> >> > It is said in the documentation that DFU class interface descriptor is
> >> > embbeded in the normal run time descriptor of the device.If this is
> >> > so,does all the usb drivers have support for DFU naturally.It is only
> >> > we who decide whether to do it or not.or should we modify anything in
> >> > the usb driver for it to support DFU class driver over it.
> >> > I am confused.
> >> > according to my understanding special thing that need to take place in
> >> > DFU is resetting the device so that it enumerates as DFU device.Once
> >> > upgrade is over again resetting it to normal mode.other functionalities
> >> > are similar to other drivers.either pass the IRP down the stack or
> >> > handle it.In this case I should concentrate the write path
> >> > ie,EvtIowritexxx funtion.
> >> > Could you clarify the above doubts.Am I in the right direction or
> >> > somewhere out of the line
> >> > I couldnt find more information regarding DFU in the net also.
> >> > Thanks in advance.
> >> >
> >> >
> >> >
> >> >
> >> > zyx wrote:
> >> > > Hi Doron,
> >> > > Thanks for your help.Right now I am going thru the KMDF architecture
> >> > > and it details.
> >> > > zyx
> >> > > Doron Holan [MS] wrote:
> >> > > > i suggest you write your driver using KMDF, see
> >> > > > http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx and then
> >> > > > download the
> >> > > > WDK.
> >> > > >
> >> > > > are you writing the firmware to the device via a HID interface? I
> >> > > > don't
> >> > > > understand the connection between DFU and HID, they are 2 separate
> >> > > > concepts
> >> > > >
> >> > > > d
> >> > > >
> >> > > > --
> >> > > > Please do not send e-mail directly to this alias. this alias is for
> >> > > > newsgroup purposes only.
> >> > > > This posting is provided "AS IS" with no warranties, and confers no
> >> > > > rights.
> >> > > >
> >> > > >
> >> > > > "zyx" <vidhya_542001 DeleteThis @yahoo.co.in> wrote in message
> >> > > > news:1166013047.977083.6370@79g2000cws.googlegroups.com...
> >> > > > > Hi All,
> >> > > > > Can anyone provide me any links that help in writing DFU class
> >> > > > > HID
> >> > > > > driver.Any sample code such as framework.I dont know were to
> >> > > > > start.I
> >> > > > > need to upgrade the firmware of my usb device when required.
> >> > > > > I am new to windows driver.I jus know the skeleton of the
> >> > > > > driver,the
> >> > > > > basic routines such driver entry,Add device routine,few dispatch
> >> > > > > functionalities,not all etc.I jus know few terms in the driver
> >> > > > > and how
> >> > > > > it works.
> >> > > > > My requirement is to write a DFU class HID driver for a usb
> >> > > > > device.
> >> > > > > My questions are:
> >> > > > > How will I signal my usb device to re-enumerate.Is there any
> >> > > > > IRP_MN_XXX
> >> > > > > to reset the device.If so from where will I send this IRP to
> >> > > > > re-enumerate the device.If it is an IRP_MN_XXX definitely it
> >> > > > > should be
> >> > > > > handled in dispatchpnp( ).what all this I need to take care if
> >> > > > > that
> >> > > > > particular IRP is send.
> >> > > > > Basically I am confused.where to start.
> >> > > > > Could anyone help me in providing a skeleton code for a DFU class
> >> > > > > HID
> >> > > > > driver
> >> > > > > Thanks in advance.
> >> > > > > It would be great if you help.
> >> > > > > zyx
> >> > > > >
> > >> Stay informed about: Help regarding DFU.