折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机

废话不多说,直接开干,先刷固件

一、先刷固件

先断电,按着重置不放,开电源, 待电源灯光第二次连续闪烁即可刷入新固件。
刷固件要把本地IP地址按下图改一下,IP地址:192.168.1.2 网关192.168.1.1
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第1张图片

然后用FTFP工具按下图配置,浏览到你下载的img固件,我下的是这个固件版本,点击PUT按钮,待上传完后面点击OK。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第2张图片
稍等片刻,注意观察路由器的亮灯状态,稳定后即可完成刷机。
用浏览器打开http://192.168.1.1页面,不用密码即可进入管理页面。
设置好密码,即可用SSH登陆命令模式界面。

root@OpenWrt:~# opkg update  #更新源
root@OpenWrt:~# opkg install luci-i18n-base-zh-cn #安装中文
root@OpenWrt:~# opkg install openssh-sftp-server #安装SFTP,方便上传文件

二、挂载U盘

界面配置很友好,功能强大,完善,但不好安装OPKG包,需要插U盘来扩展分区,再来安装所需要的包。

插上U盘看,看看U盘的UUID

root@DD-WRT:~# blkid	#查看UUID
/dev/sda1: LABEL="KINGSTON" UUID="BBFA-C9B1"

root@DD-WRT:~# df -Th	#查看分区与挂载情况
Filesystem           Type            Size      Used Available Use% Mounted on
rootfs               rootfs         22.3M     22.3M         0 100% /
/dev/root            squashfs       22.3M     22.3M         0 100% /
none                 tmpfs         512.0K         0    512.0K   0% /dev
/dev/sda1            ext4           56.5G     66.9M     53.6G   0% /opt
/dev/mtdblock/3      jffs2          97.9M      2.4M     95.5M   2% /jffs

root@DD-WRT:/tmp/mnt/sda1# umount /tmp/mnt/sda1/	#取消挂载后才能格式化,需要切换出挂载的目录再取消挂载

root@DD-WRT:/tmp/mnt/sda1# mkfs.ext3 /dev/sda1 		#格式化为ext3格式,windows下的 fat格式没有权限,不能建立软链接
mke2fs 1.45.4 (23-Sep-2019)
/dev/sda1 contains a vfat file system labelled 'KINGSTON'
Proceed anyway? (y,N) y
/dev/sda1 is mounted; will not make a filesystem here!

折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第3张图片

三、安装Entware

然后按这个页面的详细介绍安装Entware
https://wiki.dd-wrt.com/wiki/index.php/Installing_Entware
可以大致按以下几个步骤:
1、如果没有自动挂载,则手动挂载
2、根据自己的CPU架构,选择下面的方式获取安装脚本:折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第4张图片

For MIPS based devices (Atheros, not dual core), this will be:

cd /opt (click enter)
wget http://bin.entware.net/mipssf-k3.4/installer/generic.sh (click enter)
sh generic.sh (click enter)

然后就可以看到安装与下载包的进度了
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第5张图片
看到这样的,基本上就代表安装成功了。
在这里我要抒发一下我的个人感情了:很幸运,在经过9981难后,没有放弃,终于成功了,差一点点我就玩不下去了,百度都被我搜烂了, 找到的安装cups方式都不成功,不是没有合适的包,就是安装不了,最后通过某个论坛里某个人一个简短的提点,知道了Entware的存在,说里面的包很全面, 我想总有cups吧,再一番狂搜后,一直没有安装成功,最后还是在https://wiki.dd-wrt.com官方网站里面通过搜索Entware才找到了正确安装步骤的。

最后一步,按介绍添加开机启动:

The Final Step is to add the following commands to the start-up script (Administration tab - then Commands). The sleep value can be adjusted, but 10 is long enough for most USB Harddrives/routers:

sleep 10
/opt/etc/init.d/rc.unslung start
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第6张图片

四、安装CUPS

然后我就迫不及待的输入的命令,结果得到我我梦寐以求的结果了

root@DD-WRT:/opt# opkg install cups
Installing cups (2.2.12-2a) to root...
Downloading http://bin.entware.net/mipssf-k3.4/cups_2.2.12-2a_mips-3.4.ipk
Installing zlib (1.2.13-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/zlib_1.2.13-1_mips-3.4.ipk
Installing libpng (1.6.39-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libpng_1.6.39-1_mips-3.4.ipk
Installing libjpeg-turbo (2.1.4-2) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libjpeg-turbo_2.1.4-2_mips-3.4.ipk
Installing libatomic (8.4.0-11) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libatomic_8.4.0-11_mips-3.4.ipk
Installing libusb-1.0 (1.0.26-3) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libusb-1.0_1.0.26-3_mips-3.4.ipk
Installing libexpat (2.5.0-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libexpat_2.5.0-1_mips-3.4.ipk
Installing libdbus (1.13.18-12) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libdbus_1.13.18-12_mips-3.4.ipk
Installing dbus (1.13.18-12) to root...
Downloading http://bin.entware.net/mipssf-k3.4/dbus_1.13.18-12_mips-3.4.ipk
Installing libintl-full (0.21.1-2) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libintl-full_0.21.1-2_mips-3.4.ipk
Installing libavahi-dbus-support (0.8-7a) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libavahi-dbus-support_0.8-7a_mips-3.4.ipk
Installing libdaemon (0.14-5) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libdaemon_0.14-5_mips-3.4.ipk
Installing avahi-dbus-daemon (0.8-7a) to root...
Downloading http://bin.entware.net/mipssf-k3.4/avahi-dbus-daemon_0.8-7a_mips-3.4.ipk
Installing libavahi-client (0.8-7a) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libavahi-client_0.8-7a_mips-3.4.ipk
Installing libiconv-full (1.17-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libiconv-full_1.17-1_mips-3.4.ipk
Installing libcups (2.2.12-2a) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libcups_2.2.12-2a_mips-3.4.ipk
Configuring libexpat.
Configuring libdbus.
Configuring dbus.
Configuring libintl-full.
Configuring libavahi-dbus-support.
Configuring libdaemon.
Configuring avahi-dbus-daemon.
Configuring zlib.
Configuring libpng.
Configuring libjpeg-turbo.
Configuring libatomic.
Configuring libusb-1.0.
Configuring libavahi-client.
Configuring libiconv-full.
Configuring libcups.
Configuring cups.

没有报错,顺利安装完成,感觉实在是太兴奋了,几天的时间终于没有白费,接下来就是配置一下就可以安装打印机了。

本想着下面就顺利了, 没想到一个又一个坑在等着我,cups服务启不来。
明明提示启动ok,但找不到进程。
本想查日志,但无论你怎么重启,log里面毛都没一根。
后来通过查系统日志才找到原因:先在【服务】里面开启系统日志,再次重启下cups服务,再到【状态】-【系统日志】里面查看,标红的就是报错。提示已经很显示了,就是用户组不对。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第7张图片

折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第8张图片
简单介绍一下CUPS相关的配置,以下是引用地址:https://it.cha138.com/tech/show-138757.html

.在cups服务器中,进入/etc/cups
目录下,可以看到如图4所示的cupsd.conf和cupsd.conf.default两个文件cupsd.conf和cupsd.conf.default的内容其实是一样的,我把cupsd.conf.default文件理解为cupsd.conf文件的备份。
在上述代码中:

a.把"Listen localhost:631"前加"#"注释掉。然后在下面另起一行,写上:Listen 0.0.0.0:631

意思为:请在631端口监听所有的主机连接。

b.把"Browsing off"前加"#"注释掉。然后在下面另起一行,写上:Browsing on

意思为:打开局域网共享。

c.在"BrowseOrder allow,deny"中另起一行,写上:allow 172.16.54.*(这里写上你共享任务的网段)

意思为:设定共享任务的网段

在上述代码中:

a.在" Order allow,deny"后,另起一行,写上:allow 172.16.54.*

意思为:设定只有IP为 172.16.54.* 的客户机才能访问此服务器

b.在" Order allow,deny"后,另起一行,写上:allow 172.16.54.88

意思为:设定只有IP为 172.16.54.88 的客户机才能访问此服务器的管理界面

在" Order
allow,deny"后,另起一行, 写上:allow 172.16.54.*

意思为:设定IP为 172.16.54.* 的客户机只能进行 Create-Job Print-Job Print-URI
Validate-Job的任务。

使用以下命令重启cups服务
sudo restart cups

五、修改CUPS配置

找到 /opt/etc/cups/cups-files.conf

这个文件的19行,
把SystemGroup lpadmin sys root改成SystemGroup root root root
在这里插入图片描述

六、启动CUPS服务

再重启OK了,ps一下终于看到了可爱的cups进程。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第9张图片

还是访问不了页面,应该是权限问题了,因为我通过netstat可以看到631端口已开启监听。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第10张图片
在cupsd.conf文件里面,需要修改以下内容
1、Listen localhost:631改为Listen 0.0.0.0:631

2、在以下Location 等标签里面添加一行: Allow all

# Restrict access to the server...
<Location />
  Order allow,deny
  Allow all
Location>

# Restrict access to the admin pages...

  Order allow,deny
  Allow all
Location>

# Restrict access to configuration files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all
Location>

# Restrict access to log files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all
Location>

修改保存后,重启一下服务,即可通过任意网段访问到界面了
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第11张图片

以前在openwrt下面可以查看usb设备的,现在lsusb命令用不了,需要安装一个包usbutils

root@DD-WRT:~# opkg install usbutils
Installing usbutils (014-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/usbutils_014-1_mips-3.4.ipk
Installing libevdev (1.13.0-1) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libevdev_1.13.0-1_mips-3.4.ipk
Installing libudev-zero (0.4.8-3) to root...
Downloading http://bin.entware.net/mipssf-k3.4/libudev-zero_0.4.8-3_mips-3.4.ipk
Configuring libevdev.
Configuring libudev-zero.
Configuring usbutils.
root@DD-WRT:~# lsusb
Bus 001 Device 007: ID 03f0:042a Hewlett-Packard HP LaserJet Professional M1136 MFP
Bus 001 Device 006: ID 1ba0:1131 Jolimark USBPrinter
Bus 001 Device 005: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 004: ID 6868:0500 Printer Printer
Bus 001 Device 003: ID 0951:1666 Kingston DataTraveler 3.0
Bus 001 Device 002: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux 3.18.140-d5 ehci_hcd Atheros AR91xx built-in EHCI controller

其它查找usb设备的方式可以按这个链接来操作:https://www.cnblogs.com/zongzi10010/p/10764125.html

root@DD-WRT:~# dmesg | grep usb
<6>[   47.480000] usbcore: registered new interface driver usbfs
<6>[   47.480000] usbcore: registered new interface driver hub
<6>[   47.490000] usbcore: registered new device driver usb
<6>[   47.920000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[   47.930000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[   47.940000] usb usb1: Product: Atheros AR91xx built-in EHCI controller
<6>[   47.940000] usb usb1: Manufacturer: Linux 3.18.140-d5 ehci_hcd
<6>[   47.950000] usb usb1: SerialNumber: platform
<6>[   48.320000] usb 1-1: new high-speed USB device number 2 using ar71xx-ehci
<6>[   48.470000] usb 1-1: New USB device found, idVendor=1a40, idProduct=0101
<6>[   48.470000] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[   48.480000] usb 1-1: Product: USB 2.0 Hub
<6>[   48.810000] usb 1-1.1: new high-speed USB device number 3 using ar71xx-ehci
<6>[   48.940000] usb 1-1.1: New USB device found, idVendor=0951, idProduct=1666
<6>[   48.940000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[   48.950000] usb 1-1.1: Product: DataTraveler 3.0
<6>[   48.960000] usb 1-1.1: Manufacturer: Kingston
<6>[   48.960000] usb 1-1.1: SerialNumber: 049226C3104121916914ICA9
<6>[   49.090000] usb 1-1.2: new full-speed USB device number 4 using ar71xx-ehci
<6>[   49.220000] usb 1-1.2: New USB device found, idVendor=6868, idProduct=0500
<6>[   49.220000] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[   49.230000] usb 1-1.2: Product: Printer
<6>[   49.240000] usb 1-1.2: Manufacturer: Printer
<6>[   49.240000] usb 1-1.2: SerialNumber: 0532E1228977
<6>[   49.400000] usb 1-1.4: new high-speed USB device number 5 using ar71xx-ehci
<6>[   49.530000] usb 1-1.4: New USB device found, idVendor=1a40, idProduct=0101
<6>[   49.530000] usb 1-1.4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[   49.540000] usb 1-1.4: Product: USB 2.0 Hub
<6>[   50.260000] usb 1-1.4.2: new full-speed USB device number 6 using ar71xx-ehci
<6>[   50.670000] usb 1-1.4.2: New USB device found, idVendor=1ba0, idProduct=1131
<6>[   50.680000] usb 1-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[   50.680000] usb 1-1.4.2: Product: USBPrinter
<6>[   50.690000] usb 1-1.4.2: Manufacturer: Jolimark
<6>[   50.690000] usb 1-1.4.2: SerialNumber: 18210087SF
<6>[   50.740000] usb-storage 1-1.1:1.0: USB Mass Storage device detected
<6>[   50.750000] scsi host0: usb-storage 1-1.1:1.0
<6>[   50.750000] usb-storage 1-1.2:1.1: USB Mass Storage device detected
<6>[   50.770000] scsi host1: usb-storage 1-1.2:1.1
<6>[   50.770000] usbcore: registered new interface driver usb-storage
<6>[   50.820000] usb 1-1.4.3: new high-speed USB device number 7 using ar71xx-ehci
<6>[   50.950000] usb 1-1.4.3: New USB device found, idVendor=03f0, idProduct=042a
<6>[   50.960000] usb 1-1.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[   50.960000] usb 1-1.4.3: Product: HP LaserJet Professional M1136 MFP
<6>[   50.970000] usb 1-1.4.3: Manufacturer: Hewlett-Packard
<6>[   50.980000] usb 1-1.4.3: SerialNumber: 000000000QH4HPPWSI1c
<6>[   51.010000] usb-storage 1-1.4.3:1.0: USB Mass Storage device detected
<6>[   51.020000] scsi host2: usb-storage 1-1.4.3:1.0
root@DD-WRT:~# lsusb 
Bus 001 Device 007: ID 03f0:042a Hewlett-Packard HP LaserJet Professional M1136 MFP
Bus 001 Device 006: ID 1ba0:1131 Jolimark USBPrinter
Bus 001 Device 005: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 004: ID 6868:0500 Printer Printer
Bus 001 Device 003: ID 0951:1666 Kingston DataTraveler 3.0
Bus 001 Device 002: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux 3.18.140-d5 ehci_hcd Atheros AR91xx built-in EHCI controller

可以看到我的三台打印机都已经有了,但是我在管理界面里面还是发现不了打印机
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第12张图片
原来是USB设备没有执行权限,那就给USB设备增加权限吧

root@DD-WRT:/dev# chmod -R 777 /dev/

七、添加打印机

再进入添加打印机页面,就可以看到两台打印机了,接下来的步骤就很简单不详细介绍了

折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第13张图片

八、显示不了HP打印机和其它问题

但还有一台怎么没有出现, 真是莫名其妙呀,坑也太多了吧, 我不由得叹一声命是真苦呀。

经过几天研究,那台HP 1136的打印机还是无法识别出来, 我也无奈,不知道什么原因引起的,如果哪位好心大佬能告知我一下, 将不胜感激。

附上我的摸索经过,用系统的lsusb可以看到我这台打印机,看看能不能分析出来一些问题

root@DD-WRT:/opt/lib/cups/backend# lsusb 
Bus 001 Device 012: ID 03f0:042a Hewlett-Packard HP LaserJet Professional M1136 MFP
Bus 001 Device 011: ID 1ba0:1131 Jolimark USBPrinter
Bus 001 Device 010: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 009: ID 6868:0500 Printer Printer
Bus 001 Device 008: ID 0951:1666 Kingston DataTraveler 3.0
Bus 001 Device 007: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux 3.18.140-d5 ehci_hcd Atheros AR91xx built-in EHCI controller

可以看出来系统已经正常识别了吧,但用CUPS的后端程序USB执行一下看到能正常看到7个usb设备, 但是只识别出2台打印机来。

root@DD-WRT:/opt/lib/cups/backend# ls
dnssd   hp      http    ipp     lpd     snmp    socket  usb
root@DD-WRT:/opt/lib/cups/backend# ./usb 
DEBUG: Loading USB quirks from "/opt/share/cups/usb".
DEBUG: Loaded 95 quirks.
DEBUG: list_devices
DEBUG: libusb_get_device_list=7
DEBUG2: Printer found with device ID: MFG:Jolimark ;CMD:ESC/P2K;MDL:FP-630K+;CLS:PRINTER;DES:Jolimark FP-630K+;CID:Jolimark DMP24;SN:1 Device URI: usb://Jolimark/FP-630K+?serial=18210087SF
direct usb://Jolimark/FP-630K+?serial=18210087SF "Jolimark FP-630K+" "Jolimark FP-630K+" "MFG:Jolimark ;CMD:ESC/P2K;MDL:FP-630K+;CLS:PRINTER;DES:Jolimark FP-630K+;CID:Jolimark DMP24;SN:  1" ""
DEBUG2: Printer found with device ID:  Device URI: usb://Unknown/Printer?serial=0532E1228977
direct usb://Unknown/Printer?serial=0532E1228977 "Unknown" "Unknown" "" ""

root@DD-WRT:/opt/lib/cups/backend# ll /dev/usb*
crwxrwxrwx    1 root     root      189,   1 Jan  1 08:00 /dev/usbdev1.2
crwxrwxrwx    1 root     root      189,   0 Jan  1 08:00 /dev/usbdev1.1
crwxrwxrwx    1 root     root      189,   0 Jan  1 08:00 /dev/usb1
crwxrwxrwx    1 root     root      189,   2 Jan  1 08:00 /dev/usbdev1.3
crwxrwxrwx    1 root     root      189,   4 Jan  1 08:00 /dev/usbdev1.5
crwxrwxrwx    1 root     root      189,   3 Jan  1 08:00 /dev/usbdev1.4
crwxrwxrwx    1 root     root      189,   5 Jan  1 08:00 /dev/usbdev1.6
crwxrwxrwx    1 root     root      189,   6 Jan  1 08:25 /dev/usbdev1.7
crwxrwxrwx    1 root     root      189,   7 Jan  1 08:25 /dev/usbdev1.8
crwxrwxrwx    1 root     root      189,   9 Jan  1 08:25 /dev/usbdev1.10
crwxrwxrwx    1 root     root      189,  11 Jan  1 08:25 /dev/usbdev1.12
crwxrwxrwx    1 root     root      189,   8 Jan  1 09:48 /dev/usbdev1.9
crwxrwxrwx    1 root     root      189,  10 Jan  1 09:48 /dev/usbdev1.11




root@DD-WRT:/opt/lib/cups/backend# dmesg | grep usb
<6>[   39.390000] usbcore: registered new interface driver usblp
<6>[   39.600000] usb 1-1.4: New USB device found, idVendor=1a40, idProduct=0101
<6>[   39.600000] usb 1-1.4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[   39.610000] usb 1-1.4: Product: USB 2.0 Hub
<6>[   39.970000] usb 1-1.4.2: new full-speed USB device number 6 using ar71xx-ehci
<6>[   40.100000] usb 1-1.4.2: New USB device found, idVendor=1ba0, idProduct=1131
<6>[   40.110000] usb 1-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[   40.110000] usb 1-1.4.2: Product: USBPrinter
<6>[   40.120000] usb 1-1.4.2: Manufacturer: Jolimark
<6>[   40.120000] usb 1-1.4.2: SerialNumber: 18210087SF
<6>[   40.270000] usblp 1-1.4.2:1.0: usblp1: USB Bidirectional printer dev 6 if 0 alt 0 proto 2 vid 0x1BA0 pid 0x1131
<6>[ 1533.940000] usb 1-1: USB disconnect, device number 2
<6>[ 1533.940000] usb 1-1.1: USB disconnect, device number 3
<6>[ 1534.010000] usb 1-1.2: USB disconnect, device number 4
<6>[ 1534.010000] usblp0: removed
<6>[ 1534.020000] usb 1-1.4: USB disconnect, device number 5
<6>[ 1534.030000] usb 1-1.4.2: USB disconnect, device number 6
<6>[ 1534.030000] usblp1: removed
<6>[ 1534.540000] usb 1-1: new high-speed USB device number 7 using ar71xx-ehci
<6>[ 1534.690000] usb 1-1: New USB device found, idVendor=1a40, idProduct=0101
<6>[ 1534.690000] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[ 1534.700000] usb 1-1: Product: USB 2.0 Hub
<6>[ 1535.040000] usb 1-1.1: new high-speed USB device number 8 using ar71xx-ehci
<6>[ 1535.170000] usb 1-1.1: New USB device found, idVendor=0951, idProduct=1666
<6>[ 1535.170000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1535.180000] usb 1-1.1: Product: DataTraveler 3.0
<6>[ 1535.190000] usb 1-1.1: Manufacturer: Kingston
<6>[ 1535.190000] usb 1-1.1: SerialNumber: 049226C3104121916914ICA9
<6>[ 1535.280000] usb-storage 1-1.1:1.0: USB Mass Storage device detected
<6>[ 1535.290000] scsi host2: usb-storage 1-1.1:1.0
<6>[ 1535.390000] usb 1-1.2: new full-speed USB device number 9 using ar71xx-ehci
<6>[ 1535.930000] usb 1-1.2: New USB device found, idVendor=6868, idProduct=0500
<6>[ 1535.940000] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1535.950000] usb 1-1.2: Product: Printer
<6>[ 1535.950000] usb 1-1.2: Manufacturer: Printer
<6>[ 1535.950000] usb 1-1.2: SerialNumber: 0532E1228977
<6>[ 1535.970000] usblp 1-1.2:1.0: usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x6868 pid 0x0500
<6>[ 1535.980000] usb-storage 1-1.2:1.1: USB Mass Storage device detected
<6>[ 1536.270000] scsi host3: usb-storage 1-1.2:1.1
<6>[ 1536.380000] usb 1-1.4: new high-speed USB device number 10 using ar71xx-ehci
<6>[ 1536.980000] usb 1-1.4: New USB device found, idVendor=1a40, idProduct=0101
<6>[ 1536.990000] usb 1-1.4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[ 1537.000000] usb 1-1.4: Product: USB 2.0 Hub
<6>[ 1537.330000] usb 1-1.4.2: new full-speed USB device number 11 using ar71xx-ehci
<6>[ 1537.810000] usb 1-1.4.2: New USB device found, idVendor=1ba0, idProduct=1131
<6>[ 1537.820000] usb 1-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1537.820000] usb 1-1.4.2: Product: USBPrinter
<6>[ 1537.830000] usb 1-1.4.2: Manufacturer: Jolimark
<6>[ 1537.830000] usb 1-1.4.2: SerialNumber: 18210087SF
<6>[ 1538.040000] usblp 1-1.4.2:1.0: usblp1: USB Bidirectional printer dev 11 if 0 alt 0 proto 2 vid 0x1BA0 pid 0x1131
<6>[ 1538.130000] usb 1-1.4.3: new high-speed USB device number 12 using ar71xx-ehci
<6>[ 1538.260000] usb 1-1.4.3: New USB device found, idVendor=03f0, idProduct=042a
<6>[ 1538.260000] usb 1-1.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1538.270000] usb 1-1.4.3: Product: HP LaserJet Professional M1136 MFP
<6>[ 1538.280000] usb 1-1.4.3: Manufacturer: Hewlett-Packard
<6>[ 1538.280000] usb 1-1.4.3: SerialNumber: 000000000QH4HPPWSI1c
<6>[ 1538.430000] usb-storage 1-1.4.3:1.0: USB Mass Storage device detected
<6>[ 1538.450000] scsi host4: usb-storage 1-1.4.3:1.0
<6>[ 6508.480000] usblp1: removed
<6>[ 6508.490000] usblp 1-1.4.2:1.0: usblp1: USB Bidirectional printer dev 11 if 0 alt 0 proto 2 vid 0x1BA0 pid 0x1131
<6>[ 6508.500000] usblp0: removed
<6>[ 6508.510000] usblp 1-1.2:1.0: usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x6868 pid 0x0500

root@DD-WRT:/opt/lib/cups/backend# lpinfo -v
network ipp
network http
network socket
network lpd
direct hp
direct usb://Jolimark/FP-630K+?serial=18210087SF
direct usb://Unknown/Printer?serial=0532E1228977

偶尔还会出现一些问题,突然添加打印机页面显示服务异常,有可能是动了USB设备,按道理应该USB打印机支持插拔的吧,打开日志显示以下内容:

W [01/Jan/1970:08:01:16 +0800] CreateProfile failed: org.freedesktop.DBus.Error.ServiceUnknown:The name org.freedesktop.ColorManager was not provided by any .service files
W [01/Jan/1970:08:01:16 +0800] CreateProfile failed: org.freedesktop.DBus.Error.ServiceUnknown:The name org.freedesktop.ColorManager was not provided by any .service files
W [01/Jan/1970:08:01:16 +0800] CreateDevice failed: org.freedesktop.DBus.Error.ServiceUnknown:The name org.freedesktop.ColorManager was not provided by any .service files

但是cupsd的进程与631端口还在,必须要重启服务才能恢复。

九、放弃dd-wrt

以上两个问题无法解决,在考虑是否要更换一个固件了,要是有谁能帮忙搞定,万分感谢。

十、重刷openwrt

第一次没有刷openwrt不是我不喜欢它, 而是一拿到这个花40块钱在闲鱼上买的4300我就已经刷过了,而且刷了很多个openwrt版本,但有一个问题是,找不到cups包,当你信心满满地输入,opkg install cups时, 会提示你根本就找不到这个包,后来几番搜索才知道,openwrt已经放弃了cups的支持了, 转而推荐用p910d做打印服务,我在8年前就用过那玩意,对多台打印机支持不好,不知道现在解决了没有,关键是对外网直接开放9100端口后,会被外网扫描端口,导致打印机经常打印出来一些莫名其妙的乱码,头疼不已,纸张也错乱,浪费一大包纸不说, 后面也不好继续打,所以坚决不再碰p910d了。反观cups对USB打印机的支持也好,可以随意插拔不用重启服务,也可以对外网开放631端口不会乱打印出乱码,因为我有远程打印的需求我才特意搞了个这个打印服务器。
当我重新转回openwrt时,首先要面对的是cups包的问题,我当时找到过网上放出来已经编译出来的包,也试过了安装不上去,我想着再试下看看,实在不行就下载源码自己编译一个吧, 应该不是什么多难的事情了。
当我再次重新下载好一个包,放上去安装时,诶, 他可以了,提示安装说缺少什么包,那就简单了,直接全部下载下来给他放上去,竟然安装成功了。这把我给高兴坏了,也不知道为什么第一次没有安装成功,难道下错架构了,不应该呀, 我看着来了,不管了,这下反正是可以了,省得去自己编译。

openwrt版本的固件包是:openwrt-19.07.0-ar71xx-nand-wndr4300-ubi-factory
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第14张图片

打开WNDR4300路由openwrt主页面可以看到的CUP是Atheros AR9344 rev 2,属于mips架构的,所以下载的包要选mips下面的
下载的CUPS包地址:https://gitee.com/ytwl333/openwrt-musl-cups/tree/master/mips
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第15张图片
要注意作者的说明只适应于 LEDE / OPENWRT 18.06 / OPENWRT 19.07 的版本,所以openwrt版本不能太新了。

最后刷回OPENWRT后,刚开始也识别不了,但要安装一些包,安装包如下:

root@OpenWrt:/dev/usb# opkg install kmod-usb-ohci kmod-usb-uhci kmod-usb2 kmod-usb-uhci usbutils hotplug2

再试试看, HP1136的打印机终于识别出来了,泪漰呀, 再次感叹一下还是OPENWRT方便点,要什么包基本都有,dd-wrt下面很多包都没有,得依赖于entware。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第16张图片

还有一个因为我把打印机重启了一下, 有可能也是关键吧,暴汗了!

最后提醒一下:kmod-usb-core 这个包千万不能安装,如果系统有安装要卸载掉,有网友曾经在帖子里面提过这个包与cups会有冲突,经过我的实际使用,会不断的在/dev/下面创建一个usb的目录,然后在里面生成lp0、lp1、 lp2。。。 这就是这个包识别出来的打印机

root@OpenWrt:~# ll /dev/usb/
crw-------    1 root     root      189,   3 Aug 30 09:40 lp0
crw-------    1 root     root      189,   5 Aug 30 09:33 lp1
crw-------    1 root     root      189,   6 Aug 30 09:40 lp2

同时会在dmesg里面不断的remove 这些lp0 lp1,造成CUPS的打印任务很不稳定,有时可以有时不行。

root@OpenWrt:~# dmesg | grep usb
。。。。。。中间省略。。。。。。。
<6>[ 6508.480000] usblp1: removed
<6>[ 6508.490000] usblp 1-1.4.2:1.0: usblp1: USB Bidirectional printer dev 11 if 0 alt 0 proto 2 vid 0x1BA0 pid 0x1131
<6>[ 6508.500000] usblp0: removed
<6>[ 6508.510000] usblp 1-1.2:1.0: usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x6868 pid 0x0500

用下面的命令卸载掉之后,dmesg 里面就不再有usblp1: removed 的记录了, /dev下面也没有usb这个目录了。

root@OpenWrt:~# opkg remove kmod-usb-core
No packages removed.

以下内容是关于包冲突的与usb权限问题的详细介绍,引用自:https://oldwiki.archive.openwrt.org/doc/howto/cups.server?s%5B%5D=cups
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第17张图片

USB printers notes and throubleshooting
Backfire: There may be a problem interfacing with USB printers if usb-printers kernel module is also loaded. These conflict with the cups-provided USB support. There are plenty of bugs and one working solution is as follows:
Remove usblp support: opkg remove kmod-usb-printer
Edit user and group in /etc/cups/cupsd.conf from User Nobody/Group Nogroup to User root/Group root
Change ACL on /usr/lib/cups/backend/usb to 700 (chmod 700 /usr/lib/cups/backend/usb). This changes the behaviour of cups, which normally tries to execute the backend through a user account other than root. This forces the backend to run as root from cups.
Finally, it should be possible to add printers through the web page http://host:631/admin or manually. The USB device name cannot be displayed through lpinfo but can instead be listed by running /usr/lib/cups/backend/usb as root.
There is a problem with the permissions on USB printers not being writable by nobody, which is what CUPS expects. An alternative is to make a wrapper backend that executes a sudo script which does find /proc/bus/usb -type f -exec chmod +rw {} ;. Point being, there is a permission problem between USB/udev and CUPS preventing USB-printers from working. Also, CUPS is removing support or has a lot of issues currently with usblp support.
In Attitude Adjustment, you just need to change ACL on /usr/lib/cups/backend/usb to 700 (chmod 700 /usr/lib/cups/backend/usb). This changes the behaviour of cups, which normally tries to execute the backend through a user account other than root. This forces the backend to run as root from cups, the reason have been said above.

这可能就是引起我之前DD-WRT下查看不到HP打印机的原因,当然还有包的原因。

为了避免打印任务空间不足,按如下方法可以修改存放目录,
以下引用自:http://mattie47.com/getting-cups-working-on-openwrt/

Configure CUPs to use your USB device for print jobs

Time to re-edit your CUPs config. Either use VI or your text editor of
choice and edit your cupsd.conf file:

nano /etc/cups/cupsd.conf

Change: RequestRoot /var/cups TempDir /var/cups

I changed both to /usb/cups/ since as you can see in the above screen
cap I mounted my usb drive as /usb

You probably should restart CUPs now.Do this by: root@OpenWrt:~#
/etc/init.d/cupsd restart

查看一下系统磁盘空间情况,cups是默认是存放在/var/cups里面的,只有6.5M了,发现/tmp里面的空间比较充足,但重启后会清空掉,我想应该也问题不大,很少会去重启路由器吧, 基本上是全年7*24的。

root@OpenWrt:/tmp# df -hT
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/root            squashfs        2.5M      2.5M         0 100% /rom
tmpfs                tmpfs          60.7M      1.8M     58.9M   3% /tmp
/dev/ubi0_1          ubifs          13.8M      6.5M      6.6M  50% /overlay
overlayfs:/overlay   overlay        13.8M      6.5M      6.6M  50% /
tmpfs                tmpfs         512.0K         0    512.0K   0% /dev

把cupsd.conf里的 RequestRoot /var/cups与TempDir /var/cups参数两个参数都改成 /tmp/cups

RequestRoot /tmp/cups
User root
Group root
RIPCache auto
TempDir /tmp/cups

/etc/init.d/cupsd restart

十一、部署FTP服务

原来的openwrt系统上是没有【挂载点】的这个菜单的
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第18张图片
为了让他出现这个菜单,需要安装以下包,有好些包前面都已经安装过的,为了单独只部署FTP服务就一起放上来了

opkg update
opkg install block-mount

opkg install kmod-usb-ohci #安装usbohci控制器驱动
opkg install kmod-usb-uhci  #UHCI USB控制器
opkg install kmod-usb2 #安装usb2.0
opkg install kmod-usb-storage #安装usb存储设备驱动
opkg install usbutils #安装了这个后可以用lsusb


opkg install mount-utils #挂载卸载工具,使系统可以通过 UUID 进行挂载
opkg install ntfs-3g #挂载NTFS
opkg install kmod-fs-vfat #挂载FAT
opkg install kmod-fs-ext4:支持访问 ext4、ext3 分区
opkg install fdisk #硬盘分区管理工具
opkg install e2fsprogs
opkg install kmod-fs-ext4

opkg install lsblk:用于查看块设备
opkg install blockd:用于自动挂载

reboot  #重启一下很重要

执行完后发现还是没有, 不要着急,重启一下路由器,你再打开就会发现了。

再插上U盘,到【挂载点】的页面下面,点这上新增按钮,
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第19张图片

我的U盘是exFAT格式的,必须要在高级设置里面选一下对应的文件系统,不然,上面已挂载的文件系统里面显示不出来,如果再显示不出来可以重启一下试试看。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第20张图片

重新换了一个SSD固态硬盘配个硬盘盒,发现识别不了
用以下命令查看下USB设备

root@OpenWrt:~# block info
/dev/mtdblock8: UUID="1189284585" VERSION="1" TYPE="ubi"
/dev/sda: UUID="6068-1A4B" VERSION="FAT12" TYPE="vfat"
/dev/ubi0_1: UUID="e4803315-fd88-4c8e-b475-1dd4320804f3" VERSION="w4r0" MOUNT="/overlay" TYPE="ubifs"
/dev/ubiblock0_0: UUID="cacf3d41-5a41d84f-a33d6f0c-1030920e" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"

root@OpenWrt:~# lsusb 
Bus 001 Device 004: ID 03f0:042a HP, Inc LaserJet M1132 MFP
Bus 001 Device 006: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
Bus 001 Device 003: ID 1ba0:1131  
Bus 001 Device 005: ID 6868:0500  
Bus 001 Device 002: ID 214b:7250  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@OpenWrt:~# dmesg | grep usb
[    4.732708] usbcore: registered new interface driver usbfs
[    4.738356] usbcore: registered new interface driver hub
[    4.743902] usbcore: registered new device driver usb
[    5.292079] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    5.832048] usb 1-1.1: new full-speed USB device number 3 using ehci-platform
[    6.082046] usb 1-1.2: new high-speed USB device number 4 using ehci-platform
[    6.332044] usb 1-1.3: new full-speed USB device number 5 using ehci-platform
[    6.582112] usb 1-1.4: new high-speed USB device number 6 using ehci-platform
[    9.746414] usb-storage 1-1.3:1.1: USB Mass Storage device detected
[    9.753623] scsi host0: usb-storage 1-1.3:1.1
[    9.758706] usbcore: registered new interface driver usb-storage


root@OpenWrt:~# fdisk -l

Disk /dev/sda: 3.26 MiB, 3407872 bytes, 832 sectors
Disk model: Disk 1.0        
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x6f20736b

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sda1        778135908 1919645538 1141509631  4.3T 72 unknown
/dev/sda2        168689522 2104717761 1936028240  7.2T 65 Novell Netware 386
/dev/sda3       1869881465 3805909656 1936028192  7.2T 79 unknown
/dev/sda4                0 3637226495 3637226496 13.6T  d unknown

Partition table entries are not in disk order.


root@OpenWrt:~# cat /sys/kernel/debug/usb/devices 

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  1, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 4.14
S:  Manufacturer=Linux 4.14.162 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=ehci-platform
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 4
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=214b ProdID=7250 Rev= 1.00
S:  Product=USB2.0 HUB
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1ba0 ProdID=1131 Rev= 1.00
S:  Manufacturer=Jolimark
S:  Product=USBPrinter
S:  SerialNumber=18210087SF
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=03f0 ProdID=042a Rev= 1.00
S:  Manufacturer=Hewlett-Packard
S:  Product=HP LaserJet Professional M1136 MFP
S:  SerialNumber=000000000QH4HPPWPR1a
C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr= 98mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=10 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   8 Ivl=256ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=03 Dev#=  5 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=6868 ProdID=0500 Rev= 1.00
S:  Manufacturer=Printer
S:  Product=Printer
S:  SerialNumber=0532E1228977
C:* #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=04 Dev#=  6 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=152d ProdID=0578 Rev= 2.15
S:  Manufacturer=JMicron
S:  Product=USB to ATA/ATAPI Bridge
S:  SerialNumber=0123456789ABCDEF
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 0 Alt= 1 #EPs= 4 Cls=08(stor.) Sub=06 Prot=62 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

中间安装了几个包, 都起没起来作用

始终找不到我的那个移动硬盘,悲催了。。

待续

找了个群,在里面请教了一个名叫MK的大佬给我请了一条光辉大道
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第21张图片
按照这个把包一装,立马药到病除,搞定了,真是神人也,膜拜一下大佬吧
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第22张图片
如果不是windows下的磁盘格式的话, 挂载时不用加这个选项-o iocharset=utf8,不然会提示命令失败,挂载不上去,如果在界面上操作的话, 填了这个参数也会挂载不上。

root@OpenWrt:/mnt# mount -o iocharset=utf8 /dev/sda1 /mnt/sda1/
mount: /mnt/sda1: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.
root@OpenWrt:/mnt# mount /dev/sda1 /mnt/sda1/

如果是NFTS\exfat\vfat等windows下的格式,必须要加这个iocharset=utf8参数,不然中文会乱码,并且要指定文件系统,不能用auto。
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第23张图片

安装与配置FTP服务

opkg install vsftpd

防火墙开启21端口,如果有需要,可以进行端口转发

vi /etc/vsftpd.conf

做出如下修改

anonymous_enable=YES    #允许匿名用户访问(必须)
anon_root=/mnt/sda1/anymous   	#匿名用户根目录(必须)
ftp_username=nobody     #定义匿名用户名(必须,否则用浏览器打开匿名时会一直要求输入用户名密码)
local_enable=YES        #允许本地用户登录(必须,否则会不让root账户登陆)
local_root=/            #本地用户主目录(必须,否则手机播放器登陆FTP会显示目录为空)

chown root:nogroup /mnt/anymous
chmod 557 /mnt/anymous

重启 vsftpd

/etc/init.d/vsftpd restart

FTP详细步骤请看这个链接:http://www.senlt.cn/article/121857261.html

如果文件名前面有空格,记得处理一下,把前面的空格删除再上传, 不然到时候用FTP有的软件取文件会有问题,但是samba却没有问题,以防万一, 要删除掉文件名最前面的空格。
部署完了在本地映射一下
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第24张图片
当匿名访问时,往上放东西会提示这个, 我们需要看下怎么配置匿名访问权限
以下转自:https://www.python100.com/html/119296.html
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第25张图片
折腾WNDR4300路由器, 刷dd-wrt固件,安装Entware,部署cups打印服务器,改刷OPENWRT才成功识别打印机_第26张图片

部署samba

详细介绍:https://blog.csdn.net/lovelyed/article/details/119490646

最后写一下使用感受

本人一般是本着物尽其用的理念,不铺张浪费,够用就行。原来我的飞鱼星VW1200主路由端口只有3个LAN口不够用,就使用了一个4口百兆光猫当交换机用了一年, 现在我买了这个打印服务器, 顺便把原来百兆光猫给替换下来, 毕竟4300有千兆端口*4, 再不够用还可以把WAN口也改成LAN来使用,这下一个4300解决了两大问题, 还是很满意的,百兆换千兆也算是个小小的升级了。

优点:
1、再也不用开着一台电脑共享打印服务了,有时我下班关机了,或请假或出差,别的同事还要加班打单,那又得开机,这是最大的优点了
2、可以不受限制的远程打印,不用忍受龟速的内网穿透了,也不会被扫描端口打印出乱码,尤其是针式打印机连打的情况下,被扫描端口简直就是恶梦。
3、USB口可以随意插拔,不用时打印机甚至可以断电,都不会影响服务。
4、可以统一管理打印任务,在后台还可以看到历史打印任务:http://192.168.3.2:631/admin/log/page_log?

缺点:
唯一的缺点就是打印起来没有那么丝滑、流畅,当点开打印时,会有那么1秒钟的卡顿,不知道是什么原因引起的,我怀疑有可能受路由器的性能影响,以前用台式机打印共享,用起来那是非常流畅,豪无卡顿,不知道有没有解决办法。
用了半个月发现刚开始安装好时会卡,后面再也没有出现过,丝滑流畅得很,是不是刚开始初始化时才有的卡顿,现在真是太完美了。

你可能感兴趣的:(智能路由器)