Reading output for printer

  • Thread starter Thread starter Peteris Krumins
  • Start date Start date
P

Peteris Krumins

Hello,

I am interested how to read data from a 3rd party device which
has Parallel port output and outputs data for printer.
(that is, if i connect a printer to it, the printer would print
everything the device outputs).

I have to do the same, just read the data in my program.
I have finished the program, hoping, the data would be easly read
(fopen("/dev/lp0","r"), then just select()ing and waiting fd to
unblock) after loading the appropriate, parallel port
(parport, parport_pc) drivers and lp driver but it is not that
easy..

I have tried connecting the device to computers Parallel port,
both with serial and null cabels but unfortunately i was not able
to get anything read.
(I tried reading /dev/lp0, both when lp driver was in polling and
interrupt driven modes)

Could anyone help me how to get it done? What should be done
to read the data coming from a special device which outputs
data via Parallel port for a printer?
Maybe if i connected
DB25 (to the special device) -> DB9 (serial, to pc) it could be done?

(talking about linux, tho if it could be done under BSDs, i'd also
appriciate your suggestion(s))


Thanks,
P.Krumins
 
Hello,

I am interested how to read data from a 3rd party device which
has Parallel port output and outputs data for printer.
(that is, if i connect a printer to it, the printer would print
everything the device outputs).

I have to do the same, just read the data in my program.
I have finished the program, hoping, the data would be easly read
(fopen("/dev/lp0","r"), then just select()ing and waiting fd to
unblock) after loading the appropriate, parallel port
(parport, parport_pc) drivers and lp driver but it is not that
easy..

I have tried connecting the device to computers Parallel port,
both with serial and null cabels but unfortunately i was not able
to get anything read.
(I tried reading /dev/lp0, both when lp driver was in polling and
interrupt driven modes)

Could anyone help me how to get it done? What should be done
to read the data coming from a special device which outputs
data via Parallel port for a printer?
Maybe if i connected
DB25 (to the special device) -> DB9 (serial, to pc) it could be done?

(talking about linux, tho if it could be done under BSDs, i'd also
appriciate your suggestion(s))


Thanks,
P.Krumins


This is not as simple as you are trying to make it. Remember the typical
Parallel port in a pc was originally a write only device. You need to make
sure it is in EPP or probably better, ECP mode, and you need to really look
at what is available on the linus PARAPORT project site. You will need a
device driver that puts the parallel port into a special mode to use it to
read data, and you will probably need to wire a custom cable to get the
right handshaking lines connected to each other. This is not like a serial
port. Forget serial cables. Read what has been done with paraport drivers.

You probably also want to ask this in a Linux programming group, as this
is more a software than hardware problem.

JT
 
This is not as simple as you are trying to make it. Remember the
typical Parallel port in a pc was originally a write only device. You
need to make sure it is in EPP or probably better, ECP mode, and you
need to really look at what is available on the linus PARAPORT project
site. You will need a device driver that puts the parallel port into a
special mode to use it to read data, and you will probably need to
wire a custom cable to get the right handshaking lines connected to
each other. This is not like a serial port. Forget serial cables. Read
what has been done with paraport drivers.

Thanks, i wired a custom cable but i am still not able to get it working.
I can now read the data register, write control register, and acquire
status but i cannot initialize the device.
All it does is send strobe (strobe high +5V), bit2 and bit4.
I tried lowering busy, lowering error and lowering out of paper and
sending ack, but as it was strobe high, bit2 and bit4 high it remained so
and i was not able to do anything.

As soon as i connected the device to printer (with other cable, must be
1to1) it started printing.

I just posted a more detailed post.


P.Krumins
 
Back
Top