reading data from raw printer

Moritz von Schweinitz schweini at hostelo.com
Thu Jul 5 04:18:31 PDT 2007


Johannes & Tim,
Sorry about the delayed reply - I foolishly assumed that the forum software would email me if somebody replied to my question...

My 'plan' was to somehow send the ESC/POS command to the printer using lpr, and maybe read a command code (in the best case from lpr's STDOUT), or maybe call lpstat with some obscure option that would simply pass the given command on to the printer, and return the printer's reply, without having to start to program a whole backend for this. In this ideal world of mine, the POS software would have polled the printer via cups until it gets the desired answer, and then unblock, but i guess that's going to be a bit too complicated for now. I really liked your idea of handling the 'drawer status logic' in the backend, although i would very much have preferred to keep all logic in the same place (the POS software). Another solution might be to write a little serial-port-monitor-daemon-thing (which is of course trivial in Perl) and somehow let that daemon monitor the cash drawer's state, but i fear that CUPS wont let me access the serial port when it is using it. Is there any way to accomplish that (i.e. using a serial port with CUPS and some other program at the same time)?

Thanks again for you answers,

M.


>
> Hello,
>
> On Jun 29 14:56 Moritz von Schweinitz wrote (shortened):
> > I'm using cups (with a lot of success) to drive a lot of point-of-sale
> > printers (Epson TMU-200) using the raw-text mode. I open the attached
> > cash-drawers sending binary commands to the printer.
> > I was asked whether i can implement the option that the point-of-sale
> > software 'blocks' for as long as the cash-drawer is open.
> > These cash-drawers are usually connected to printers, and when sending
> > a special command to the printer, the printer sends back a status code
> > that indicates whether the cash-drawer is open or closed, and this is
> > relatvely easy to implement when talking directly to the serial port.
> > But i'd like to do this over cups. Is this possible?
> > Something ins the spirit of:
> > $open = `echo $send_status_command | cups -P tmu200`
> > ?
> >
> > How can i read information from a printer?
>
> It is the CUPS backend which talks directly to the printer, see
> the CUPS documentation and "man backend" and
> http://en.opensuse.org/SDB:CUPS_in_a_Nutshell
>
> Therefore it is the backend which can read information from a printer.
>
> To do special stuff you would have to write your own backend.
> E.g. don't use the generic "serial" backend but use your own
> special "myserial" backend which does exactly what you like.
>
> But I don't understand how the CUPS backend (which runs usually
> under the user "lp") should communicate with the point-of-sale
> software (which runs under whatever user) and how the backend
> should let the point-of-sale software "block".
>
> As far as I see, all what the backend could do is not to finish
> as long as the cash-drawer is open (i.e. after the print data
> has been sent to the printer, the backend could query the printer
> in a loop until the cash-drawer is closed) and what the point-of-sale
> software could do is to query the print job status and "block" as
> long as the print job is not finished (i.e. as long as the backend
> didn't finish).
>
>
> Kind Regards
> Johannes Meixner
> --
> SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
> AG Nuernberg, HRB 16746, GF: Markus Rex
>





More information about the cups mailing list