Question

I have a receipt printer connected to my COM port and every time someone prints to my receipt printer, I want to add some extra data to the data going out the COM port. I am on Linux. How can I intercept the data going out and modify it so that I can add the extra data to the receipt printing?

I basically want to write a program lets call it A, which works between my normal program, lets call it B, which prints receipts and the printer by hooking into the com port.

I cannot modify the program B, this is why I want to intercept and change the data going out by writing program A.

Was it helpful?

Solution

You might try renaming /dev/ttyS0 (or whatever COM port number), and create a new /dev/ttyS0 that's a pipe to your program. Then your program will open the renamed /dev/ttyS0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top