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!
take2lakeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hdhondtCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kode99Commented:
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,

http://www.neteon.net/prod.aspx?clvl=4&c1=1&c2=125&c3=134&c4=140&p=435#curr

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,

http://www.beyondlogic.org/usb/usbdevdrvs.htm

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



0
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.