2

OpenWrt下打印机

 2 years ago
source link: https://3mile.github.io/archives/2020/1023103910/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

OpenWrt下打印机

2020-10-23

发布在

OpenWrt下打印机

装好kmod-usb-printer,p910nd和相应的luci

如果是HP打印机,还需要安装hplip-common、hplip-sane、 sane-hp,以及加载对应的gdi驱动。

1、安装USB支持软件包

opkg update
opkg install kmod-usb-core
opkg install kmod-usb-storage
opkg install kmod-usb-printer #USB口打印机支持

2、安装CUPS 软件包

opkg insatll cups
opkg install libcupsdriver         ##注意libcupsdriver不会默认安装,需要手工安装,否则认不到打印机

3、编辑/etc/cups/cupsd.conf 修改/etc/cups/cupsd.conf中一段,如下:

<Location />
AuthClass Anonymous
AuthType None
Order Deny,Allow
Deny From All
Allow From 192.168.10.0/24 #允许192.168.10.xxx访问
</Location>

4、插上打印机,并给USB设备添加权限

chmod -R 777 /dev/bus/usb/001/

5、启动服务 登陆到http://192.168.10.1到管理台去启动服务,【系统】-【启动项】,把cupsd那一项设置“启用”,并且点击“开始”

6、在网页管理客户端添加打印机 打开路由器http://192.168.10.1:631这个页面,点击“Administration”,这里提示要输入账号和密码,就是路由器的登陆帐号和密码。 然后点击“Find New Printers”,正常情况下就能看到自己连接着的打印机了, 然后选“Add This Printer”, 勾选“Share This Printer”前面的勾,再点击“Continue”进入下一步, 看到“Make”项里面有个“Raw”,选中后先点“Continue”,最后再点“Add Printer”进入下一步, 接着保持默认点击“Set Default Options”,打印机就添加完成了。

7、查看共享的打印机地址 此时在http://192.168.10.1:631的“Printers”页面可以看到自己添加的打印机了,点击自己的打印机,可以在地址栏看到当前打印机的网络地址比如http://192.168.10.1:631/printers/EPSON_LQ-630K,复制这个地址。

8、在电脑上添加打印机 在控制面板的打印机里面,添加打印机,选择“添加网络打印机”,点“我需要的打印机不在列表中”,再选“按名称选择共享打印机”,输入刚才复制的地址http://192.168.10.1:631/printers/EPSON_LQ-630K,下一步就是添加自己打印机的驱动,这里不多说明了。

9、有可能打印机每天需要关机,而不影响正常运行,请编辑脚本放到/etc/cups下面,命名为crontab.sh

#!/bin/sh
while true
do
        chmod -R 777 /dev/bus/usb/001/
        sleep 3
done
exit 0

将sh /etc/cups/crontab.sh 加放到启动项里面,登陆到openwrt管理界面的系统启动项里,将sh /etc/cups/crontab.sh插入到exit 0 之前即可。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK