第一步当然也是安装SANE啦
然后检查SANE能不能找到你的打印机
我的输出如下所示,可以看到已经识别出了扫描仪
found USB scanner (vendor=0x04a9 [Canon], product=0x176d [MG2500 series]) at libusb:001:008
# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.
# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.
# Also you need support for SCSI Generic (sg) in your operating system.
# If using Linux, try "modprobe sg".
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.
# Not checking for parallel port scanners.
# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
然后使用如下命令进一步尝试
应该会看到如下输出
' is a CANON Canon PIXMA MG2500 Series multi-function peripheral
现在你可以尝试扫描一些东西了
接着通过scp或者FTP把文件取出来瞅瞅,可以直接用一个查看图片的软件(比如GIMP)打开试试。
通过scp传回文件:
test
test
如果没得问题,我们就可以来配置SANE了。
打开/etc/default/saned
,修改/添加如下内容来配置打开SANE的守护进程
打开/etc/sane.d/saned.conf
并添加如下内容,让SANE接收192.168.114.1~192.168.114.255这个地址段的ip。请根据你的实际情况更改。如果你的局域网ip地址是192.168.1.x
,那么添加192.168.1.0/24
即可。
同时取消这行的注释
此外,我们还需要解决SANE的权限问题。我这里识别出的扫描仪是found USB scanner (vendor=0x04a9 [Canon], product=0x176d [MG2500 series]) at libusb:001:008
,libusb:001:008
即/dev/bus/usb/001/008
,使用如下命令查看权限
会获得如下输出
可以看到打印机归lp group的root所有,所以我们要把运行SANE守护进程的用户saned加到lp group
重启sane,将sane添加到启动项并检查它的status
enable
你会看到如下输出,可以看到6566端口是给SANE用的
你可以从官方的SANE frontends中选择一个你喜欢的程序作为客户端。我随便用SANEWinDS在windows上测试了一下,只要打开之后填写上树莓派的ip地址,即可开始扫描。记得修改resolution,最大可以到600ppi,默认的分辨率实在是太低了。