|
Home > Archive > Unix Programming > January 2004 > Linux to emulate/act as a printer.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Linux to emulate/act as a printer.
|
|
| Peteris Krumins 2004-01-23, 5:33 pm |
| Hello,
I have a device which outputs data to a printer.
I have to collect these data and do smth with them.
Today (working already 15+hours), i read a lot about parallel
port and how data is transmitted/received, so i wired
my own cable:
data to data,
pin 1 (at pc) to pin 11 (at device), so i could write not busy
pin 10 (at pc) to pin 1 (at device), so i could read strobe
pin 16 (at pc) to pin 10 (at device), so i could write ack
pin 17 (at pc) to pins 12 and 15 (at device), so i could write
not out of paper and not error (tell that nothing is wrong with
printer)
ground to ground,
other cables not used.
My idea is to control the status registers, so i (linux box) could
act as a real printer, for example if i saw 'strobe low' (reading
status ack (pin 10 at pc which is connected to device's pin 1),
i'd know device is sending a byte, i would acknowledge that
(by writing to pin 16) and continue reading byte by byte.
Unfortunately something is wrong. I have tested the wiring -
it is ok. I know about hardware invertion in parallel port, so
i high and low pins correctly.
The device just holds 'strobe' high, data bit 2 high and data bit 4
high. As i understand the device waits me (printer) to low busy,
and do the same to error and out of paper. I have done it but the
device never changes those strobe, bit2 and bit4.
If i connect the device to a printer, the printer prints data out
perfectly. I dont have so advanced devices to trap printer and device
to see their conversation..
So something is wrong, i must ask if i have have understood how the
printers work correctly:
1) If there is no paper or is error, those pins are set high.
2) Printer sets busy low, indicating it is ready to accept data
3) Device sets data pins high, putting a byte on the wire, and sets
strobe low.
4) Printer sets busy high, indicating it is processing data
5) Printer reads data pins.
6) Printer sets busy low, sets ack low, waits ~ 5us, highs ack
7) goto 1, procedure continues.
Am i correct?
Also, please, if you know how to do this easier, be so kind and
tell me.
Thanks,
P.Krumins
| |
| Michael B Allen 2004-01-23, 5:33 pm |
| On Thu, 25 Dec 2003 23:18:58 -0500, Peteris Krumins wrote:
quote:
> Hello,
>
> I have a device which outputs data to a printer. I have to collect
> these data and do smth with them.
So Kermit didn't work out for you?
Mike
| |
| Peteris Krumins 2004-01-23, 5:33 pm |
| Michael B Allen <mba2000@ioplex.com> wrote in
news:pan.2003.12.27.03.38.12.982240.13958@ioplex.com:
quote:
> On Thu, 25 Dec 2003 23:18:58 -0500, Peteris Krumins wrote:
>
>
> So Kermit didn't work out for you?
>
No, Kermit did not seem to be designed to interface parallel port.
P.Krumins
| |
| Michael B Allen 2004-01-23, 5:33 pm |
| On Sat, 27 Dec 2003 11:00:16 -0500, Peteris Krumins wrote:
quote:
> Michael B Allen <mba2000@ioplex.com> wrote in
> news:pan.2003.12.27.03.38.12.982240.13958@ioplex.com:
>
> No, Kermit did not seem to be designed to interface parallel port.
That's odd. I did exactly that in college (~1996). I connected the
parallel ports of an old Data General to an OS2 machine and "printed"
the data to the OS2 machine right into Kermit. I believe your "device
which outputs data to a printer" is no different from the Data General
in my case.
Mike
| |
| Peteris Krumins 2004-01-23, 5:33 pm |
| Michael B Allen <mba2000@ioplex.com> wrote in
news:pan.2003.12.27.18.11.04.342633.15868@ioplex.com:
quote:
> On Sat, 27 Dec 2003 11:00:16 -0500, Peteris Krumins wrote:
>
>
> That's odd. I did exactly that in college (~1996). I connected the
> parallel ports of an old Data General to an OS2 machine and "printed"
> the data to the OS2 machine right into Kermit. I believe your "device
> which outputs data to a printer" is no different from the Data General
> in my case.
>
I verified again, kermit does not have an option to communicate with
parallel port.
Maybe those were serial ports you connected the device and a computer to?
P.Krumins
| |
| Michael B Allen 2004-01-23, 5:33 pm |
| User-Agent: Pan/0.11.2 (Unix)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso885915
Content-Transfer-Encoding: 8bit
X-Comment-To: "Peteris Krumins" <pkruminsREMOVETHIS@inbox.lv>
Lines: 16
NNTP-Posting-Host: 207.172.165.167
X-Trace: 1072676454 reader3.news.rcn.net 4743 207.172.165.167:34710
X-Complaints-To: abuse@rcn.com
Xref: intern1.nntp.aus1.giganews.com comp.unix.programmer:142164
On Sun, 28 Dec 2003 16:26:32 -0500, Peteris Krumins wrote:
quote:
> I verified again, kermit does not have an option to communicate with
> parallel port.
> Maybe those were serial ports you connected the device and a computer
> to?
Entirely possible.
How about this then:
http://www.lvr.com/parport.htm
Looks like you want to use inb(2), outb(2), ioperm(2) and so on.
Mike
| |
| cLIeNUX user 2004-01-23, 5:33 pm |
| humbubba@smart.netquote:
>On Sun, 28 Dec 2003 16:26:32 -0500, Peteris Krumins wrote:
>
>
>Entirely possible.
>
>How about this then:
>
> http://www.lvr.com/parport.htm
>
>Looks like you want to use inb(2), outb(2), ioperm(2) and so on.
>
>Mike
If you don't need much from the printer end you could also consider a
stand-alone Forth rather than Linux. I used one to bang on a floppy drive
a bit at a time. Keyword "ENTH".
Rick Hohensee
|
|
|
|
|