How to create a static virtual com port for usb printer device.

Hello All,

I have written a virtual com port driver for usb printer device,Its working fine as per the requirement.Initially we want this virtual com port dynamic means that it appears only when printer is attached with PC but now we want to make this virtual com port static.

So my basic question is that, what is the right way to create a static virtual com port.
Please show me the right direction.

Thank you so much.

What bigger problems are you trying to solve? What will happen when the com port is opened and there is no printer present?

Get Outlook for Androidhttps:

________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@chetu.com
Sent: Tuesday, October 25, 2016 5:55:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to create a static virtual com port for usb printer device.

Hello All,

I have written a virtual com port driver for usb printer device,Its working fine as per the requirement.Initially we want this virtual com port dynamic means that it appears only when printer is attached with PC but now we want to make this virtual com port static.

So my basic question is that, what is the right way to create a static virtual com port.
Please show me the right direction.

Thank you so much.


NTDEV is sponsored by OSR

Visit the list online at: http:

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:</http:></http:></http:></https:>

Thank you so much doron for your reply.

What bigger problems are you trying to solve? What will happen when the com port
is opened and there is no printer present?

Client have multiple printer so he wants a dedicated static com port for the printer and they said that to implement the control signal to identify printer is attached or not. It’s create a confusion so please show me the right path, how to implement the static virtual com port and how to use control signal to check
printer is attached or not.

I have no idea how to signal the printer’s presence. I would assume it would be with one of the serial lines changing state. Your customer has their requirements backwards by the way. Windows can tell the app when printers come and go, there is no need to create a static name just to put discovery behind it

Get Outlook for Androidhttps:

________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@chetu.com
Sent: Tuesday, October 25, 2016 7:24:58 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to create a static virtual com port for usb printer device.

Thank you so much doron for your reply.

What bigger problems are you trying to solve? What will happen when the com port
is opened and there is no printer present?

Client have multiple printer so he wants a dedicated static com port for the printer and they said that to implement the control signal to identify printer is attached or not. It’s create a confusion so please show me the right path, how to implement the static virtual com port and how to use control signal to check
printer is attached or not.


NTDEV is sponsored by OSR

Visit the list online at: http:

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:</http:></http:></http:></https:>

xxxxx@chetu.com wrote:

I have written a virtual com port driver for usb printer device,Its working fine as per the requirement.Initially we want this virtual com port dynamic means that it appears only when printer is attached with PC but now we want to make this virtual com port static.

So my basic question is that, what is the right way to create a static virtual com port.
Please show me the right direction.

This is totally the wrong approach, as Doron said. Virtual COM ports
are limiting and finicky – it’s not the right model. There is already
a spec for USB printers, but even if you had exposed it as a custom USB
device, you could have done this with no kernel work at all. You write
a small DLL that calls WinUSB to talk to the device, then you can
implement whatever external interface you want, including arrival and
departure notifications, all using 10-year-old technology, instead of
emulating 60-year-old technology.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thank you so much doron for your valuable comments.

I am understanding your points, but as per the client requirements, we have to implement the static com-port.So please if you have any idea about to how to create a static com port then please share with me it will be very helpful me.

A static virtual com port is easy.
1 Create a second driver for the serial port implementation. You can take the serial example and rip out everything in the code that has to do with touching real hardware.
2 create root enumerated device and install your driver on it. Devcon create will do it for you as a way of getting started
3 add detection logic for when your printers come and go (IoRegisterPlugPlayNotification is your friend) and how to open the handle to them, how to keep track of each printer etc
4 figure out the logic for each serial IO request how to handle the case where there are no printers, one printer, or many printers
5 how to synchronize 3 & 4

Do not underestimate the work here, it is really really complicated

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@chetu.com
Sent: Tuesday, October 25, 2016 10:28 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to create a static virtual com port for usb printer device.

Thank you so much doron for your valuable comments.

I am understanding your points, but as per the client requirements, we have to implement the static com-port.So please if you have any idea about to how to create a static com port then please share with me it will be very helpful me.


NTDEV is sponsored by OSR

Visit the list online at: http:

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:</http:></http:></http:>