• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2889
  • Last Modified:

Mapping Usb to virtual com port

I wrote software a long time ago to send data to a printer via a com port, but now it needs to be usb. The printer doesn't like rs232 usb adapters so I thought I could have my app make a virtual com port, which works, but now I'm stuck at how you would map the correct usb to the virtual com port... or perhaps there's a way to modify the printers drivers to create the virtual port itself? I know some usb devices do just that... No idea how to do that though.
Thanks anyone!
2 Solutions
To map the USB to the com port, first share the (Windows) printer driver that uses the com port. then, from a DOS prompt, type:

NET USE COM1: \\PC_Name\printer_share_name /persistent:yes

Where printer_share_name is the share name allocated to the printer in the Sharing tab of printer Properties. If not using COM1, change it to the port number.

Note that most low-cost USB printers will not understand anything you send them from DOS and may print garbage or nothing at all. This is because USB printers are usually GDI printers, which do not support any printer language but rely on Windows' graphics engine to do the hard work for them. As you're bypassing the driver, Windows will not get involved and the printer will not understand. Look for a printer that supports PCL5 or ESC/P.
This is a pretty common problem with a number of devices when trying to use a USB to serial adapter.  For a serial printer this is not much of a surprise.

A lot of the USB to serial adapters only provide the basic transmit, receive and ground connections which is fine as long as the device does not use the other pins for anything.  Unfortunatly there are quite a few things that do need these other pins, like serial printers, in order to communicate properly.  

The big problem is that many adapters really don't mention this and even the documentation/specification are not too helpful.  So this leaves us with a bit of a trial and error scenario.  I've got several adapters in a box somewhere myself.

Here is an example of what you would likely need to get the printer working,


If you notice the specs it lists TxD, RxD, RTS, CTS, DTR, DSR, DCD, GND which  covers the bases.  The cheap units typically would do only TxD, RxD and GND.

Price is not always an indicator though most the do provide a full RS-232 implementation, and clearly say so, seem to be in the $40- $60 range.  A PCI serial IO card can be had for less or similar cost - if that is an option.

Most windows driver work is done in C/C++ and I think if you could buy a card it would likely be worth it to save the work involved in making your own USB driver.  Here is a link to a page that links in a couple of USB driver toolkits as well as links to MS's driver development kit,


The advantage of some of the third party kits is that you can use languages other than Visual C.

Forced accept.

EE Admin

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now