|
List Info
Thread: Support for USB Printer - Is it really that complicated?
|
|
| Support for USB Printer - Is it really
that complicated? |
  United States |
2007-09-26 09:00:39 |
|
Hi all,
I'm using a TS-7200 board for embedded control of a machine that uses
stepper motors, LCD display, serial comm, digital I/O, and a USB Flash
Drive. I've learned enough about Linux to get my (fairly large)
application working and installed on 10 new machines that are ready to
be shipped to our customers. All I need to finish the project is to
be able to send simple ASCII text from my program to a USB printer (HP
D1420).
I've searched the web and it seems that I must do a number of things
to make this happen but I'm still not clear on which of these steps
are necessary:
Install HPIJS printer driver. I can find out how to do this under
Debian but how can I do this under TS-Linux with 8MB of on-board flash?
Do I have to rebuild the kernel to include printer support? I have not
had to modify my kernel at this point so I'm not really set up to do
that. I've done all my app. building and debugging straight from the
CF card that TS provides in the dev. kit. If kernel modification is
required we may have to contract someone to do it because we're under
the gun time-wise.
Do I have to convert text files to PostScript, have a .ppd file
present, and use foomatic-rip, etc. just to print simple ASCII text.
That seems like such a convoluted process. I was assuming (and
naively hoping) that I'd be able to just do something like the
following in my application program:
fd = open("/dev/some_printer_driver", "w");
write(fd, "ascii textn");
This is a single-user system with no network support. On power-up it
runs my app. and does nothing else. No spooling is necessary. My
app. can wait until a file is done printing if necessary. I've been
able to implement USB flash drive support successfully.
Could someone please point me in the right direction? Is this going
to be as complicated as it seems? Any tips at all will be greatly
appreciated.
Thanks.
Ed K.
__._,_.___
.
__,_._,___
|
| Re: Support for USB Printer - Is it
really that complicated? |
  United States |
2007-09-26 10:31:45 |
|
--- In ts-7000%40yahoogroups.com">ts-7000 yahoogroups.com, "Ed" <edkbaugh ...> wrote:
>
> Hi all,
>
> I'm using a TS-7200 board for embedded control of a machine that uses
> stepper motors, LCD display, serial comm, digital I/O, and a USB Flash
> Drive. I've learned enough about Linux to get my (fairly large)
> application working and installed on 10 new machines that are ready to
> be shipped to our customers. All I need to finish the project is to
> be able to send simple ASCII text from my program to a USB printer (HP
> D1420).
Based on the price, I'd guess it's a win-printer.
Basically, the printer is noting but a head transport servo and a
printhead. It has no on-board intelligence.
The driver must render whatever you want to print into individual ink
squirts, and then send them to the printer. You can't send ascii as
the printer has no built-in fonts or even any way to move the
printhead by itself.
So you need to get your ascii, convert to postscript, hand it to
ghostscript/HPIJS/whatever that will then create the ink-squirt
instructions and send them to the printer.
Are you absolutely married to that printer? The simplest thing would
be to buy a line printer and then you could send straight ASCII.
You can buy Panasonic and Okidata line printers for < $200....
--Yan
__._,_.___
|
| Re: Support for USB Printer - Is it
really that complicated? |
  United States |
2007-09-26 11:34:09 |
|
Ed wrote:
> All I need to finish the project is to
> be able to send simple ASCII text from my program to a USB printer (HP
> D1420).
[snip]
> Install HPIJS printer driver. I can find out how to do this under
> Debian but how can I do this under TS-Linux with 8MB of on-board flash?
[snip]
> Do I have to rebuild the kernel to include printer support?
You will need the printer.o kernel module. On the TS-7250 board I use it was
not included. I cross-compiled the kernel used on the board so I could get the
needed module and copied only the module back to the board.
If you can cross-compile programs for the board it isn't that difficult to
rebuild the kernel with the missing module. If your board uses the 2.4.26-ts11
Linux kernel I could send you the printer.o module.
> Do I have to convert text files to PostScript, have a .ppd file
> present, and use foomatic-rip, etc. just to print simple ASCII text.
You might not need *all* of it but a lot of it. Unless you dig up a dot-matrix
printer I think you will find that just about any printer available today will
need you to do more than fire ASCII text at it in order to get a printed page.
If you only have 8MB of Flash, you may be hard pressed to squeeze in all of
the needed printing support items.
To make the application I am working on print to a USB printer, I went the
Ghostscript route. Ghostscript forms an integral part of your standard Linux
printing sub-system. It has the drivers for a lot of printers built-in. You
can use it to get output from a printer without needing a lot of other stuff
if you don't other printing support such as spooling.
My application generates Postscript code which is passed to Ghostscript.
Ghostscript then processes the Postscript file and sends the appropriate
information straight to the printer. I told the client which printers they
could use based on which ones were available and compatible with drivers in
Ghostscript.
BTW, I am using the new version of Ghostscript which is a recent merge of two
main Ghostscript implementations. The result being the printer drivers from
each implementation can now be found in one package.
To keep things flexible and easier for the client to make minor changes to the
app in the future I built Ghostscript with all drivers included. The gs binary
and one font file weigh in at just over 8Meg. I could make the gs binary
smaller by excluding drivers for printers I not likely to see (such as all the
dot-matrix printers).
You also need to factor in large memory requirements. On a TS-7250 with 32M
each of Flash and SRAM, it is just about enough SRAM to print an 8.5x11 page
at 300x300 dpi, in black and white only. Peak memory usage during printing
leaves about 6M to 8M of the 32M free. The gs application uses about 8M of RAM
about 10M of RAM when processing the Postscript file to be sent to the
printer. If you want to print at higher resolutions, or with colour, you would
need to increase memory requirements accordingly.
The last part of the printing process was the implementation of a state
machine in my application to deal with printing. It tracks the printer state
and the state of the printing process. It handles the printer being turned on
and off, whether the printing process appears to have stalled (ie. out of
ink/toner, or paper), and also provides a way for a page to be reprinted. In
theory I could even support a simple form of spooling by using a linked list
of file names that are to be printed.
Your other choice to keep things to a minimum is to generate Postscript and
send it to a Postscript printer. You could also look at sending the file to
print to another machine. It all depends on your situation, and what you can
handle in terms of costs.
--
Cheers!
Kevin.
http://www.ve3syb.ca/ |"What are we going to do today, Borg?"
Owner of Elecraft K2 #2172 |"Same thing we always do, Pinkutus:
| Try to assimilate the world!"
#include <disclaimer/favourite> | -Pinkutus & the Borg
__._,_.___
.
__,_._,___
|
| RE: Support for USB Printer - Is it
really that complicated? |
  United States |
2007-09-26 12:03:31 |
|
>You might not need *all* of it but a lot of it. Unless you dig up a
dot-matrix
>printer I think you will find that just about any printer available today
will
>need you to do more than fire ASCII text at it in order to get a printed
page.
Not necessarily, depends on application. Seiko, Star and Epson (among
others) make several POS receipt printers that can handle ASCII text, and
some models even have features where you can preload graphic images like
logos and such that can be printed by sending an ASCII command. Some of them
have really good resolution.
You are, however, moving away from mainstream consumer and business printers
and into the realm of specialty products, which can be a bit pricier.
__._,_.___
.
__,_._,___
|
[1-4]
|
|