Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The similar question was asked by davidb, however the circumstances are different.

I have a device with the 9-pin RS-232 port and an ancient printer connected to that device. I need to replace the printer with a Linux PC to capture data (an image) sent by the device. I can eavesdrop the transferred data via snooper tool. This utility can route data between devices connected to different serial ports of a single PC (like snooper /dev/ttyS0 /dev/ttyS1), and log it. However, I'm not sure is it enough just to substitute the printer's tty (say, /dev/ttyS1) with /dev/null, then get the image sent by the device and to lpr or email it.

Being short, I need a virtual serial printer on Linux with the ability to save everything to some gif or whatever.

Thanks in advance.

share|improve this question

migrated from stackoverflow.com Nov 30 '12 at 20:13

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

i guess you could just

cat /dev/ttyS0 > file

and transfer the file to wherever you want. Then

cat file > /dev/ttyS0

to print it on the second machine. of course you will have to setup the serial port first (baudrate/parity...).

Alternatively, use a terminal program like minicom, enable log to file, and then use that file.

Both ways do only work if the device really uses the serial port as it should be used, and not just by bitbanging stuff over the connector.

Just because i am interested: What kind of device is that?

share|improve this answer
    
edit: i just noticed that you want to save a gif. As long as you do not know the data format that your printer uses, you will practically have no chance to convert the "file" to a gif or something. sorry. –  damaltor Nov 30 '12 at 10:14
    
I'm not familiar with the printer protocol, but shouldn't it be dialog between the device and printer? That is may I just cat /dev/ttyS0 > file without answer to the device? –  user1038377 Nov 30 '12 at 10:18
    
The device is an industrial heat meter. –  user1038377 Nov 30 '12 at 10:24
    
Mmmh. This is hard to guess. There MIGHT be a complete protocol, there might bo nothing at all (and the printer is jus a "dumb" listener). you might be able to test this by removing the printer, and checking if the device finds an error while printing (-> there is a protocol) or just pretends that everything went fine (-> there is no protocol). You might be on the right way with snooper, but you will have to decode the information you get from th printer. you might want to start off with printing entirely white/black pages (if this is possible) to try and disassemble the image format. –  damaltor Nov 30 '12 at 11:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.