Sorry for the very elementary question, but the last time I did a windows device driver was before WDF even came out. So, I want to ensure that I am taking the correct approach to this.
I have a legacy application that has been talking to a USB device that has 2 Bulk Endpoints. 1 IN and 1 OUT. The Previous Driver was from some ESC/POS sample driver that I can’t find anything about. The previous driver had to handle a Serial Connection and A USB connection and did Serial over USB.
I was able to get the KMDF Example OSRUSBFX2 device to work with our application with a slight modification to the setup. Namely, I got rid of the interrupt Endpoint in the driver.
For our new hardware, we will have 3 Endpoints. 2 IN and 1 OUT. We no longer need to support anything except a USB Connection. So my thought was to have a thread monitoring each Endpoint via ReadFile. However, I am unsure how to signal to ReadFile which endpoint to read?
What is the best approach for allowing the Application to to talk to the 2 IN Endpoints? Is there a way I can have the Read Handler(OsrFxEvtIORead) determine which endpoint is intended?
Or, would you create an IOCTL to read that additional endpoint and just let ReadFile and WriteFile Read/Write to the main IN and OUT endpoints? If the Custom IOCTL is deemed a good approach, would you just have it pass the Endpoint into a Call to OsrFxEvtRead in order to reuse the code that already services the other endpoint? This doesn’t seem like the right way to go.
Further, Is it a good Idea to take OSRUSBFX2 as a starting point and then Just modify it to handle a few custom IOCTLS and the new Endpoint?
Note that the Application needs to be backwards compatible, so I will probably have to create an IOCTL to determine if I am talking to the new device. Or, possibly using one of the USB IOCTLS that will get the Device Descriptor to determine the PID of the Device. Goal here is to not have to rewrite the whole applicaiton layer and Minimal Device Driver work since our schedule is tight. However the old driver is inadequate and only Services one IN and one OUT Endpoint. So, I thought this might be a good chance to use the KMDF to solve this problem.
Hopefully, I didn’t sound like a complete idiot, but have been out of windows device drivers for about 8 years. I am enjoying relearning this, but it is a pretty steep curve. I would like to continue doing windows driver development. I have the debugger going and was able to get the sample working with our current hardware in fairly short order.
Thanks In Advance.