Using a virtual printer to modify a receipt in a POS printer - printing

I am trying to modify the receipt printed in a POS printer using a virtual printer and some custom libraries. However I read that (old) POS printers worked by writing directly to a serial port, and if that's the case I would need more a port listener, as opposed to a conventional windows virtual printer. Is that correct?
I am trying to build a general solution, trying to cover as many cases as possible, but I got that direct serial is somewhat an outdated practice.

Check if the printer manufacturer has a virtual serial port emulator you can use. Most old POS software was written to send commands over a COM port. The emulator essentially listens in on that port, intercepts the commands, and translates them so a modern USB or Ethernet printer can output the print jobs.
That chart can be found here with more information: http://www.starmicronics.com/support/TechnologyCategoryDetail.aspx?id=28

This app sends data directly to a COM port and not to a Windows queue of any sort? What port options do you have? If you have LPT as an option that could be remapped to a share and then captured using Redmon or similar port monitor.

Related

Writing To Multiple TCP Ports From A Print Monitor

I have a language monitor that I am trying to query the printer from.
First let me apologize for the possible confusion since "port" means 2 things in this description. There is the one use that refers to the port that the printer is configured to use, which could be TCP, USB, etc. And then there is the use of port that refers to the port address to send data to when communicating with the printer's IP address.
I need to be able to specify different port addresses to send different custom queries to a printer over the same IP that are specific to it's firmware. I can't find any examples or documentation on what the standard way is to do this communication... I can extract the IP address and open a net socket, but I am not sure if this is the appropriate way to handle this communication. It's not uncommon for printers to send status over one port, and print data over another. If i want to write to the Default port I can use pfnWritePort and pfnReadPort, but these don't allow me to specify the actual port.. it uses whatever the driver is configured as.
Can anyone provide some guidance or examples of how I should do this from my language monitor?
EDIT: As an example for clarification, all commands are sent to the same IP, but depending on the command/query I need to send, the TCP port needs to change. The way I am handling it now is opening up a net socket with the same IP and different port numbers for data and status channels).
You should be required to write an app that would be able to reconfigure driver. Ideology of OS is that EACH real device would corresponds to instance of driver and\or interface. Which might be an elevated action, because it requires to create new printer interface("port" in Windows GUI terms) and change driver settings.

HPLIP 3.13-11, A LaserJet 4/4M with a JetDirect: no workie

I'm trying to get a very old, but working great C2001A/J4100A (HP LaserJet 4) to work with the HP Linux Imaging and Printing library, but I'm having an awful time of it.
1) There's no entry in /usr/share/hplip/data/models/models.dat for [hp_laserjet_4]. This is the first problem so far when I used Bonjour discovery through an avahi.service file I put on my OpenWRT router. I don't currently have an iPhone I want it to discover with AirPrint, but this is how I started off and helps CUPS finds printers anyways.
2) SLP discovery is a complete bomb. I've traced it down to the UDP packet the JetDirect sends off in response to the broadcast discovery request. The part that is 'x-hp-p1=0' should be something like 'x-hp-p1=MFG:HP;MDL:LaserJet4;etc..' and it causes hp-probe to fail to see what printer the JetDirect is plugged into.
I can't seem to force HPLIP to bypass the bad discovery methods and it's too smart and wants to verify.
I've posted to the HPLIP help area, but they seem to run a week slow.
Instead of doing JetDirect, try LPR directly to the IP address. And any of the older PCL drivers should work against that printer.

pcap - streaming and receiving udp in the same computer

To explain what I would like to get, here's an example.
Let's say, we have a PC with one NIC. It has single IP address 172.16.0.1.
Using VLC, we start a udp stream to 172.16.0.1:1234, then launch another copy of VLC and connect to udp://#172.16.0.1:1234. Now we'll see our video streaming.
If you run sniffer, you will see packets from 172.16.0.1:some_random_port to 172.16.0.1:1234 on loopback. There's no trafic on our NIC.
What I want to do is to stream and receive udp in the same computer, like VLC does it. But the main problem is that pcap can only pcap_open() a real device, it can't work with loopback.
Is it possible to solve that problem?
P.S. I'm using Windows and WinPcap, unlike Linux version, it can send packets.
If you just want to send and receive UDP packets, I would suggest just using regular Winsock sockets, just as you'd use regular sockets on UN*X; using WinPcap requires that you re-implement IP and UDP, and won't let you send to another socket on the same machine under Windows (or on at least some versions of UN*X, either).
If you want to watch the traffic you're sending, unfortunately WinPcap won't help, as it relies on packets being sent out and received from NDIS (its driver plugs into NDIS), and that doesn't happen for packets sent from one socket on a machine to another socket on the same machine.
(Note, BTW, that libpcap can send packets on Linux and *BSD and Mac OS X and Solaris and Digital/Tru64 UNIX, for example, and has been able to do so for several years; older versions of libpcap didn't support it, but the versions available for the past few years can. However, as per my first paragraph, it would not make sense to use libpcap to send and receive regular UDP packets on those OSes, just as it makes no sense to use WinPcap for that purpose on Windows.)

Debug COM port read/write using software/virtual COM port and console/terminal on the other end

I have a Delphi application that reads/writes to a COM port connected to a large hardware device, so I don't usually have the hardware available during development. That said, the communication protocol is fairly simple, so I can generally do the development and have someone onsite test it, and it usually works. Occasionally I run into a harder problem, though. To solve this, I'd like to setup a virtual COM port where one side of the COM port is my application and the other side is a very simple COM port debug console (similar to the old modem terminal programs), where ASCII commands my app sends are logged onscreen and I can type in some ASCII command to send back to my application to simulate the hardware device. I've been unable to find any tools that provide a virtual/software COM port and a console/terminal to debug with. Does anyone have software suggestions and steps to set something like this up?
The software/virtual COM port and terminal need to support Windows 7 64-bit (or Vista 32 if necessary).
I'm doing something similar with paired virtual COM ports created by
http://com0com.sourceforge.net/
I'm using Advanced Virtual COM Port and I'm quite happy with it. Not free, but works like a charm - even with Win7-x64.
Can't you just insert a redirector at the lowest level of your application which will pop up a console instead of writing data to COM? Should not take long.
I can't vouch for it, but sounds like something like this is what you're looking for. http://www.windows7download.com/win7-free-virtual-serial-ports-emulator/yarqmowu.html
I have used Eterlogic's Virtual Serial Ports Emulator successfully for exactly this on a laptop with no serial ports. It's a bit easier to set up than Com0Com, which I have also used. It's also useful for serial port spying if you need to reverse engineer any communications
The 32-bit version is free, the 64-bit version is currently $25. Try it out on Vista32 to see if it does what you need.
I use Com0Com for this purpose, but I don't know whether it works with anything more recent than Windows XP.

Where can I find resources on developing a PostScript printer for Windows 7

I'm developing a virtual printer to accept print jobs and route them to real printers in a LAN. I'm hoping to create a postscript printer to act as a shared virtual printer to accept print jobs from the LAN, I hope to develop it through ghostscript and redmon.
If you can please let me know any online resources, examples or any tutorials on hows to create a postscript printer on windows 7.
Thank you very much, please let me know if you know anything.
It will be easier to use an existing PostScript printer driver (such as a generic one provided with Windows), and then instead create a port monitor. You will need to use the Windows Driver Development Kit (freely available) in order to create a port monitor. Once you have created your port monitor, you can install a printer using any driver, but tell it to communicate via a port that your monitor will intercept.
You will end up getting the exact data that would have been sent directly to the printer had it been configured to use an IP or other port instead of your port. For example, you can create a port called “ZERONE:” which is monitored by a port monitor called “Zerone Port Monitor”.
MSDN has a sample for a port monitor that interacts with infrared devices, although it will give you an idea on what you need to do so that you can communicate with other devices on a network.
Alternatively, and perhaps more hackishly, you can create a port called “C:\doc.prn”, and any document that is printed will be saved as PostScript to “C:\doc.prn” (provided that the printer driver is a PostScript driver).

Resources