Hi, I need to dynamically load and un-load drivers from Platform Builder to
deal with a problem that i have explained below.

Can someone tell me how to do any of these two things:

1- Tell WinCE to load my ftdi_ser.dll (a third party dll for ftdiâ??s serial
over USB chip) after loading every other dll at boot time. (note platform.reg
"order" doenst work in this case).

2- Un-load and re-load the ftdi_ser.dll after completion of the boot up
either from the Platform Builder environment or programmatically.
The problem is that the ftdi-ser.dll driver behaves differently if WinCE is
started with the external ftdi device attached to the USB port:

Normal operation: If I boot up WinCE and then plug in a serial over usb
device into the WinCE deviceâ??s USB port, the external device is detected by
the OHCI.dll and its driver FTDI_SER.DLL gets loaded after Wince loads the
OHCI.dll and it then operates normally i.e. I can plug the device in and then
un-plug the device and re-plug and re-establish serial comms over the USB all
normally.

Abnormal operation:
If I boot up WinCE with the external USB device attached to the USB port
already, the FTDI_SER.DLL still gets loaded but USB doesnâ??t function also the
FTDI+_SER.DLL does not get un-loaded when I detach the external device from
the USB port.
There are also other symptoms, in the registry viewer i can see under
/Drivers/Builtin/Active that the FTDI_SER.DLL doesnâ??t get un-loaded and
re-enumerated as it is the case under Normal Operation.

As a solution, I must tell WinCE to load FTDI_SER.DLL after loading all
other dlls.
Or as a workaround I could get WinCE to un-load the FTDI_SER.dll after
loading all the dlls and then re-load it again.

Thanks and regards,
EZ

Re: Driver Load Sequence by Steve

Steve
Wed May 25 21:30:12 CDT 2005

You can't programmatically load/unload USB client drivers only the USB host
driver can do that. Just unplug the device and the host driver will unload
the client driver.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



Re: Driver Load Sequence by EZ

EZ
Wed May 25 22:53:02 CDT 2005

Thanks Steve. The problem is that detaching the external device from the USB
port doesn't un-load the driver, the driver gets stuck in somehow as if the
OS doesnot know that it is there. But this only happens if WinCE is started
with the USB device attached to the USB port otherwise everything works fine.
When the WinCE device is booted with the external FTDI device physically
attached to the USB, the Host driver loads the FTDI_SER.DLL at boot time. The
problem is that under this senario the Host Controller can not un-load the
driver when the external device is detached. In a way the OHCI driver gets
stuck and it wouldn't work properly either. Basically the WinCE device can
only handle the external USB device properly if it is attached after
completion of the boot up sequence.
So to resolve this problem i need to tell WinCE not to load the FTDI driver
until every other DLL is loaded and boot up sequence is complete.
Alternatively if it is not possible to tell wince to load the driver until
after system boot, i need to somehow un-load the ftdi driver as soon as it
gets loaded during the system boot up and let the boot up sequence finish and
then load the ftdi driver. Maybe i could write a script that runs at start
up, but by what i read from your post doesnt look like that can be doen
programatically, something using insmod and rmmod in unix like OSs.

Regards,
EZ.

"Steve Maillet (eMVP)" wrote:

> You can't programmatically load/unload USB client drivers only the USB host
> driver can do that. Just unplug the device and the host driver will unload
> the client driver.
>
> --
> Steve Maillet
> EmbeddedFusion
> www.EmbeddedFusion.com
> smaillet at EmbeddedFusion dot com
>
>
>

Re: Driver Load Sequence by Bruce

Bruce
Thu May 26 08:41:50 CDT 2005

Have you tried changing the order of the USB Host driver so that it loads
last?

--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member


"EZ" <EZ@discussions.microsoft.com> wrote in message
news:FD74D2DD-C9C6-488F-A432-BF006048FA41@microsoft.com...
> Thanks Steve. The problem is that detaching the external device from the
USB
> port doesn't un-load the driver, the driver gets stuck in somehow as if
the
> OS doesnot know that it is there. But this only happens if WinCE is
started
> with the USB device attached to the USB port otherwise everything works
fine.
> When the WinCE device is booted with the external FTDI device physically
> attached to the USB, the Host driver loads the FTDI_SER.DLL at boot time.
The
> problem is that under this senario the Host Controller can not un-load the
> driver when the external device is detached. In a way the OHCI driver gets
> stuck and it wouldn't work properly either. Basically the WinCE device can
> only handle the external USB device properly if it is attached after
> completion of the boot up sequence.
> So to resolve this problem i need to tell WinCE not to load the FTDI
driver
> until every other DLL is loaded and boot up sequence is complete.
> Alternatively if it is not possible to tell wince to load the driver until
> after system boot, i need to somehow un-load the ftdi driver as soon as it
> gets loaded during the system boot up and let the boot up sequence finish
and
> then load the ftdi driver. Maybe i could write a script that runs at start
> up, but by what i read from your post doesnt look like that can be doen
> programatically, something using insmod and rmmod in unix like OSs.
>
> Regards,
> EZ.
>
> "Steve Maillet (eMVP)" wrote:
>
> > You can't programmatically load/unload USB client drivers only the USB
host
> > driver can do that. Just unplug the device and the host driver will
unload
> > the client driver.
> >
> > --
> > Steve Maillet
> > EmbeddedFusion
> > www.EmbeddedFusion.com
> > smaillet at EmbeddedFusion dot com
> >
> >
> >



Re: Driver Load Sequence by EZ

EZ
Thu May 26 17:18:02 CDT 2005

Hi Bruce,
Thanks for your respond. Yes i have changed the load order in platform.reg
for OHCI as well as USBFN dlls to be higher than all the other modules.
This changed the order of loading relative to some other modules but it
didn't do exactly what i wanted to do which was load the OHCI.dll at the very
end.
Is it correct to assume that the "order" entry in the platform.reg is
somehow only advisory? There are some other USB related modules which might
be creating dependencies for example the USBD.dll. If this is the case i will
need to go and change the load order for these ones as well.

EZ

"Bruce Eitman (eMVP)" wrote:

> Have you tried changing the order of the USB Host driver so that it loads
> last?
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
> beitman AT applieddata DOT net
>
> Applied Data Systems
> www.applieddata.net
> An ISO 9001:2000 Registered Company
> Microsoft WEP Gold-level Member
>
>
> "EZ" <EZ@discussions.microsoft.com> wrote in message
> news:FD74D2DD-C9C6-488F-A432-BF006048FA41@microsoft.com...
> > Thanks Steve. The problem is that detaching the external device from the
> USB
> > port doesn't un-load the driver, the driver gets stuck in somehow as if
> the
> > OS doesnot know that it is there. But this only happens if WinCE is
> started
> > with the USB device attached to the USB port otherwise everything works
> fine.
> > When the WinCE device is booted with the external FTDI device physically
> > attached to the USB, the Host driver loads the FTDI_SER.DLL at boot time.
> The
> > problem is that under this senario the Host Controller can not un-load the
> > driver when the external device is detached. In a way the OHCI driver gets
> > stuck and it wouldn't work properly either. Basically the WinCE device can
> > only handle the external USB device properly if it is attached after
> > completion of the boot up sequence.
> > So to resolve this problem i need to tell WinCE not to load the FTDI
> driver
> > until every other DLL is loaded and boot up sequence is complete.
> > Alternatively if it is not possible to tell wince to load the driver until
> > after system boot, i need to somehow un-load the ftdi driver as soon as it
> > gets loaded during the system boot up and let the boot up sequence finish
> and
> > then load the ftdi driver. Maybe i could write a script that runs at start
> > up, but by what i read from your post doesnt look like that can be doen
> > programatically, something using insmod and rmmod in unix like OSs.
> >
> > Regards,
> > EZ.
> >
> > "Steve Maillet (eMVP)" wrote:
> >
> > > You can't programmatically load/unload USB client drivers only the USB
> host
> > > driver can do that. Just unplug the device and the host driver will
> unload
> > > the client driver.
> > >
> > > --
> > > Steve Maillet
> > > EmbeddedFusion
> > > www.EmbeddedFusion.com
> > > smaillet at EmbeddedFusion dot com
> > >
> > >
> > >
>
>
>

Re: Driver Load Sequence by Steve

Steve
Thu May 26 17:38:48 CDT 2005

The order key is definitive and not just a "recommendation" the device
manager loads drivers based on the order value.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



Re: Driver Load Sequence by Ten

Ten
Fri May 27 08:48:17 CDT 2005

It has been my experience that this is true only within the class of
deviced currently being loaded.

For example, I have a PCI device driver that is loaded as part of the
PCIBUS enumeration process. Setting order to FFFF caused it to be the
last *PCI* driver to be loaded but relative to other device drivers in
the system it did not load dead last.

Nick.

Steve Maillet (eMVP) wrote:
> The order key is definitive and not just a "recommendation" the device
> manager loads drivers based on the order value.
>

Re: Driver Load Sequence by Steve

Steve
Fri May 27 09:38:41 CDT 2005

It applies ONLY to those devices loaded directly from the "BuiltIn" key.
When and in what order a BUS driver loads drivers for it's clients is up to
the bus driver. A well behaved one will use the order value. So if your
device has a dependency on another one on another bus or one loaded directly
from the BuiltIn key then you need to make sure the bus driver itself is
loaded after the other drivers to insure they are loaded before your driver.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com