[Gambas-user] How to sent a line line to a lp1 printer and form to lp0 printer directly.
Doriano Blengino
doriano.blengino at ...1909...
Wed Sep 23 19:04:04 CEST 2009
Lee McPherson ha scritto:
> One alternative is to use the program parashell
>
> Software: http://parashell.sourceforge.net/
>
> Docs: http://parashell.sourceforge.net/docs/parallel.txt
>
> Apparently, all you need to do is send it byte commands. (and you need
> root access) I bet that would be much easier if it works as advertised.
>
Nice, but don't depict this problem (a printer attached to a computer)
as more difficult than it really is.
It is possible to do an:
echo -e "Hello world\r" >/dev/lp0
or
PRINT #hPrinter, "Hello world"
the kernel driver for parallel port already does everything we need (to
make a normal printer work) - why point out difficult (and useless) things?
And, to better reply to Vassilis about cat and echo:
cat file > /dev/lp0
/bin/cat is a Unix command, which takes the content of a file and send it, in this case, to the first parallel printer. You can open a terminal, and type:
cat /etc/passwd >/dev/lp0
to dump the contents of /etc/passwd to the printer. It will work, not very well though...
echo "test" > /dev/lp0
/bin/echo is another Unix command which sends data somewhere. The data is taken directly from the command line, not a file. In this example... guess where "test" is dumped to?
These two commands will work, at least at a certain degree, if your hardware is OK and your linux kernel correctly manages printer ports. Two modules named "lp" and "parport" should be present and loaded for this. If it is not done automatically, try to
modprobe parport
modprobe lp
(or "su modprobe blah blah blah blah"). If you don't know what cat, echo, modprobe, shell are, then read a good Unix/Linux book.
Regards,
Doriano
More information about the User
mailing list