Driver is not working for more then two devices of same VID and PID and different ser

Hello Everyone,

I have created a usb driver for a usb printer device. Every times I need to install the driver for the same printer device (same VID and PID). I think its needed to enumerate the printer device automatically, that means not need to install every time.

Here biggest problem is that when I will try to communicate with two printers with a custom application then every times only a one printers printed the data second printer does not printed any data, both the printer have same vid and pid only they have different serial number. I am a newbie in windows device driver, I am not able to find the exact reason why only one printer is working here.

How do you open the device in user mode ?

Do you use device interfaces or symbolic links ?

Typically, your driver’s EvtDriverDeviceAdd (I assume you use WDF) registers a device interface each time a functional device object is created.

Thanks D.T. for Reply…

Actually D.T., I am creating a virtual com port to communicate with usb device. I am creating two driver one is for virtual com port and another for the usb device.

I am registering the DEVICE_INTERFACE of usb device in a virtual com port driver using the IoRegisterPlugPlayNotification(). Every times when I attached the usb device to the pc then I will get a pnp notification to the virtual com port driver and get the symbolic name of usb device.

Using this symbolic link I am creating the IO_TARGET to send the formated request from the virtual com port to usb device.

It is working fine with single usb device but when I am creating more then one com port and attach the more then one usb device then only one device working properly.

For multiple virtual com-port I need to install the driver multiple times.
Is it correct way to create more then one virtual com-port ? Please do the needful.

please look the reference from the winddk under this path :

C:\WinDDK\7600.16385.1\src\general\amcc5933

C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\static

C:\WinDDK\7600.16385.1\src\general\toaster\exe\enum

Application uses the GUID which has been registered in your driver side and
app will communicate to the driver through the driver handle.

In your case same driver has been loaded for two devices and application
will ask you which one you want to select and call the
deviceiocontrol/write/read system call to communicate to driver.

On Thu, Feb 9, 2017 at 4:05 PM, wrote:

> Thanks D.T. for Reply…
>
> Actually D.T., I am creating a virtual com port to communicate with usb
> device. I am creating two driver one is for virtual com port and another
> for the usb device.
>
> I am registering the DEVICE_INTERFACE of usb device in a virtual com port
> driver using the IoRegisterPlugPlayNotification(). Every times when I
> attached the usb device to the pc then I will get a pnp notification to the
> virtual com port driver and get the symbolic name of usb device.
>
> Using this symbolic link I am creating the IO_TARGET to send the formated
> request from the virtual com port to usb device.
>
> It is working fine with single usb device but when I am creating more then
> one com port and attach the more then one usb device then only one device
> working properly.
>
> For multiple virtual com-port I need to install the driver multiple times.
> Is it correct way to create more then one virtual com-port ? Please do
> the needful.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:> showlists.cfm?list=ntdev>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:></http:>

I understand how your USB driver gets loaded but how is the virtual COM port driver loaded ?

Rather than registering a kernel mode PNP notification, you could register a user mode PNP notification, within a user mode service. Each time a new USB device interface corresponding to your USB printer is reported, the user mode service is notified and consequently creates a virtual COM port in the “DEVCON.EXE” style. This virtual COM port would be associated to the reported USB device. This way you would have a virtual COM port for each USB printer.

You could also try to create the virtual COM and associate it with the USB device within a coinstaller.

https://msdn.microsoft.com/en-us/library/windows/hardware/ff553394(v=vs.85).aspx