为公司某芯片开发打印机
上层cups部分
一:应用cups-2.2.10
config.h里
1: +#define DEBUG //添加debug信息,在/var/log/cups/error输出
2: - #define HAVE_POSIX_SPAWN 1 不使用这个宏,使用会导致scheduler/job.c中fork不到进程,导致execve执行不到
3: +#define HAVE_AVAHI, 这样子可用通过backend的driverless发现设备
注意:
1:install的动态库和运行链接时候的动态库位置不同
一个在/usr/lib64下一个在/lib/mips64-linux-gnuabi64下,(la)也有这个问题,每次make install后要手动cp一下,改脚本也行。
2:/etc/cups/cupsd.conf里要增加
Port 631
Listen 0.0.0.0:631
Listen /var/run/cups/cups.sock
Listen /run/cups/cups.sock
发现设备
此时可以通过网页或者命令行发现设备了
添加设备
1:server:
/usr/sbin/lpadmin -p andy -E -v parallel:/dev/null -m raw
名字是 andy 位置是/dev/null,用的是后端parallel。没用filter就是raw
2:client
直接网页配把,把自己的.ppd选上,命令行就-P指定 ppd
ppd文件指定的时候随便放任意位置都行,指定后他会copy一份到/etc/cups/ppd
*PPD-Adobe: "4.3"
*%%%% PPD file for OEP102DN with CUPS.
*%%%% Created by the CUPS PPD Compiler CUPS v1.4.6.
*%
*% Copyright (C) 2014-2019 TOEC Ltd.
*% CUPS printer driver for TOEC printer devices
*%
*% This program is free software; you can redistribute it and/or modify
*% it under the terms of the GNU General Public License as published by
*% the Free Software Foundation; either version 2 of the License, or
*% (at your option) any later version.
*%
*% This program is distributed in the hope that it will be useful,
*% but WITHOUT ANY WARRANTY; without even the implied warranty of
*% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*% GNU General Public License for more details.
*%
*% You should have received a copy of the GNU General Public License
*% along with this program; if not, write to the Free Software
*% Foundation, TOEC Ltd., No.4 MeiJiangDao, Hexi, TianJin, China
*%
*FormatVersion: "4.3"
*FileVersion: "1.0"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "OEP102DN.ppd"
*Product: "(OEP102DN)"
*Manufacturer: "TOEC"
*ModelName: "TOEC_OEP102DN"
*ShortNickName: "OEP102DN"
*NickName: "OEP102DN, 1.0"
*PSVersion: "(3010.000) 0"
*LanguageLevel: "3"
*ColorDevice: True
*DefaultColorSpace: RGB
*FileSystem: False
*Throughput: "18"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
*% Driver-defined attributes...
*cupsVersion: 1.4
*cupsModelNumber: 0
*cupsManualCopies: True
*cupsFilter: "image/x-portable-ls-jbg 200 ls_jbgtotar"
*cupsLanguages: "en"
*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: A4
*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageSize B5/B5: "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageSize C16K/C16K: "<</PageSize[553 765]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion/PageRegion: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: A4
*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageRegion B5/B5: "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageRegion C16K/C16K: "<</PageSize[553 765]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: A4
*ImageableArea A4/A4: "0 0 595 842"
*ImageableArea B5/B5: "0 0 516 729"
*ImageableArea C16K/C16K: "0 0 553 765"
*DefaultPaperDimension: A4
*PaperDimension A4/A4: "595 842"
*PaperDimension B5/B5: "516 729"
*PaperDimension C16K/C16K: "553 765"
*OpenUI *Resolution/Resolution: PickOne
*OrderDependency: 0 AnySetup *Resolution
*DefaultResolution: 300dpi
*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]/cupsBitsPerColor 8/cupsRowCount 0/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]/cupsBitsPerColor 8/cupsRowCount 0/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*%Resolution 1200*600dpi/1200*600 DPI: "<</HWResolution[600 600]/cupsBitsPerColor 8/cupsRowCount 0/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*%Resolution 1200dpi/1200 DPI: "<</HWResolution[1200 1200]/cupsBitsPerColor 8/cupsRowCount 0/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*CloseUI: *Resolution
*OpenUI *Duplex/Duplex : PickOne
*OrderDependency: 0 AnySetup *Duplex
*DefaultDuplex: None
*Duplex None/None: "<</Duplex false /Tumble false>>setpagedevice"
*Duplex DuplexTumble/DuplexTumble: "<</Duplex true /Tumble true>>setpagedevice"
*Duplex DuplexNoTumble/DuplexNoTumble: "<</Duplex true /Tumble false>>setpagedevice"
*CloseUI: *Duplex
*OpenUI *ColorMode/Color Mode : PickOne
*OrderDependency: 0 AnySetup *ColorMode
*DefaultColorMode: Color
*ColorMode Mono/Black and White: "<< >>setpagedevice"
*ColorMode Color/Black and Red: "<< >>setpagedevice"
*ColorMode Green/Black and Green: "<< >>setpagedevice"
*CloseUI: *ColorMode
*OpenUI *ShrinkMode/Shrink Mode : PickOne
*OrderDependency: 0 AnySetup *ShrinkMode
*DefaultShrinkMode: shrink1
*ShrinkMode shrink1/100%: "<< >>setpagedevice"
*ShrinkMode shrink2/90%: "<< >>setpagedevice"
*ShrinkMode shrink3/80%: "<< >>setpagedevice"
*ShrinkMode shrink4/70%: "<< >>setpagedevice"
*ShrinkMode shrink5/60%: "<< >>setpagedevice"
*ShrinkMode shrink6/50%: "<< >>setpagedevice"
*ShrinkMode shrink7/40%: "<< >>setpagedevice"
*ShrinkMode shrink8/30%: "<< >>setpagedevice"
*ShrinkMode shrink9/20%: "<< >>setpagedevice"
*CloseUI: *ShrinkMode
*OpenUI *ImageDarkness/Color Image Darkness: PickOne
*OrderDependency: 0 AnySetup *ImageDarkness
*DefaultImageDarkness: darkness6
*ImageDarkness darkness1/0.5: "<< >>setpagedevice"
*ImageDarkness darkness2/0.6: "<< >>setpagedevice"
*ImageDarkness darkness3/0.7: "<< >>setpagedevice"
*ImageDarkness darkness4/0.8: "<< >>setpagedevice"
*ImageDarkness darkness5/0.9: "<< >>setpagedevice"
*ImageDarkness darkness6/1.0: "<< >>setpagedevice"
*ImageDarkness darkness7/1.1: "<< >>setpagedevice"
*ImageDarkness darkness8/1.2: "<< >>setpagedevice"
*ImageDarkness darkness9/1.3: "<< >>setpagedevice"
*ImageDarkness darkness10/1.4: "<< >>setpagedevice"
*ImageDarkness darkness11/1.5: "<< >>setpagedevice"
*ImageDarkness darkness12/1.6: "<< >>setpagedevice"
*ImageDarkness darkness13/1.7: "<< >>setpagedevice"
*ImageDarkness darkness14/1.8: "<< >>setpagedevice"
*ImageDarkness darkness15/1.9: "<< >>setpagedevice"
*ImageDarkness darkness16/2.0: "<< >>setpagedevice"
*CloseUI: *ImageDarkness
*OpenUI *cupsDarkness/Mono Image Darkness: PickOne
*OrderDependency: 0 AnySetup *cupsDarkness
*DefaultcupsDarkness: Normal
*cupsDarkness Light/Light: "<</cupsCompression 0>>setpagedevice"
*cupsDarkness Normal/Normal: "<</cupsCompression 1>>setpagedevice"
*cupsDarkness Dark/Dark: "<</cupsCompression 2>>setpagedevice"
*CloseUI: *cupsDarkness
*OpenGroup: InstallableOptions/Installable Options
*OpenUI *WatermarkOptions/Watermark Options: PickOne
*OrderDependency: 0 AnySetup *WatermarkOptions
*DefaultWatermarkOptions: None
*WatermarkOptions None/None: "<< >>setpagedevice"
*WatermarkOptions OptCas1/Watermark: "<< >>setpagedevice"
*CloseUI: *WatermarkOptions
*%OpenUI *SupportFingerOptions/Support Finger Options: Boolean
*%OrderDependency: 0 AnySetup *SupportFingerOptions
*%DefaultSupportFingerOptions: True
*%SupportFingerOptions True/ON: "<<>>setpagedevice"
*%SupportFingerOptions False/OFF: "<<>>setpagedevice"
*%CloseUI: *SupportFingerOptions
*CloseGroup: InstallableOptions
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(1.05)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(1.05)" Standard ROM
*Font AvantGarde-Demi: Standard "(1.05)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(1.05)" Standard ROM
*Font Bookman-Demi: Standard "(1.05)" Standard ROM
*Font Bookman-DemiItalic: Standard "(1.05)" Standard ROM
*Font Bookman-Light: Standard "(1.05)" Standard ROM
*Font Bookman-LightItalic: Standard "(1.05)" Standard ROM
*Font Courier: Standard "(1.05)" Standard ROM
*Font Courier-Bold: Standard "(1.05)" Standard ROM
*Font Courier-BoldOblique: Standard "(1.05)" Standard ROM
*Font Courier-Oblique: Standard "(1.05)" Standard ROM
*Font Helvetica: Standard "(1.05)" Standard ROM
*Font Helvetica-Bold: Standard "(1.05)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Oblique: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(1.05)" Standard ROM
*Font Palatino-Bold: Standard "(1.05)" Standard ROM
*Font Palatino-BoldItalic: Standard "(1.05)" Standard ROM
*Font Palatino-Italic: Standard "(1.05)" Standard ROM
*Font Palatino-Roman: Standard "(1.05)" Standard ROM
*Font Symbol: Special "(001.005)" Special ROM
*Font Times-Bold: Standard "(1.05)" Standard ROM
*Font Times-BoldItalic: Standard "(1.05)" Standard ROM
*Font Times-Italic: Standard "(1.05)" Standard ROM
*Font Times-Roman: Standard "(1.05)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(1.05)" Standard ROM
*Font ZapfDingbats: Special "(001.005)" Special ROM
*zh_CN.Translation General/常规: ""
*zh_CN.Translation InstallableOptions/附加选项: ""
*zh_CN.Translation PageSize/纸张尺寸: ""
*zh_CN.Translation PageRegion/纸张范围: ""
*zh_CN.Translation Resolution/分辨率: ""
*zh_CN.Translation ColorMode/颜色模式: ""
*zh_CN.ColorMode Mono/黑白模式: ""
*zh_CN.ColorMode Color/红黑模式(需要安装红色硒鼓): ""
*zh_CN.ColorMode Green/绿黑模式(需要安装绿色硒鼓): ""
*zh_CN.Translation ImageDarkness/红黑模式图像色深: ""
*zh_CN.Translation ShrinkMode/图像调整: ""
*zh_CN.Translation Duplex/手动双面: ""
*zh_CN.Duplex None/关闭: ""
*zh_CN.Duplex DuplexTumble/短边翻转: ""
*zh_CN.Duplex DuplexNoTumble/长边翻转: ""
*zh_CN.Translation cupsDarkness/黑白模式图像深度: ""
*zh_CN.cupsDarkness Light/较浅: ""
*zh_CN.cupsDarkness Normal/正常: ""
*zh_CN.cupsDarkness Dark/较深: ""
*zh_CN.Translation WatermarkOptions/水印模式: ""
*zh_CN.WatermarkOptions None/无水印: ""
*zh_CN.WatermarkOptions OptCas1/添加水印: ""
*% End of OEP102D.ppd, 06461 bytes.
3:添加mime
在/usr/share/cups/mime下添加
xxxx.convs
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
# VERSIONS OF CUPS. Instead, create a "local.convs" file that
# reflects your local configuration changes.
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
# file is missing or damaged, see the license at "http://www.cups.org/".
#
########################################################################
########################################################################
#jbig filter 2012-8-20 flp
#2012-10-9
#application/vnd.cups-postscript image/x-portable-bitmap 60 pstopbm
#image/x-portable-bitmap image/x-portable-jbig 60 pbmtojbig
#image/x-portable-jbig application/x-toecopl 100 jbigtoopl
#2014-10-10
#application/vnd.cups-postscript image/x-portable-pixmap 10 pstoppm
#image/x-portable-pixmap image/x-bitmap 10 ppmtobmp
#image/x-bitmap image/x-portable-jbig 10 bmptojbig
#image/x-portable-jbig application/x-toecopl 100 jbigtoopl
#andy
application/pdf image/x-portable-ls-pbm 200 ls_pdftopbm
image/x-portable-ls-pbm image/x-portable-ls-jbg 200 ls_pbmtojbg
image/x-portable-ls-jbg image/x-portable-ls-tar 200 ls_jbgtotar
application/pdf application/vnd.cups-pdf 66 pdftopdf
#end of andy
# End of "$Id: toec.convs 2014-10-10 15:46 flp $".
#
xxxx.type
# MIME types file for the Common UNIX Printing System (CUPS).
#
# DO NOT EDIT THIS FILE, AS IT IS OVERWRITTEN WHEN YOU INSTALL NEW
# VERSIONS OF CUPS. Instead, create a "local.types" file that
# reflects your local configuration changes.
#
# Copyright 2007-2009 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
# file is missing or damaged, see the license at "http://www.cups.org/".
#
########################################################################
#
# Format of Lines:
#
# super/type rules
#
##########################################
image/x-portable-ls-pbm ls_pdftopbm
image/x-portable-ls-jbg ls_pbmtojbg
image/x-portable-ls-tar ls_jbgtotar
#########################################
#
# End of "$Id: toec.types 2014-10-10 flp $".
#
~
~
这两个文件供给cups用,做mime的datebase。
有了以上的mime和ppd文件
接下来就是写filter:
pdf->pbm->jbg85->tar->parallel->控制器
代码不开源哈哈
驱动:
还在开发中
调试:
lpc status 可以先看下
cupsenable
cupsaccecpt去设置状态