带有 QEMU 和 SANE 的 Raspberry Pi 上的 Brother x86 扫描仪驱动程序

带有 QEMU 和 SANE 的 Raspberry Pi 上的 Brother x86 扫描仪驱动程序

我有一台 Brother 7055 打印机/扫描仪和一台 Raspberry Pi,我想把它们都变成打印和扫描服务器。不幸的是,Brother 没有提供任何 ARM 驱动程序。我遇到了关于 Raspberry Pi 上的 QEMU 仿真的博客文章,实际上我已经成功使用这种方法安装了 x86 打印机驱动程序,我通过 CUPS 分享它,一切都很好。现在我正在尝试使扫描仪正常工作,并且 Brother 软件已安装且没有任何错误,但当我运行时扫描仪不显示scanimage -L

扫描仪已连接:

dporobic@raspberrypi:~ $ lsusb
Bus 001 Device 005: ID 04f9:0248 Brother Industries, Ltd DCP-7055 scanner/printer
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

但看不到扫描仪:

dporobic@raspberrypi:~ $ scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

sane-find-scanner 确实看到了一些东西,但无法使其工作,因为兄弟使用它自己的理智驱动程序。

porobic@raspberrypi:~ $ sudo sane-find-scanner 

  # 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".

found USB scanner (vendor=0x04f9, product=0x0248) at libusb:001:005
found USB scanner (vendor=0x0424, product=0xec00) at libusb:001:003
  # 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.

调试 scanimage 给出以下输出,看起来 Brother4 lib 无法加载:

dporobic@raspberrypi:~ $ sudo SANE_DEBUG_DLL=255 scanimage -L
[sanei_debug] Setting debug level of dll to 255.
[dll] sane_init: SANE dll backend version 1.0.13 from sane-backends 1.0.24
[dll] sane_init/read_dlld: attempting to open directory `./dll.d'
[dll] sane_init/read_dlld: attempting to open directory `/etc/sane.d/dll.d'
[dll] sane_init/read_dlld: using config directory `/etc/sane.d/dll.d'
[dll] sane_init/read_dlld: considering /etc/sane.d/dll.d/libsane-extras
[dll] sane_init/read_config: reading dll.d/libsane-extras
[dll] sane_init/read_dlld: done.
[dll] sane_init/read_config: reading dll.conf
[dll] add_backend: adding backend `brother4'
[dll] sane_get_devices
[dll] load: searching backend `brother4' in `/usr/lib/arm-linux-gnueabihf/sane:/usr/lib/sane'
[dll] load: trying to load `/usr/lib/arm-linux-gnueabihf/sane/libsane-brother4.so.1'
[dll] load: dlopen()ing `/usr/lib/arm-linux-gnueabihf/sane/libsane-brother4.so.1'
**[dll] load: dlopen() failed (/usr/lib/arm-linux-gnueabihf/sane/libsane-brother4.so.1: cannot open shared object file: No such file or directory)**
[dll] sane_get_devices: found 0 devices

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
[dll] sane_exit: exiting
[dll] sane_exit: finished

lib 文件在那里,但看起来无法打开或访问这些文件:

dporobic@raspberrypi:~ $ ls -l /usr/lib/arm-linux-gnueabihf/sane/ | grep brother
-rwxr-xr-x 1 root root 129696 Jan  8 11:08 libsane-brother4.so
-rwxr-xr-x 1 root root 129696 Jan  8 11:08 libsane-brother4.so.1
-rwxr-xr-x 1 root root 129696 Jan  8 11:08 libsane-brother4.so.1.0.7

也许 libsane-brother4.so 库的某些依赖项丢失,但运行 objdump -x 并在动态部分下查看会得到以下输出(我对 objdump 不太熟悉,所以我希望我能正确解释这一点):

dporobic@raspberrypi:~ $ objdump -x /usr/lib/arm-linux-gnueabihf/sane/libsane-brother4.so | grep NEEDED
  NEEDED               libpthread.so.0
  NEEDED               libnsl.so.1
  NEEDED               libusb-0.1.so.4
  NEEDED               libm.so.6
  NEEDED               libdl.so.2
  NEEDED               libc.so.6

我的 Pi 上似乎有这些库,其中只有一个仅作为 ARM 版本提供,而不作为 i386 版本提供,所有其他库都包含在这两个版本中:

dporobic@raspberrypi:~ $ sudo ldconfig -p | grep -E 'libpthread.so.0|libnsl.so.1|libusb-0.1.so.4|libm.so.6|libdl.so.2|libc.so.6'
        libusb-0.1.so.4 (libc6,hard-float) => /lib/arm-linux-gnueabihf/libusb-0.1.so.4
        libusb-0.1.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libusb-0.1.so.4
        libpthread.so.0 (libc6,hard-float, OS ABI: Linux 2.6.32) => /lib/arm-linux-gnueabihf/libpthread.so.0
        libpthread.so.0 (libc6, OS ABI: Linux 2.6.32) => /lib/i386-linux-gnu/libpthread.so.0
        libnsl.so.1 (libc6,hard-float, OS ABI: Linux 2.6.32) => /lib/arm-linux-gnueabihf/libnsl.so.1
        libnsl.so.1 (libc6, OS ABI: Linux 2.6.32) => /lib/i386-linux-gnu/libnsl.so.1
        libm.so.6 (libc6,hard-float, OS ABI: Linux 2.6.32) => /lib/arm-linux-gnueabihf/libm.so.6
        libm.so.6 (libc6, OS ABI: Linux 2.6.32) => /lib/i386-linux-gnu/libm.so.6
        libdl.so.2 (libc6,hard-float, OS ABI: Linux 2.6.32) => /lib/arm-linux-gnueabihf/libdl.so.2
        libdl.so.2 (libc6, OS ABI: Linux 2.6.32) => /lib/i386-linux-gnu/libdl.so.2
        libc.so.6 (libc6,hard-float, OS ABI: Linux 2.6.32) => /lib/arm-linux-gnueabihf/libc.so.6
        libc.so.6 (ELF, OS ABI: Linux 2.6.32) => /lib/i386-linux-gnu/libc.so.6

但我需要的一个库没有列出,可能这就是它无法加载的原因:

dporobic@raspberrypi:~ $ sudo ldconfig -p | grep libsane-brother4.so
dporobic@raspberrypi:~ $

最初 borther4 lib 位于/usr/lib/sane,我已添加此路径/etc/ld.so.conf.d/libsane-brother.conf并运行,但只有在签入时才sudo ldconfig获得此库:libsane.so.1ldconfig -v

dporobic@raspberrypi:~ $ sudo ldconfig -v 2>/dev/null | grep brother -B1
/usr/lib/sane:
        libsane.so.1 -> libsane-brother4.so.1.0.7

无法使libsane-brother.so.1lib 出现在 ld 缓存中...

更新

它似乎与 dlconfig 无关,在我的 opensuse 机器上,扫描仪正在工作,它libsane-brother.so.1 lib没有显示在 ldconfig 缓存中,就像在 Pi 上一样,但加载 lib 没有任何问题。

dporobic@latitude:~> sudo ldconfig -v 2>/dev/null | grep -E 'sane|brother'
        libksane.so.0 -> libksane.so.0.2.0
        libsane.so.1 -> libsane.so.1.0.24

加载正确,没有错误:

dporobic@latitude:~> sudo SANE_DEBUG_DLL=255 scanimage -L
[sanei_debug] Setting debug level of dll to 255.
[dll] sane_init: SANE dll backend version 1.0.13 from sane-backends 1.0.24
[dll] sane_init/read_dlld: attempting to open directory `./dll.d'
[dll] sane_init/read_dlld: attempting to open directory `/etc/sane.d/dll.d'
[dll] sane_init/read_dlld: opendir failed: No such file or directory
[dll] sane_init/read_config: reading dll.conf
[dll] add_backend: adding backend `brother4'
[dll] sane_get_devices
[dll] load: searching backend `brother4' in `/usr/lib64/sane'
[dll] load: trying to load `/usr/lib64/sane/libsane-brother4.so.1'
**[dll] load: dlopen()ing `/usr/lib64/sane/libsane-brother4.so.1'**
[dll] init: initializing backend `brother4'
[dll] init: backend `brother4' is version 1.0.1
[dll] sane_get_devices: found 1 devices
device `brother4:bus2;dev1' is a Brother DCP-7055 USB scanner
[dll] sane_exit: exiting
[dll] sane_exit: calling backend `brother4's exit function
[dll] sane_exit: finished

libsane-brother.so.1 lib那么现在的问题是为什么Sane即使在正确的路径上也无法打开......

注意:当我运行时,会出现直接连接到我的 OpenSuse 机器并安装了相同驱动程序的相同扫描仪,scanimage -L因此它必须能够正常工作,这里唯一值得怀疑的是 Pi。

答案1

去年我解决了类似的挑战。在arm上(与Armbian,Raspian是一样的),我首先在这台机器上的qemu打印的帮助下安装(mfc 795cw)。扫描仪无法工作,但需要在该arm linux上安装扫描失败的驱动程序。为了进行扫描,我设置了一个 chroot 环境。您需要一个与 Brother Linux 驱动程序相关的当年使用的 Linux 版本。因此我使用Lubuntu 10.04。请注意不要卸载 lpr!。你必须在这个 chroot 环境中运行 Brother linux 安装程序。然后在arm-Linux 中打印,在chroot i368 Linux 中扫描。我设置了一个用于扫描的脚本,以使用 scanimage 启动 chroot(安装 -o bind、qemu,....)。

答案2

这是因为使用的是 sane (armhf) 而不是 i383 架构。如果您安装架构 i386 的 sane,您将加载驱动程序 libsane-brother4.so.1。但此时我遇到了一个问题,sane(i386)无法与libusb(armhf)一起使用。这是内核模块而不是用户级别。我不明白如何解决这个问题。

答案3

这将需要 qemu 系统模拟,因此可能运行例如 DSL 来宾与 cups 和 saned 共享 USB 打印机/扫描仪与主机 raspbian 重新与世界其他地方(或您的本地网络)共享。这只是一个想法,不知道是否实用。

相关内容