Hello OSR community,
I jumped head first into windows driver development a week ago and I am stuck now.
Coming from C++, I looked at some C tutorials and I understand how it works now basically - I have a big lack in experience though.
After working through documentation, examples and tutorials for a week now, I definitely learned a lot about how drivers work in windows, but on a very abstract level. Seriously, every tutorial out there seems to be about drivers that don’t do anything or that are for devices that do not physically exist.
So, to put it in questions (data about the driver/project is below the questions):
(1) I read it is possible to write drivers in C++, but every tutorial and example
is in C. I also read that there is not much C++ support.
Did those two sentences actually mean the same or does the latter mean
that C++ drivers won’t work in certain machines/configurations?
(2) In my situation, would it be advisable to try and code it in C++?
(3) If the answer to (2) is ‘no’: Do I have to get years of C experience first before I
will be able to write a decent driver?
Hmmm… If the answer to (2) is ‘Don’t even think about it’ and the answer to 3 is ‘yes’ then you don’t have to bother about the rest of the questions, I guess.
(4) Are filter drivers more like an enhancement to a standard
(a bit like a subclass) or more like the data for a template?
(5) Should I use KMDF or UMDF?
(6) Does UMDF have disadvantages?
(6a) And in my specific situation?
(7) What kind of driver would fit my situation best?
(filter, mini, wdm, etc; I lost overview over which means what)
(8) I actually have provisioned my desktop PC (I am coding on my Laptop);
According to the other answers, will it be necessary to use it for
debugging?
(I can imagine a graphic tablet driver not being as system-critical as
e.g. the processor driver, but I could also imagine a stupid USB powered
light crashing a system with a misconfigured driver.)
(9) I have the parts ‘around’ the driver: I know what data I get from the device
in what format and I know what should happen in the OS,
but neither do I have an idea where the values from the device enter the
driver, nor do I know how the driver would e.g. set the mouse position.
Where does this happen?
(10) Maybe there is a working driver that I can use as-is while only changing
the part about the data getting in and the mousepointer control.
If yes, where is it?
(11) How close am I to my primary goals? (or how difficult is it)
(12) How close am I to my secondary goals?
(13) How close am I to my tertiary goals?
(14) If I missed the point somewhere (and most certainly I have):
Where and how?
================================================
Current state of the project:
Target OS (as well as dev machine) is win7 x64.
Device: Graphical tablet “Wacom UltraPadA5”
- very old (drivers for x64 do not exist)
- connection via serial port
- connected to test machine via a third party usb-to-serial adapter
Is potentially able to do (well, what wacom says): - absolute mouse position movement
(pen in upper right corner -> mouse jumps to upper right corner of screen) - relative mouse position movement
- left click, right click, double left click
- ‘erase’ functionality with the back of the pen (like a pencil with eraser)
- 16 buttons; first 5 user programmable, 6-14 are equivalent to key
combinations (cut, copy, paste, undo, del, new, open, save, print),
15 and 16 are for switching between absolute and relative movement
Reading out the serial (at 9600 baud), I saw that a package consists of 7 bytes:
- [0] kind of message (button pressed, moving pen over tablet,
writing, erasing, pen moved out of range) - [1] X position value before floating point
- [2] X position value after floating point
- [3] indicates left click, right click or double left click; on left click it takes
values 0,4,8 or 12 - could be pressure value before floating point - [4] Y position value before floating point
- [5] Y position value after floating point
- [6] when [0] indicates a button was pressed, this gives the button number,
else it could be pressure value after float
My primary goals for this driver are:
- move the mouse pointer (doesn’t matter if relative or absolute)
- perform a mouse click when the pen is put down
- perform a mouse drag when the pen is put down and moved
(I don’t know if that’s a difference to mouse click)
Secondary goals include: - both types of movement and switching between them
- right click and double left click
Tertiary goals (at this stage, I don’t care about this at all) are: - from the buttons, make the key combinations work
- make the pressure work like it does in other graphic tablets
(so it can be used in graphic tools for line strength etc.)
Finally, IF it is rather easy and there’s a win library for it, I would like to make the buttons user programmable.
Thanks for reading this novel, the book will be out soon.
OK seriously, thanks for reading all this and thanks in advance for the answers!