Hi,
Candy wrote:UDI does sound like a good idea...
In theory, the concept of standardized device drivers sounds extremely good. In practice any possible standard will rely too much on the overall OS design to allow that standard to be used for all OSs.
Consider a simple device, a parallel port device driver for example - bytes are sent, bytes are received and there's not much else. A common device driver sounds easy..
First step would be resources. For some OSs, the I/O ports used by the device driver would be specified at compile time, for others there'd be command line options used when the device driver is started. Maybe it gets this information from a configuration file instead, or perhaps some other software (like a "device manager") sends this information to the device driver via. IPC.
Once it knows which resources to use, does it have to "allocate" them from the kernel or is this done for it (or not necessary)? If it does, can it send a list of resources or does it have to allocate each individual resource one by one?
What happens when the computer has 2 almost identical parallel ports? Is the same driver started twice, or is only one driver started that handles both parallel ports. If only one driver is used, does it spawn an extra thread for the extra parallel port, or does the same thread handle both devices? Does the device driver use threads at all?
How does software that wants to use the driver know how to find it? Does the device driver create an entry in the file system (e.g. "/dev/lpt0") or is there a different method used, like named pipes with a different namespace? Does the device driver autodetect what hardware is plugged into the parallel port and start the device driver for the printer (e.g. plug & play standards), or does it tell some other code that another device is present (e.g. notify a device manager that takes care of it), or is the auto-detection done elsewhere?
When some software wants to send some bytes through the parallel port (after establishing a connection to the device driver), does it just tell the device driver the address of a buffer and how many bytes to send, or does it need to send these bytes to the device driver over IPC, or does it need to negotiate a shared buffer beforehand? If software wants to send 23 MB of data to the printer (a high resolution photograph or something), can it all be sent in one go or does it need to be split into several smaller transaction. If so, how is flow control handled?
How about when bytes are received - does the device driver send a message containing the received data, or does the device driver put the data in a buffer and wait for someone to read them from the buffer? If a buffer is used, where is it - in client-space or in the device driver's space, and what happens if it overflows?. How does anyone know bytes are available to read - is polling involved or some sort of notification? Would the notification be a callback or IPC?
Now imagine you're trying to develop a device driver standard that is meant to be suitable for all OSs. As soon as you make a descision on any of the things above, you've limited the standard to a specific kind of OS. If you allow for all possibilities (e.g. if the standard supports every option above), then you'd end up with an unusable mess. If it's this hard for something simple device like a parallel port driver, how many problems do you think there'd be for something more complex, like a USB controller or video card?
Candy wrote:For myself, I consider UDI not good, but I can't explain why.
That's called "intuition"...
Cheers,
Brendan