About RS-232, 485 series driver writing, similar to USB, see [1].
Camera driverProgram
The WDM camera driver consists of two parts: class driver, which is provided by MS and provides standard interfaces, and mini driver.
In WDM, the Mini driver first registers itself to the class driver. The class driver owns the device object, while the mini driver does not need to create the device object and calls the system using the device object in the class driver.
The class driver of a stream device controls requests and calls a small driver adapter to access specific hardware. When both the class driver and the small driver of the stream device are initialized, the small driver needs to wait for the class driver to call. The class driver sends a standard request to the small driver using the stream request block (sulfate). The small driver then answers the requests of the class driver after parsing the sulfate. It can transmit commands and data.
The goal of a class driver is to interact with the OS, including synchronization and provide standard interfaces. A small driver is called by a class driver and is responsible for hardware-related operations. When you write a small driver, you will register some callback functions with the class driver. The class driver as the main program will have the appropriate time to call these callback functions.
For the flow control process and example of a small driver, see [1].
[1] windows driver development details, Zhang Fan