Chinaunix首页 | 论坛 | 博客
  • 博客访问: 395394
  • 博文数量: 77
  • 博客积分: 3149
  • 博客等级: 中校
  • 技术积分: 828
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-25 11:48
文章存档

2012年(5)

2011年(2)

2010年(11)

2009年(44)

2008年(15)

我的朋友

分类: LINUX

2009-05-05 21:55:12

开发板上启动cups的命令为

 

/etc/init.d/cups stop/start

service cups restart  1.1.23

有时出现cups web管理界面没有响应,需要重启服务。开发板里面的cups目前为1.2.7版本,需要研究与高版本存在的差异。

 

3、手动安装的cups打印机的一些命令,范例:

 

/usr/sbin/lpadmin -p LaserJet -E -v parallel:/dev/lp0 -m laserjet.ppd

 

1. 添加名为 LaserJet 的打印机 (-p)

2. 启用要使用的打印机 (-E)

3. 设置要使用的设备和设备类型 (-v)

4. 使用驱动程序/PPD 文件 laserjet.ppd (-m)

字符下打印:

 

/usr/bin/lp -d LaserJet /etc/aliases

 

lp 语法将文件 /etc/aliases 打印到 LaserJet 打印机 (-d)

临时禁用和启动打印机:

 

/usr/bin/disable -r "Changing Paper" LaserJet

/usr/bin/enable LaserJet

 

 

CUPS配置

注意,不同的版本界面略有差异,本文所用的软件版本为1.3.9 cups在很多Linux版本中已自带,不需要额外安装。

 

进入Administration,点击“Add printer”。

 

 

 

 

选择正确的驱动程序,如果所连接打印机的驱动程序不存在,则必须手工添加驱动程序(略)。

 

在添加打印机的最后,会提示你输入Linuxroot用户名和密码。

从下图可以看到新添加的打印机,名称为test

 

 

重要提示:

 

1)打开 选择administration,基本管理设置中Show printers shared by other systemsShare published printers connected to this systemAllow printing from the Internet这三项选定,即许可共享本地打印机,许可其它操作系统连接和许可网络打印。见【cups提供远程打印服务的配置经验】cups1.3.3。(好像并不是必须的)

 

 

2、编辑/etc/cups/cupsd.confLocation 选项添加容许的windows网段。

 

3、编辑/etc/cups/mime.convs,找到如下一行 (很重要,否则会显示答应错误)

 

#application/octet-stream application/vnd.cups-raw 0 -

 

将注释去掉。

 

4、编辑/etc/cups/mime.type,找到如下一行 (好像默认并没有注释)

 

#application/octet-stream

 

3一样,将注释去掉。

 

 

 

1Windows客户端

 在使用cups连接的网络打印服务前,必须停止XP的防火墙服务,或添加631的协议。否则会引起问题的。安装步骤如下:

1)在弹出的对话框中选择 “添加打印机”

2)选择添加的打印机类型为 “网络打印机”

 

3)URL下输入地址:,其中 10.2.2.3cups打印服务器的IP地址,631cups服务端口,ll为添加的打印机的名称。

 

4)如果提示URL错误,请纠正。否则点击“下一步”,然后提供Windows下的打印机驱动即可。

 

 

 

 

 

以上配置在cups1.3.9下测试完成,不敢保证在cups其他版本是否一定通过。

 

 

2Linux客户端

对于已联网并且安装了CUPSLinux客户端来讲,能够自动检测到网络中的打印机。因此,只需要找到菜单“系统——>首选项——>更多首选项——>默认打印机>”(redhat enterprise server)或“桌面——>首选项——>更多首选项——>默认打印机>”(fedora),将弹出网络上所有已存在的打印机,选择其中的某一在线打印机作为默认打印机即可。

 

 

网上提到在客户端要打开631端口或关闭防火墙,显然是错误的。应该是在服务器端打开631端口即可,是否关闭整个防火墙,笔者认为没有必要,不过调试过程中建议disable,以免对调试进度产生不利影响。

 

如果Linux客户端没有安装CUPS,则需要手工去添加打印机,笔者没有做过研究,网上有一篇文章(http://blog.sina.com.cn/s/blog_5507289e010008ky.html),有兴趣的可以参考。

 

 

 

 

 

 

也可以使用samba服务来共享打印机,这是最常规的做法,只需配置samba服务,将打印机共享即可。

 

 

security = share

 

 

########## Printing ##########

 

# If you want to automatically load your printer list rather

# than setting them up individually then you'll need this

#;   load printers = yes

   load printers = yes

# lpr(ng) printing. You may wish to override the location of the

# printcap file

;   printing = bsd

;   printcap name = /etc/printcap

 

# CUPS printing.  See also the cupsaddsmb(8) manpage in the

# cupsys-client package.

   printing = cups

   printcap name = /etc/printcap

 

# When using [print$], root is implicitly a 'printer admin', but you can

# also give this right to other users to add drivers and set printer

# properties

;   printer admin = @ntadmin

 

 

############ Misc ############

 

# Using the following line enables you to customise your configuration

# on a per machine basis. The %m gets replaced with the netbios name

# of the machine that is connecting

;   include = /home/samba/etc/smb.conf.%m

 

# Most people will find that this option gives better performance.

# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/speed.html

# for details

# You may want to add the following on a Linux system:

#         SO_RCVBUF=8192 SO_SNDBUF=8192

   socket options = TCP_NODELAY

 

# The following parameter is useful only if you have the linpopup package

# installed. The samba maintainer and the linpopup maintainer are

# working to ease installation and configuration of linpopup and samba.

;   message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

 

# Domain Master specifies Samba to be the Domain Master Browser. If this

# machine will be configured as a BDC (a secondary logon server), you

# must set this to 'no'; otherwise, the default behavior is recommended.

;   domain master = auto

 

# Some defaults for winbind (make sure you're not using the ranges

# for something else.)

;   idmap uid = 10000-20000

;   idmap gid = 10000-20000

;   template shell = /bin/bash

 

#======================= Share Definitions =======================

 

[homes]

   comment = Home Directories

   browseable = no

 

# By default, the home directories are exported read-only. Change next

# parameter to 'yes' if you want to be able to write to them.

   writable = no

 

# File creation mask is set to 0700 for security reasons. If you want to

# create files with group=rw permissions, set next parameter to 0775.

   create mask = 0700

 

# Directory creation mask is set to 0700 for security reasons. If you want to

# create dirs. with group=rw permissions, set next parameter to 0775.

   directory mask = 0700

 

# Un-comment the following and create the netlogon directory for Domain Logons

# (you need to configure Samba to act as a domain controller too.)

;[netlogon]

;   comment = Network Logon Service

;   path = /home/samba/netlogon

;   guest ok = yes

;   writable = no

;   share modes = no

 

# Un-comment the following and create the profiles directory to store

# users profiles (see the "logon path" option above)

# (you need to configure Samba to act as a domain controller too.)

# The path below should be writable by all users so that their

# profile directory may be created the first time they log on

;[profiles]

;   comment = Users profiles

;   path = /home/samba/profiles

;   guest ok = no

;   browseable = no

;   create mask = 0600

;   directory mask = 0700

 

[printers]

   comment = All Printers

   browseable = yes

   path = /var/spool/samba

   printable = yes

   public =yes

   writable = no

   create mode = 0700

 

# Windows clients look for this share name as a source of downloadable

# printer drivers

[print$]

   comment = Printer Drivers

   path = /var/lib/samba/printers

   browseable = yes

   read only = yes

   guest ok = no

# Uncomment to allow remote administration of Windows print drivers.

# Replace 'ntadmin' with the name of the group your admin users are

# members of.

;   write list = root, @ntadmin

 

 

按照以上修改后,根据IP地址搜索计算机,应该可以找到打印服务器。

 

进入后能看到所有的打印机列表,选择其中一款打印机,点击连接即可。

 

(注:图片太多,不一一上传,太花时间)

 
阅读(8518) | 评论(6) | 转发(0) |
给主人留下些什么吧!~~

xuyuanchao2012-02-11 09:28:43

这段时间很少写了,也很少看博客。

中国期刊网上 有一篇文章。那里面比较详细,产品研发出来,但没有上市。
基于开源软件的嵌入式网络打印服务器的实现

2011-10-08 17:22:03

xuyuanchao 老师你好,我是在校学生,准备移植cups打印服务器实践一下,刚好看到你的文章,看你上面说是参考网上英文文章做得,麻烦能提供链接么,谢谢,
还有你们自己研发的产品是上面,在市面上有么,我也在网上搜索了一下,好像没有搜索到基于cups的打印服务器,大多的应该都是基于p910的打印服务器,这个p910的打印软件我也移植成功,想再移植cups,谢谢指教,谢谢

chinaunix网友2010-07-21 10:54:02

http://www.linuxfromscratch.org/blfs/view/stable/pst/cups.html

cltnet2010-07-19 11:51:52

xuyuanchao老师,能否把你们参考的网上文章链接发一个给我,我搜索到的网上文章很少,并且几乎都是写道重点的时候都没有了。我现在就是先准备在PC上试验,试验好了我在移植。请你把你参考的文章链接发一下,谢谢。

xuyuanchao2010-07-19 09:38:00

这是我所在的课题组基于我们自己的SoC研发的一款产品,MIPS指令集.是我的同事和我一块弄的,已成功,但不太稳定. 恕我直言,整个过程十分复杂,折腾了好几月,主要是编译慢。 建议可以先在PC上试验,OK后,再逐一移植,我们就是这么做的。 hal-cups-utils我没有印象,可能不需要。 具体要编译哪些文件,网上有英文文章,我们就是一点一点逐个编译的。没有捷径。痛苦的过程不敢回忆。