Hello Everyone,
First things First, I am new to Windows device driver development so please forgive
me if i don’t get some of your answers & ask you to elaborate on the same.
Now I have been assigned a task to develop a Virtual COM port driver that would communicate with a USB printer. Our client has a Printer that can be connected to the PC through serial port or USB port. When ever we connect the printer through the USB port then the name of the printer appears under “Other devices”. Our task is to develop a virtual com port driver that would enable the user to send data & commands to the USB printer through any serial application( for eg: hyper terminal). Client doesn’t ahve any windows USB driver for its printer.
Things I have tried:
I started by installed VS2015 along with WDK 10 on my PC, downloaded the sample WDK projects form GitHUB, compiled VirtualCOM project under source/serial/virtualcom folder, installed it on the target machine through command prompt with the help of devcon.exe.
Once the driver is sucuccefully installed on the system it appears under Ports( COM & LPT). I am able to send data to the virtual com port through a PC application & see the same on hyper terminal.
Now as I mentioned earlier that the printer appears under "“Other devices” & my virtualcom port UMDF driver appears under “Ports(COM & LPT)”. Now My concern is am I going in the right direction. i.e., developing a virtual COM port UMDF driver I found a book “Windows 7 device driver by Ronald D. Reeves” & in its UMDF driver section it says that we can send an I/O request form one device stack to another device stack through IWDFFileHandleTargetFactory interface by creating the I/O target with the help of Win32 CreateFile API. So as my virtual COM port driver appears as a device under “Ports(COM & LPT)” & Client’s printer appears as a device under “Other devices” & each device has its device stack So I thought we will be able to map the I/O controls of my virtual COM port driver to the client’s printer. So under CMyQueue::OnDeviceIoControl function in my UMDF virtual COM port driver code I opend the printer through CreateFile API & then tried to maked it as the I/O target of my virtual COM port driver by passing the File handler obtained from CreateFile to IWDFFileHandleTargetFactory::CreateFileHandleTarget. After these modification when I install the driver it asks for a system restart, after which yellow exclamation (!) appears on the virtual COM port in the Device Manager.
Now here I am stuck & have the following queries.
- Is Virtual COM port UMDF driver is the right way of implementing the virtual COM port driver that my client require. If YES then what am I missing & if the answer is NO then what id the write approach.
Thank you in advance for you help & guidance