织梦CMS - 轻松建站从此开始!

罗索

使用arm驱动hp1020激光打印机

jackyhwei 发布于 2010-11-16 20:22 点击:次 
上次讲到交叉编译ghostscript,今天就来看看如何利用gs等软件,在arm开发板上驱动激光打印机,手头只有usb接口的hp 1020 plus,就锁定这款吧。
TAG:

上次讲到交叉编译ghostscript,今天就来看看如何利用gs等软件,在arm开发板上驱动激光打印机,手头只有usb接口的hp 1020 plus,就锁定这款吧。

1)要想Linux支持usb打印机,需要在内核选项中 <*>   USB Printer support

2)在网络上搜索,hp 1020 plus如果想在linux下使用,需要一个叫foo2zjs的驱动程序(http://foo2zjs.rkkda.com/),能否通过交叉编译,只能祈求god bless咯

(1)解压foo2zjs,查看Makefile,直接添加CC=arm-linux-gcc,编译。
(2)编了一会就停止了报错make: *** 没有规则可以创建“all”需要的目标“printer-profile”。
幸运的是此时foo2zjs的可执行文件已经编译完成并可用了。

3)下面的操作在arm开发板上进行:
(1)插上usb打印机
/ # usb 1-1: new high speed USB device using s1r72v17 and address 2
usb 1-1: Product: HP LaserJet 1020
usb 1-1: Manufacturer: Hewlett-Packard
usb 1-1: SerialNumber: JL3ESMZ
usb 1-1: configuration #1 chosen from 1 choice
drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17

(2)mdev -s生成lp0节点,位于/dev/lp0

(3)使用gs生成pbm文件
./gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=a4 -r300x300 -sDEVICE=pbmraw -sOutputFile=test.pbm test.pdf

(4)调用foo2zjs打印pbm文件
./foo2zjs -z1 -p9 -r600x600 test.pbm > /dev/lp0


可以看看foo2zjs的帮助,修改附带参数

/ # ./foo2zjs -h
Usage:
   foo2zjs [options] <pbmraw-file >zjs-file

        Convert Ghostscript pbmraw format to a monochrome ZJS stream,
        for driving the Minolta/QMS 2300 DL network color laser printer
        and other Zenographics-based black and white printers.

        gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \
                -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw \
                -sOutputFile=- - < testpage.ps \
        | foo2zjs -r1200x600 -g10200x6600 -p1 >testpage.zm

   foo2zjs [options] <bitcmyk-file >zjs-file
   foo2zjs [options] <pksmraw-file >zjs-file

        Convert Ghostscript bitcmyk or pksmraw format to a color ZJS stream,
        for driving the Minolta/QMS 2300 DL network color laser printer
        N.B. Color correction is expected to be performed by ghostscript.

        gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \
            -sPAPERSIZE=letter -g10200x6600 -r1200x600 -sDEVICE=bitcmyk \
            -sOutputFile=- - < testpage.ps \
        | foo2zjs -r1200x600 -g10200x6600 -p1 >testpage.zc

Normal Options:
-c                Force color mode if autodetect doesn't work
-d duplex         Duplex code to send to printer [1]
                    1=off, 2=longedge, 3=shortedge
                    4=manual longedge, 5=manual shortedge
-g <xpix>x<ypix> Set page dimensions in pixels [10200x6600]
-m media          Media code to send to printer [1]
                    1=standard 2=transparency 3=glossy 257=envelope
                    259=letterhead 261=thickstock 262=postcard 263=labels
-p paper          Paper code to send to printer [1]
                    1=letter, 5=legal 7=executive 9=A4 11=A5 13=B5
                    20=env#10, 27=envDL 28=envC5 34=envB5 37=envMonarch
-n copies         Number of copies [1]
-r <xres>x<yres> Set device resolution in pixels/inch [1200x600]
-s source         Source code to send to printer [7]
                    1=upper 2=lower 4=manual 7=auto
                    Code numbers may vary with printer model
-t                Draft mode. Every other pixel is white.
-J filename       Filename string to send to printer []
-U username       Username string to send to printer []

Printer Tweaking Options:
-u <xoff>x<yoff> Set offset of upper left printable in pixels [0x0]
-l <xoff>x<yoff> Set offset of lower right printable in pixels [0x0]
-L mask           Send logical clipping values from -u/-l in ZjStream [3]
                  0=no, 1=Y, 2=X, 3=XY
-A                AllIsBlack: convert C=1,M=1,Y=1 to just K=1
-B                BlackClears: K=1 forces C,M,Y to 0
                  -A, -B work with bitcmyk input only
-P                Do not output START_PLANE codes. May be needed by some
                  some black and white only printers.
-X padlen         Add extra zero padding to the end of BID segments [16]
-z model          Model: 0=2300DL 1=hp1020 [0]

Debugging Options:
-S plane          Output just a single color plane from a color print [all]
                  1=Cyan, 2=Magenta, 3=Yellow, 4=Black
-D lvl            Set Debug level [0]
-V                Version $Id: foo2zjs.c,v 1.84 2009/03/07 21:46:43 rick Exp $

 

打印效果没的说,就是打印大文件速度慢了点,最快的左边那张也要10s

(aokikyon)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201011/10481.html]
本文出处:百度博客 作者:aokikyon
顶一下
(36)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容