0

I would like to use an usb to com adapter to sniff data sent from computer 1 that should arrive to a printer.

I'd connect computer 2 in the place of the printer so I'd have classic com port on computer 1 side and usb port on computer 2 side.

I can program using python (pyserial should be ok to read the data) and bash.

Which kind of tools should I use to turn the sniffed data into human readable text?

Or, maybe, is it simply possible to emulate a printer on computer 2 and turn directly data into text or pdf or anything readable?

2
  • 1
    So Ubuntu hardware related questions are off topic? Is this even an hardware question? Disagreed: see my answer. – Pitto Jun 2 '15 at 17:17
  • Good one! Upvoted! (close vote retracted, dumb comments deleted!) ;-) – Fabby Jun 2 '15 at 17:38
1

I've found a very easy solution to read serial data with Python and PySerial on Ubuntu, here's the script:

# simply change COM9 with /dev/ttyS0 or the COM port you need to use
import serial
ser = serial.Serial("COM9", 9600)

while True:
   line = ser.readline()
   print line

I can read data from the input and now I can build a parser using python-escpos to turn it into readable text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.