USB architecture: driver loading question

Damjan Jovanovic damjan.jov at gmail.com
Sun Jan 23 03:14:18 CST 2011


Hi

There's essentially 2 ways USB could work in Wine[1]:

1. Process per driver, but special-case loading and initializing USBD.SYS
Like my previous patchset:
http://www.winehq.org/pipermail/wine-patches/2010-November/095883.html
http://www.winehq.org/pipermail/wine-patches/2010-November/095884.html

2. Dedicated process for USB, in which USBD.SYS loads first, and it loads
USB device drivers (possibly > 1) into the same process as the need arises.

What's the right way? Which approach is going to get my patches accepted?

Thank you
Damjan

[1] Because the steps are as follows:
1. USB device is plugged in
2. USB hub driver looks up the driver based on the device
class/vendor/product IDs
3. The device driver gets loaded and DriverEntry() gets called on it
4. AddDevice() gets called on the driver, specifying the device
5. Only then, the driver calls things lower in the stack, to do USB I/O

The driver needn't load any other driver in its DLL import table, and even
if it did, drivers loaded through the import table don't have their
DriverEntry() called, so they cannot do anything on load. Even if we rely on
most USB drivers loading USBD.SYS, USBD.SYS needs to do steps 1-4 first, but
it wouldn't have control passed to it until step 5, hence it can't ever do
anything. The only way out is one of the following:
1. Process-per-driver, but when a driver loads USBD.SYS, USBD.SYS is
special-cased by winedevice, ie. it has a special export called on it at
load which specifies the other driver and gives it a chance to create a
separate thread for steps 1-4.
2. Dedicated process for USB, in which USBD.SYS loads first, and it loads
USB device drivers (possibly > 1) into the same process as the need arises.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110123/3238dd48/attachment.htm>


More information about the wine-devel mailing list