admin管理员组

文章数量:1531657

2024年2月2日发(作者:)

前段时间办公室申请换打印机的时候,很想换一台支持网络打印的,网上查了查感觉HP2015DN还不错,属于价格适中量又足的那种。不过一般采购的事情是自己做不了主的,最终送来的是HP2015D,USB接口的连线都得再掏钱买,这HP也够黑的。仅仅差了一个N,结果网络打印的功能就泡汤了。

不过还好,HP2015D起码是台PDL打印机,可以在Linux上用p910nd这个软件包来实现网络打印机功能(以前用的那种烂GDI打印机,只能在Windows下用),其性能是Windows下的打印共享所不能比的。

具体做法如下:

1、找一台从其他部门退役下来申请报废的破PC装个Linux,设置好IP地址确认能被其他计算机访问到,把打印机的USB连接线接到这台计算机上

2、安装P910nd软件包:

a)、在这里下载 p910nd:/p910nd/

b)、解压缩并进入源代码目录:tar jxvf 2; cd

p910nd-0.92

c)、编译安装:make,最终产生的目标文件是/usr/sbin/p910nd

d)、确认usb设备已经创建(一般在Linux系统安装时就创建好了):ls -l

/dev/usb | grep lp0,应该会返回一行信息如:crw-rw---- 1 root lp 180, 0 12-26

13:22 lp0

e)、如果没有返回信息,则创建之:mknod /dev/usb/lp0 c 180 0

f)、启动服务进程:/usr/sbin/p910nd -f /dev/usb/lp0 0

g)、把上述命令写入/etc/,每次开机时自动运行

3、在其他需要使用打印机的计算机上用以下方法安装打印机,以Windows XP为例:

a)、在添加打印机向导中选择“连接到此计算机的本地打印机”,确认不要选“自

动检测并安装即插即用打印机”

b)、选择“创建新端口”端口类型选“Standard TCP/IP Port”

c)、打印机名或IP地址填上述Linux主机的IP地址

d)、选“自定义”,点“设置”按钮,确认“协议”为Raw,“端口号”为9100

e)、安装打印驱动程序,厂商选“HP”,打印机选“HP LaserJet P2015 Series PCL

6”

f)、确认将新添加的打印机设置为默认打印机

虽然是台破PC,但单纯用做打印服务器也实在是太浪费资源了,再配置一下samba,把剩余的磁盘空间用做部门内的共享服务器,报废的计算机又可以继续发挥余热啦。

设备:水星MW4530R 8M无线路由器,惠普HP MFP M1005 打印一体机。

固件:OpenWrt Barrier Breaker 14.07 r44382 by Haxc;惠普HP MFP

M1005 打印一体机打印机固件采用hplj固件/hplj/。

下面是安装设置教程:

**************** part I 路由器端安装设置 ***************

1、路由器端安装打印机服务器

通过putty软件SSH登陆到路由器安装,如果你安装了上述的openwrt固件,可略过此步骤,里面已经集成了。

opkg update

opkg install kmod-usb-printer usbutils p910nd luci-app-p910nd

2. 安装打印机固件

HP的低端打印机自身不带打印固件,每次连接pc时固件会从pc加载到打印机中。博主的HP MFP M1005就属于这种。通过putty软件SSH登陆

cd /usr/lib/

wget /hplj/

每次打印机上电要自动加载这个驱动固件:

打开编辑器:vi /etc/hotplug.d/usb/20-printer

输入:

#############################################

#!/bin/sh

# change this to the location where you put the .dl file:

FIRMWARE=/usr/lib/

DEVICE=/dev/usb/lp0

LOGFILE=/var/log/printer

if [ "$PRODUCT" = "3f0/3b17/100" -a "$ACTION" = "add" -a

"$DEVTYPE" = "usb_interface" ]; then

echo "$(date): STARTING" > $LOGFILE

for i in $(seq 30); do

echo "$(date): Attempt number $i on $DEVICE" >>

$LOGFILE

if [ -c $DEVICE ]; then

echo "$(date): Device $DEVICE found." >> $LOGFILE

if [ -z "'usb_printerid $DEVICE | grep FWVER" ];

then

echo "$(date): No firmware found on

$DEVICE" >> $LOGFILE

echo "$(date): Sending firmware to

" >> $LOGFILE

cat $FIRMWARE > $DEVICE

echo "$(date): done." >> $LOGFILE

else

echo "$(date): Firmware already there on

$DEVICE" >> $LOGFILE

fi

echo "$(date): EXITING" >> $LOGFILE

exit

fi

sleep 1

done

fi

#############################

其中

PRODUCT" = "3f0/3b17/100"信息要根据打印机不同做相应修改,把打印机用usb连接至路由器后,通过putty,利用命令:

lsusb -v | grep ID

获得类似以下信息:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 002: ID 03f0:3b17 Hewlett-Packard LaserJet M1005

MFP

3、设置 p910nd,安装了上述的openwrt固件,可略过此步,否则:

vi /etc/config/p910nd 编辑加入一下内容:

config p910nd

option device /dev/usb/lp0

option port 0

option bidirectional 1

option enabled 1

4、设置防火墙

vi /etc/config/firewall,在尾部追加一下内容:

# Allow printer

config rule

option src lan

option proto tcp

option dest_port 9100

option target ACCEPT

最后:

/etc/init.d/p910nd enable

reboot

以上就是在openwrt里面的配置,下面是在里面的配置

***********************part I 电脑端安装设置以win7系统为例**************************

5、设备和打印机-添加打印机-添加本地打印机-创建新端口(端口类型Standard tcp/ip port)-IP地址:路由地址(192.168.5.1)(根据自己路由地址更改),端口名称默认,查询那个钩掉

点下一步就可以添加端口了

6、安装驱动(以HP为例,最后一步会让选择端口,选列表192.168.1.1那个),计算机安装打印机官方驱动。

至此,打印机服务器安装成功,就可以直接打印了。

本文由品质电器生活科技+友情提供赞助

Click on the Start button and select Devices and Printers.

Click on "Add a printer."

In the Add Printer dialog select "Add a local printer."

Select "Create a new port:" and set the type of port to "Standard TCP/IP Port".

Then click Next.

In the "Hostname or IP address:" field enter the IP address of your router.

The "Port name:" field may be set to something you like.

De-select "Query the printer and automatically select the driver to use," then

click next.

The computer will then attempt to detect the TCP/IP port. This will take some

time and will most likely fail. Failing this step is not a problem.

On the "Additional port information required" page set the device type to

Custom and click "Settings…"

Verify the Printer Name or IP Address. The Protocol should be set to "Raw"

and the Raw Settings Port Number should be 9100. Leave LPR Settings

and SNMP Status Enabled empty or de-selected. Then click OK.

Select the correct printer driver and click next. You may need to install drivers

if they are not already available.

Finish the remaining printer installation wizard steps as needed. The printer

should now be installed and working!

Click on the Start button and select Devices and Printers.

Click on "Add a printer."

In the Add Printer dialog select "Add a local printer."

Select "Create a new port:" and set the type of port to "Standard TCP/IP Port".

Then click Next.

In the "Hostname or IP address:" field enter the IP address of your router.

The "Port name:" field may be set to something you like.

De-select "Query the printer and automatically select the driver to use," then

click next.

The computer will then attempt to detect the TCP/IP port. This will take some

time and will most likely fail. Failing this step is not a problem.

On the "Additional port information required" page set the device type to

Custom and click "Settings…"

Verify the Printer Name or IP Address. The Protocol should be set to "Raw"

and the Raw Settings Port Number should be 9100. Leave LPR Settings

and SNMP Status Enabled empty or de-selected. Then click OK.

Select the correct printer driver and click next. You may need to install drivers

if they are not already available.

Finish the remaining printer installation wizard steps as needed. The printer

should now be installed and working!

Click on the Start button and select Devices and Printers.

Click on "Add a printer."

In the Add Printer dialog select "Add a local printer."

Select "Create a new port:" and set the type of port to "Standard TCP/IP Port".

Then click Next.

In the "Hostname or IP address:" field enter the IP address of your router.

The "Port name:" field may be set to something you like.

De-select "Query the printer and automatically select the driver to use," then

click next.

The computer will then attempt to detect the TCP/IP port. This will take some

time and will most likely fail. Failing this step is not a problem.

On the "Additional port information required" page set the device type to

Custom and click "Settings…"

Verify the Printer Name or IP Address. The Protocol should be set to "Raw"

and the Raw Settings Port Number should be 9100. Leave LPR Settings

and SNMP Status Enabled empty or de-selected. Then click OK.

Select the correct printer driver and click next. You may need to install drivers

if they are not already available.

Finish the remaining printer installation wizard steps as needed. The printer

should now be installed and working!

本文标签: 打印机安装端口计算机固件