admin管理员组

文章数量:1627945

最近入手一台HP 126a打印机,可惜没无线打印。看到路由器改打印服务器使USB打印机支持无线打印。网上冲浪发现教程并不全,综合了自己折腾经验,基本实现功能。

刷机方面网上教程很多就不多阐述,这里Pandorabox用的系统版本是7620的19.01  openwrt用的是19.7

1.cups安装

Pandorabox比较简单直接SSH输入就自动安装了

opkg insatll cups

openwrt稍微麻烦点,他的软件源已没有CUPS,需要自己下载了.这里选择:大神编译好的

选择mipse的,其他设备型号自选。下载好全部安装好。

这时候CUPS就运作了。输入路由器IP:631,就能进界面了。

这里拒绝访问的话

修改/etc/cups/cupsd.conf中<Location /></Location> 
添加allow all

然后添加USB权限,这个最好要添加到启动任务里,否则每次开机都要运行一下,不然打印机没权限无法打印

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

这时候根据提示就能添加USB上打印机了,因为没有PPD,打印机MAKE一栏只能选择raw。打印机添加成功后就生成了打印机项目,然后复制打印机项目的地址http://你的路由器ip:631/printers/打印机名字.

这里用的WIN7添加网络打印机把地址加进去,按上驱动就能打印了。安卓手机这时候我是用printershare,一样的方法也能打印了。

2.AirPrint(avahi安装)

参考https://github/TheMMcOfficial/cups-for-openwrt

Pandorabox部分

opkg install  
 http://downloads.pangubox:6380/pandorabox/19.01/packages/mipsel_24kec_dsp/packages/avahi-dbus-daemon_0.6.31-12_mipsel_24kec_dsp.ipk

openwrt部分

opkg install avahi-daemon

安装好编辑一下服务

vi /etc/avahi/services/AirPrint-替换成你的打印机名.service

例如本人在CUPS里打印机名字设置成126a 就写airprint-126a

<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">AirPrint 你的打印机名 @ %h</name>
<service>
       <type>_ipp._tcp</type>
       <!-- This is key for AirPrint -->
       <subtype>_universal._sub._ipp._tcp</subtype>
       <port>631</port>
       <!-- These are copied from the txt portion of the above output -->
       <txt-record>txtvers=1</txt-record>
       <txt-record>qtotal=1</txt-record>
       <txt-record>rp=printers/你的打印机名</txt-record>
       <txt-record>ty=I make the printer Go</txt-record>
       <!-- This is visible in iPhone UI -->
       <txt-record>note=I am an AirPrint Printer</txt-record>
       <txt-record>product=(GPL Ghostscript)</txt-record>
       <txt-record>printer-state=3</txt-record>
       <txt-record>printer-type=0x3006</txt-record>
       <txt-record>Binary=T</txt-record>
       <txt-record>Transparent=T</txt-record>
       <txt-record>URF=DM3</txt-record>
       <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,application/vnd.cups-raster,image/gif,image/jpeg,image/png,image/tiff,image/urf,text/html,text/plain,application/vnd.adobe-reader-postscript,application/vnd.cups-pdf</txt-record>
</service>
</service-group>

vi /usr/share/cups/mime/airprint.convs

more airprint.convs
#
# "$Id: $"
#
# AirPrint
# Updated list with minimal set 25 Sept
image/urf application/pdf 100 pdftoraster
#
# End of "$Id: $".
#

本文标签: 小米路由器系统安装miniPandoraBox