问过问题:Linux串口打印驱动程序

expter 2009-05-19 10:58:44
关于这个问题
我是这样想的
1.分析Linux串口通信
2.打算分析PostScript打印程序
3.如果进行打印实现。


与这个题目有关系没。。。
各位朋友,你们有关于Linux下串口打印驱动程序的麽?
给点资料。。谢谢啊

...全文
349 点赞 收藏 17
写回复
17 条回复
steelduan 2010年06月02日
谢谢,学习了
顺便问一声,有谁开发过在linux下EPSON TM U220B票据打印机的驱动
回复 点赞
xhy_851221 2009年05月23日
参考源码中的串口驱动
回复 点赞
expter 2009年05月19日
[Quote=引用 5 楼 morris88 的回复:]
引用 3 楼 expter 的回复:
PostScript打印程序 是不是linux下串口打印驱动一个特例


gs 打印程序从严格意义上讲不属于驱动程序,它是一个应用程序
[/Quote]

我问的PostScript打印程序 是不是linux下串口打印驱动一个特例 哦

回复 点赞
snowflakess 2009年05月19日
Ubuntu 怎么样? 我怎么没有听过呢?
是不是很烂?
回复 点赞
morris88 2009年05月19日
[Quote=引用 3 楼 expter 的回复:]
PostScript打印程序 是不是linux下串口打印驱动一个特例
[/Quote]

gs 打印程序从严格意义上讲不属于驱动程序,它是一个应用程序
回复 点赞
morris88 2009年05月19日
[Quote=引用 2 楼 expter 的回复:]
我的是Ubuntu...也支持不?
[/Quote]

应该是支持的,你可以用命令 gs -h 来确定,
如果没有,可以安装嘛
回复 点赞
expter 2009年05月19日
PostScript打印程序 是不是linux下串口打印驱动一个特例
回复 点赞
expter 2009年05月19日
我的是Ubuntu...也支持不?
回复 点赞
morris88 2009年05月19日
串口打印机肯定需要串口驱动程序的,Postscript 一般实现在应用层,如
fedora 10 自带的 gs 就可以打印 Postscript 和 pdf,如何实现你可以
参考 gs 程序。下面是 gs 目前支持的打印设备:


[root@test1 tmp]# gs -h
GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11alpha
Available devices:
alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cairo ccr cdeskjet cdj1600
cdj500 cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cfax
cgm24 cgm8 cgmmono chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl
cp50 cups declj250 deskjet devicen dfaxhigh dfaxlow display dj505j
djet500 djet500c dl2100 dnj650c epl2050 epl2050p epl2120 epl2500 epl2750
epl5800 epl5900 epl6100 epl6200 eps9high eps9mid epson epsonc epswrite
escp escpage faxg3 faxg32d faxg4 fmlbp fmpr fs600 gdi hl1240 hl1250 hl7x0
hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510
hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c
hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus hpdjportable ibmpro
ijs imagen imdi inferno iwhi iwlo iwlq jetp3852 jj100 jpeg jpegcmyk
jpeggray la50 la70 la75 la75plus laserjet lbp310 lbp320 lbp8 lex2050
lex3200 lex5700 lex7000 lips2p lips3 lips4 lips4v lj250 lj3100sw lj4dith
lj4dithp lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d ljet4pjl
ljetplus ln03 lp1800 lp1900 lp2000 lp2200 lp2400 lp2500 lp2563 lp3000c
lp7500 lp7700 lp7900 lp8000 lp8000c lp8100 lp8200c lp8300c lp8300f
lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c lp8900 lp9000b lp9000c
lp9100 lp9200b lp9200c lp9300 lp9400 lp9500c lp9600 lp9600s lp9800c
lps4500 lps6500 lq850 lx5000 lxm3200 lxm5700m m8510 mag16 mag256 md1xMono
md2k md50Eco md50Mono md5k mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono
miff24 mj500c mj6000c mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050
oki182 oki4w okiibm omni oprp opvp paintjet pam pbm pbmraw pcl3 pcx16
pcx24b pcx256 pcx256 pcx2up pcxcmyk pcxgray pcxmono pdfwrite pdfwrite pgm
pgmraw pgnm pgnmraw photoex picty180 pj pjetxl pjxl pjxl300 pkm pkmraw
pksm pksmraw plan9bm png16 png16 png16m png16m png256 png256 png48
pngalpha pngalpha pnggray pnggray pngmono pngmono pnm pnmraw ppm ppmraw
pr1000 pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb psgray psmono psrgb
pswrite pxlcolor pxlmono r4081 rinkj rpdl samsunggdi sgirgb sj48 spotcmyk
st800 stcolor sunhmono svg t4693d2 t4693d4 t4693d8 tek4696 tiff12nc
tiff24nc tiff32nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw
tiffpack tiffsep uniprint wtscmyk wtsimdi x11 x11alpha x11cmyk x11cmyk2
x11cmyk4 x11cmyk8 x11gray2 x11gray4 x11mono xcf xes
Search path:
. : /usr/share/ghostscript/8.63/lib :
/usr/share/ghostscript/8.63/Resource : /usr/share/ghostscript/fonts :
/usr/share/fonts/default/ghostscript : /usr/share/fonts/default/Type1 :
/usr/share/fonts/default/amspsfnt/pfb :
/usr/share/fonts/default/cmpsfont/pfb : /usr/share/fonts :
/usr/share/ghostscript/conf.d : /etc/ghostscript : /etc/ghostscript/8.63
For more information, see /usr/share/ghostscript/8.63/doc/Use.htm.
Please report bugs to bugs.ghostscript.com.


回复 点赞
morris88 2009年05月19日
Driver structure
A device is represented by a structure divided into three parts:

procedures that are (normally) shared by all instances of each device;
parameters that are present in all devices but may be different for each device or instance; and
device-specific parameters that may be different for each instance.
Normally the procedure structure is defined and initialized at compile time. A prototype of the parameter structure (including both generic and device-specific parameters) is defined and initialized at compile time, but is copied and filled in when an instance of the device is created. Both of these structures should be declared as const, but for backward compatibility reasons the latter is not.

The gx_device_common macro defines the common structure elements, with the intent that devices define and export a structure along the following lines. Do not fill in the individual generic parameter values in the usual way for C structures: use the macros defined for this purpose in gxdevice.h or, if applicable, gdevprn.h.

typedef struct smurf_device_s {
gx_device_common;
... device-specific parameters ...
} smurf_device;
smurf_device gs_smurf_device = {
... macro for generic parameter values ...,
{ ... procedures ... }, /* std_procs */
... device-specific parameter values if any ...
};The device structure instance must have the name gs_smurf_device, where smurf is the device name used in contrib.mak. gx_device_common is a macro consisting only of the element definitions.

All the device procedures are called with the device as the first argument. Since each device type is actually a different structure type, the device procedures must be declared as taking a gx_device * as their first argument, and must cast it to smurf_device * internally. For example, in the code for the "memory" device, the first argument to all routines is called dev, but the routines actually use mdev to refer to elements of the full structure, using the following standard initialization statement at the beginning of each procedure:

gx_memory_device *const mdev = (gx_device_memory *)dev;(This is a cheap version of "object-oriented" programming: in C++, for example, the cast would be unnecessary, and in fact the procedure table would be constructed by the compiler.)

回复 点赞
morris88 2009年05月19日
The interface between Ghostscript and device drivers
http://ghostscript.com/doc/current/Drivers.htm
回复 点赞
expter 2009年05月19日
我有这个书啊,你说的Postscript 是基于应用程序

我需要驱动打印的资料!
回复 点赞
morris88 2009年05月19日
你看看《unix环境高级编程》第一版第17章,就是将实现串口 Postscript 打印的
回复 点赞
expter 2009年05月19日
不一样撒。
只是我想找点linux下串口打印驱动程序 资料
回复 点赞
morris88 2009年05月19日
[Quote=引用 9 楼 expter 的回复:]
我问的PostScript打印程序 是不是linux下串口打印驱动一个特例 哦
[/Quote]

请问你:应用程序和驱动是一样的吗?
回复 点赞
expter 2009年05月19日
我问的PostScript打印程序 是不是linux下串口打印驱动一个特例 哦
回复 点赞
猫已经找不回了 2009年05月19日
发动态
发帖子
Linux_Kernel
创建于2007-08-27

3143

社区成员

1.7w+

社区内容

Linux/Unix社区 内核源代码研究区
社区公告
暂无公告