Device Driver Implementation
Posted: Sat Aug 16, 2003 11:00 pm
I'm a little confused on how to implement device drivers. I've been reading all the resources I can find on the subject, but none seem to cover it properly.
At the moment, I am working on the serial port / mouse device driver.
I know how to program the serial port, and read the data for a standard mouse.
What I don't understand is the device driver side of things. Does the app opening the device (via the driver) have to poll it to see if data is available?
Or does the device driver send messages via the kernal to the app that controls the device driver to tell it data is available.
I know how to implement both these methods, but which is better.
I would tend more toward the driver sending messages as an attempt to prevent buffer overruns on the hardware. But if the controlling app still doesnt request the data then overruns will occur. In the case of a mouse, simply throwing out data or ignoring incoming data will result in either a) mouse lag (best case) or b) out of sync data (worst case).
Any ideas on device driver implementation would be greatly appreciated.
At the moment, I am working on the serial port / mouse device driver.
I know how to program the serial port, and read the data for a standard mouse.
What I don't understand is the device driver side of things. Does the app opening the device (via the driver) have to poll it to see if data is available?
Or does the device driver send messages via the kernal to the app that controls the device driver to tell it data is available.
I know how to implement both these methods, but which is better.
I would tend more toward the driver sending messages as an attempt to prevent buffer overruns on the hardware. But if the controlling app still doesnt request the data then overruns will occur. In the case of a mouse, simply throwing out data or ignoring incoming data will result in either a) mouse lag (best case) or b) out of sync data (worst case).
Any ideas on device driver implementation would be greatly appreciated.