Android遇上印表機

來源:互聯網
上載者:User

印表機其實和Android沒有什麼大的關係,和linux核心關聯才是比較強的。最近調試印表機,有那麼一點心得,一點一點記錄下來。

最終的結果是要在Android實現驅動印表機,但是一般調試一個新的驅動的流程是這樣的:1.先在linux PC上進行測試。2.在標準嵌入式linux上進行調試。3.改裝到Android中去

為什麼這麼安排,是有說道的。因為資源是遞減的,可以在第一階段確定裝置有無問題,以及該裝置在linux工作流程;在第二階段是因為標準的嵌入式linux還是遵循GNU規定的,包括大部分,這個階段驗證該裝置能否在ARM架構的上順利編譯通過;第三階段就是實用階段了,因為最終要在這個不是怎麼遵守規定的Android系統上啟動並執行。

Canon iP2780 2.Canon MX428 3.HP Deskjet 1000。由於的我作業系統就是Linux,在Linux PC上很快就逐個搞定。第1台用的是這裡的驅動(包括deb包和部分開源源碼)加上這個

如何用命令列印一個檔案?這個問題似乎很奇怪,但是我也不知道如何做。不過最終找到了就是:lp或者lpr加檔案名稱,就可以列印出一個檔案了。例如:

lp ~/hello.pdf

找這麼一個命令我就花費了幾個小時的時間,這裡我就有一種很強的預感,前邊的路很還很遙遠。(整理文章的順序和實驗的步驟會稍有不同,其實這個命令在)。

現在看來我不應該草率進行去進行第二個階段,應該好好的研究一下Linux的列印系統。總結文章就按照最好的流程來吧。先說我是怎麼瞭解了linux的列印系統的。

意外發現的這個本書《Linux系統管理技術手冊此內容不在本書要討論的範圍內”一句概括。那一章我反覆看了一周時間才算有些眉目。

一切終歸一張圖:


第二階段

+cnijfilter-source-3.30-1.tar.gz.


     2.交叉

#!/bin/sh# 1.下載源碼wget http://www.cups.org/software/1.3.9/cups-1.3.9-source.tar.gz &&# 2.解壓並開啟tar xvzf cups-1.3.9-source.tar.gz && cd cups-1.3.9 &&# 3.配置./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar  --disable-gnutls --disable-gssapi --disable-dbus --prefix=/ &&# 4.修改Makefile使其不編譯mansed -i '22s/locale man monitor/locale monitor/' ./Makefile  &&# 5.編譯並安裝make && make install DSTROOT=/work/rootfs/rootfs_qtopia_qt4 &&echo "cups build install ok!"


ghostscript 

#!/bin/sh# 1.下載源碼wget http://iweb.dl.sourceforge.net/project/ghostscript/GPL%20Ghostscript/8.15/ghostscript-8.15.tar.gz &&# 2.解壓源碼tar xvzf ghostscript-8.15.tar.gz  &&# 3.分別拷貝為PC版本和ARM版本cp ghostscript-8.15 ghostscript-8.15-arm -r && mv ghostscript-8.15 ghostscript-8.15-pc  &&# 4.編譯PC版本cd ghostscript-8.15-pc && ./configure && make && cd ../ &&# 5.配置arm版本cd ghostscript-8.15-arm && ./configure --host=arm-linux &&# 6.修改Makefile中STDLIBS=-lm 為STDLIBS=-lm -staticsed -i '257s/STDLIBS=-lm/STDLIBS=-lm -static/' ./Makefile &&# 7.拷貝PC版本工具mkdir obj && cp ../ghostscript-8.15-pc/obj/genarch ../ghostscript-8.15-pc/obj/genconf ../ghostscript-8.15-pc/obj/echogs  ./obj/  &&# 8.編譯make &&# 9.安裝(這個版本不支援make install的DESTDIR指定根目錄所以要手動拷貝,以後要調整目錄)DESTDIR=/work/rootfs/rootfs_qtopia_qt4mkdir -p          ${DESTDIR}/usr/local/share/ghostscript/8.15/  &&cp    -r lib      ${DESTDIR}/usr/local/share/ghostscript/8.15/  &&cp    -r Resource ${DESTDIR}/usr/local/share/ghostscript/8.15/  &&cp       bin/gs   ${DESTDIR}/bin/



3.交叉編譯kerberos 5.1.9
#!/bin/sh# 1.下載源碼 項目地址:http://web.mit.edu/~kerberos/dist/historic.htmlwget http://web.mit.edu/~kerberos/dist/krb5/1.9/krb5-1.9-signed.tar &&# 2.解壓tar xvf krb5-1.9-signed.tar && tar xvzf krb5-1.9.tar.gz  &&# 3.進入源碼目錄cd krb5-1.9/src && # 4.配置./configure CC=arm-linux-gcc --host=arm-linux || echo krb5_cv_attr_constructor_destructor=yes>linux-cache &&./configure CC=arm-linux-gcc --host=arm-linux || echo krb5_cv_attr_constructor_destructor=yes>linux-cache && ./configure CC=arm-linux-gcc --host=arm-linux --cache-file=linux-cache ||echo ac_cv_func_regcomp=yes>>linux-cache &&./configure CC=arm-linux-gcc --host=arm-linux --cache-file=linux-cache ||echo ac_cv_printf_positional=yes>>linux-cache &&./configure CC=arm-linux-gcc --host=arm-linux --cache-file=linux-cache &&# 3.注釋一行代碼 Fix:Don't know how to do unload-time finalization for this configuration.sed -i '397s/^/\/\//g' ./include/k5-platform.h &&# 7.編譯並安裝make && make install DSTROOT=/work/rootfs/rootfs_qtopia_qt4 &&echo "krb5 build install ok!"


4.gutenprint 5.2.9

#!/bin/sh# 1.下載源碼 項目地址:http://sourceforge.net/projects/gimp-print/files/gutenprint-5.2/5.2.9/wget http://softlayer-ams.dl.sourceforge.net/project/gimp-print/gutenprint-5.2/5.2.9/gutenprint-5.2.9.tar.bz2 &&# 2.解壓tar xvjf gutenprint-5.2.9.tar.bz2  &&# 3.分別拷貝為PC版本和ARM版本 cp -r gutenprint-5.2.9 gutenprint-5.2.9-arm && mv gutenprint-5.2.9 gutenprint-5.2.9-pc &&# 4.編譯PC版本cd gutenprint-5.2.9-pc && ./configure && make && cd ../ &&# 5.配置arm版本  cd gutenprint-5.2.9-arm && ./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar --with-gimp2=no --without-gimp2 --enable-cups-ppds  --enable-cups-level3-ppds --without-ghostscript --without-foomatic --disable-libgutenprintui2 &&# 6.拷貝PC版本工具  make || cp ../gutenprint-5.2.9-pc/src/xml/.libs/extract-strings ./src/xml/.libs/ &&# 7.編譯並安裝make && make install DSTROOT=/work/rootfs/rootfs_qtopia_qt4 &&echo "gutenprint build install ok!"


#!/bin/sh# 1.下載源碼 項目地址:http://sourceforge.net/projects/hpinkjet/files/wget http://superb-dca2.dl.sourceforge.net/project/hpinkjet/hpijs/2.1.4/hpijs-2.1.4.tar.gz# 2.解壓源碼tar xvzf hpijs-2.1.4.tar.gz && cd hpijs-2.1.4# 3.配置./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar# 4.修正語法錯誤 dj3320.cpp第403行和registry.cpp第249行 開頭的char改為const charsed -i '249s/\tchar\t/\tconst char\t/' registry.cppsed -i '403s/  char/  const char/' dj3320.cpp# 5.編譯並安裝make && make install DESTDIR=/work/rootfs/rootfs_qtopia_qt4


/etc/init.d/cups start

debug,這樣如果啟動失敗會將原因列印到/var/log/cups/error_log中。我沒有遇到什麼大的bug,遇到的都是缺少目錄問題。



第三階段

預留


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.